OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010, Google Inc. | 2 * Copyright 2010, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 13 matching lines...) Expand all Loading... |
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 | 32 |
33 #include "core/cross/cairo/layer.h" | 33 #include "core/cross/cairo/layer.h" |
| 34 |
34 #include "core/cross/error.h" | 35 #include "core/cross/error.h" |
35 #include "core/cross/renderer.h" | 36 #include "core/cross/renderer.h" |
36 #include "core/cross/cairo/renderer_cairo.h" | 37 #include "core/cross/cairo/renderer_cairo.h" |
37 #include "core/cross/cairo/texture_cairo.h" | |
38 | 38 |
39 namespace o3d { | 39 namespace o3d { |
40 | 40 |
41 namespace o2d { | 41 namespace o2d { |
42 | 42 |
43 O3D_DEFN_CLASS(Layer, ParamObject); | 43 O3D_DEFN_CLASS(Layer, ObjectBase); |
44 | 44 |
45 Layer::Layer(ServiceLocator* service_locator) | 45 Layer::Layer(ServiceLocator* service_locator) |
46 : ParamObject(service_locator), | 46 : ObjectBase(service_locator), |
47 texture_(NULL), | 47 alpha_(1.0), |
48 alpha_(0), | 48 x_(0), |
49 scale_x_(0), | 49 y_(0), |
50 scale_y_(0), | 50 width_(0), |
51 translate_x_(0), | 51 height_(0), |
52 translate_y_(0) { | 52 scale_x_(1.0), |
| 53 scale_y_(1.0) { |
53 DLOG(INFO) << "Create Layer"; | 54 DLOG(INFO) << "Create Layer"; |
54 } | 55 } |
55 | 56 |
56 ObjectBase::Ref Layer::Create(ServiceLocator* service_locator) { | 57 ObjectBase::Ref Layer::Create(ServiceLocator* service_locator) { |
57 Renderer* renderer = service_locator->GetService<Renderer>(); | 58 Renderer* renderer = service_locator->GetService<Renderer>(); |
58 if (NULL == renderer) { | 59 if (NULL == renderer) { |
59 O3D_ERROR(service_locator) << "No Render Device Available"; | 60 O3D_ERROR(service_locator) << "No Render Device Available"; |
60 return ObjectBase::Ref(); | 61 return ObjectBase::Ref(); |
61 } | 62 } |
62 | 63 |
63 Layer* image = new Layer(service_locator); | 64 Layer* image = new Layer(service_locator); |
64 | 65 |
65 RendererCairo* renderer2d = down_cast<RendererCairo*>(renderer); | 66 RendererCairo* renderer2d = down_cast<RendererCairo*>(renderer); |
66 renderer2d->AddLayer(image); | 67 renderer2d->AddLayer(image); |
67 | 68 |
68 return ObjectBase::Ref(image); | 69 return ObjectBase::Ref(image); |
69 } | 70 } |
70 | 71 |
71 } // namespace o2d | 72 } // namespace o2d |
72 | 73 |
73 } // namespace o3d | 74 } // namespace o3d |
OLD | NEW |