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

Side by Side Diff: ui/compositor/layer.h

Issue 10824270: Revert 151153 - Partial revert of 146621 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | « ui/compositor/compositor.h ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_COMPOSITOR_LAYER_H_ 5 #ifndef UI_COMPOSITOR_LAYER_H_
6 #define UI_COMPOSITOR_LAYER_H_ 6 #define UI_COMPOSITOR_LAYER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie nt.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie nt.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL ayerClient.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
17 #include "third_party/skia/include/core/SkColor.h" 18 #include "third_party/skia/include/core/SkColor.h"
18 #include "third_party/skia/include/core/SkRegion.h" 19 #include "third_party/skia/include/core/SkRegion.h"
19 #include "ui/compositor/compositor.h" 20 #include "ui/compositor/compositor.h"
20 #include "ui/compositor/layer_animation_delegate.h" 21 #include "ui/compositor/layer_animation_delegate.h"
21 #include "ui/compositor/layer_delegate.h" 22 #include "ui/compositor/layer_delegate.h"
22 #include "ui/compositor/layer_type.h" 23 #include "ui/compositor/layer_type.h"
23 #include "ui/gfx/rect.h" 24 #include "ui/gfx/rect.h"
24 #include "ui/gfx/transform.h" 25 #include "ui/gfx/transform.h"
25 26
(...skipping 10 matching lines...) Expand all
36 // A Layer can also be created without a texture, in which case it renders 37 // A Layer can also be created without a texture, in which case it renders
37 // nothing and is simply used as a node in a hierarchy of layers. 38 // nothing and is simply used as a node in a hierarchy of layers.
38 // Coordinate system used in layers is DIP (Density Independent Pixel) 39 // Coordinate system used in layers is DIP (Density Independent Pixel)
39 // coordinates unless explicitly mentioned as pixel coordinates. 40 // coordinates unless explicitly mentioned as pixel coordinates.
40 // 41 //
41 // NOTE: unlike Views, each Layer does *not* own its children views. If you 42 // NOTE: unlike Views, each Layer does *not* own its children views. If you
42 // delete a Layer and it has children, the parent of each child layer is set to 43 // delete a Layer and it has children, the parent of each child layer is set to
43 // NULL, but the children are not deleted. 44 // NULL, but the children are not deleted.
44 class COMPOSITOR_EXPORT Layer 45 class COMPOSITOR_EXPORT Layer
45 : public LayerAnimationDelegate, 46 : public LayerAnimationDelegate,
46 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) { 47 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient),
48 NON_EXPORTED_BASE(public WebKit::WebExternalTextureLayerClient) {
47 public: 49 public:
48 Layer(); 50 Layer();
49 explicit Layer(LayerType type); 51 explicit Layer(LayerType type);
50 virtual ~Layer(); 52 virtual ~Layer();
51 53
52 // Retrieves the Layer's compositor. The Layer will walk up its parent chain 54 // Retrieves the Layer's compositor. The Layer will walk up its parent chain
53 // to locate it. Returns NULL if the Layer is not attached to a compositor. 55 // to locate it. Returns NULL if the Layer is not attached to a compositor.
54 Compositor* GetCompositor(); 56 Compositor* GetCompositor();
55 57
56 // Called by the compositor when the Layer is set as its root Layer. This can 58 // Called by the compositor when the Layer is set as its root Layer. This can
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 virtual void paintContents(WebKit::WebCanvas*, 255 virtual void paintContents(WebKit::WebCanvas*,
254 const WebKit::WebRect& clip, 256 const WebKit::WebRect& clip,
255 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT) 257 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT)
256 WebKit::WebFloatRect& opaque); 258 WebKit::WebFloatRect& opaque);
257 #else 259 #else
258 WebKit::WebRect& opaque); 260 WebKit::WebRect& opaque);
259 #endif 261 #endif
260 262
261 WebKit::WebLayer web_layer() { return web_layer_; } 263 WebKit::WebLayer web_layer() { return web_layer_; }
262 264
265 // WebExternalTextureLayerClient
266 virtual unsigned prepareTexture(
267 WebKit::WebTextureUpdater& /* updater */) OVERRIDE;
268 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
269
263 float device_scale_factor() const { return device_scale_factor_; } 270 float device_scale_factor() const { return device_scale_factor_; }
264 271
265 // Forces a render surface to be used on this layer. This has no positive 272 // Forces a render surface to be used on this layer. This has no positive
266 // impact, and is only used for benchmarking/testing purpose. 273 // impact, and is only used for benchmarking/testing purpose.
267 void SetForceRenderSurface(bool force); 274 void SetForceRenderSurface(bool force);
268 bool force_render_surface() const { return force_render_surface_; } 275 bool force_render_surface() const { return force_render_surface_; }
269 276
270 private: 277 private:
271 // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than 278 // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than
272 // 1.0, we'll render to a separate texture, and then apply the alpha. 279 // 1.0, we'll render to a separate texture, and then apply the alpha.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 390
384 // A cached copy of |Compositor::device_scale_factor()|. 391 // A cached copy of |Compositor::device_scale_factor()|.
385 float device_scale_factor_; 392 float device_scale_factor_;
386 393
387 DISALLOW_COPY_AND_ASSIGN(Layer); 394 DISALLOW_COPY_AND_ASSIGN(Layer);
388 }; 395 };
389 396
390 } // namespace ui 397 } // namespace ui
391 398
392 #endif // UI_COMPOSITOR_LAYER_H_ 399 #endif // UI_COMPOSITOR_LAYER_H_
OLDNEW
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698