Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Side by Side Diff: core/cross/cairo/layer.cc

Issue 6320002: O2D: Several (unrelated) improvements:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « core/cross/cairo/layer.h ('k') | core/cross/cairo/renderer_cairo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 #include "core/cross/error.h" 35 #include "core/cross/error.h"
36 #include "core/cross/renderer.h" 36 #include "core/cross/renderer.h"
37 #include "core/cross/cairo/renderer_cairo.h" 37 #include "core/cross/cairo/renderer_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, ObjectBase); 43 O3D_DEFN_CLASS(Layer, ObjectBase);
44 44
45 Layer::~Layer() {
46 Renderer* renderer = service_locator()->GetService<Renderer>();
47 RendererCairo* renderer_cairo = down_cast<RendererCairo*>(renderer);
48 renderer_cairo->RemoveLayer(this);
49 }
50
45 Layer::Layer(ServiceLocator* service_locator) 51 Layer::Layer(ServiceLocator* service_locator)
46 : ObjectBase(service_locator), 52 : ObjectBase(service_locator),
47 alpha_(1.0), 53 alpha_(1.0),
48 x_(0), 54 x_(0),
49 y_(0), 55 y_(0),
56 z_(0),
50 width_(0), 57 width_(0),
51 height_(0), 58 height_(0),
52 scale_x_(1.0), 59 scale_x_(1.0),
53 scale_y_(1.0) { 60 scale_y_(1.0) {
54 DLOG(INFO) << "Create Layer"; 61 DLOG(INFO) << "Create Layer";
62 Renderer* renderer = service_locator->GetService<Renderer>();
63 RendererCairo* renderer_cairo = down_cast<RendererCairo*>(renderer);
64 renderer_cairo->AddLayer(this);
55 } 65 }
56 66
57 ObjectBase::Ref Layer::Create(ServiceLocator* service_locator) { 67 ObjectBase::Ref Layer::Create(ServiceLocator* service_locator) {
58 Renderer* renderer = service_locator->GetService<Renderer>(); 68 Renderer* renderer = service_locator->GetService<Renderer>();
59 if (NULL == renderer) { 69 if (NULL == renderer) {
60 O3D_ERROR(service_locator) << "No Render Device Available"; 70 O3D_ERROR(service_locator) << "No Render Device Available";
61 return ObjectBase::Ref(); 71 return ObjectBase::Ref();
62 } 72 }
63 73
64 Layer* image = new Layer(service_locator); 74 Layer* layer = new Layer(service_locator);
65 75
66 RendererCairo* renderer2d = down_cast<RendererCairo*>(renderer); 76 return ObjectBase::Ref(layer);
67 renderer2d->AddLayer(image);
68
69 return ObjectBase::Ref(image);
70 } 77 }
71 78
72 } // namespace o2d 79 } // namespace o2d
73 80
74 } // namespace o3d 81 } // namespace o3d
OLDNEW
« no previous file with comments | « core/cross/cairo/layer.h ('k') | core/cross/cairo/renderer_cairo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698