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

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

Issue 10689108: Aura: Have ui::Layer implement WebKit::WebExternalTextureLayerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer comments, remove dead code, plumb through context. Created 8 years, 5 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
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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie nt.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie nt.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL ayerClient.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
18 #include "third_party/skia/include/core/SkColor.h" 19 #include "third_party/skia/include/core/SkColor.h"
19 #include "third_party/skia/include/core/SkRegion.h" 20 #include "third_party/skia/include/core/SkRegion.h"
20 #include "ui/compositor/compositor.h" 21 #include "ui/compositor/compositor.h"
21 #include "ui/compositor/layer_animation_delegate.h" 22 #include "ui/compositor/layer_animation_delegate.h"
22 #include "ui/compositor/layer_delegate.h" 23 #include "ui/compositor/layer_delegate.h"
23 #include "ui/compositor/layer_type.h" 24 #include "ui/compositor/layer_type.h"
24 #include "ui/gfx/rect.h" 25 #include "ui/gfx/rect.h"
25 #include "ui/gfx/transform.h" 26 #include "ui/gfx/transform.h"
26 27
27 class SkCanvas; 28 class SkCanvas;
28 29
29 namespace ui { 30 namespace ui {
30 31
31 class Compositor; 32 class Compositor;
32 class LayerAnimator; 33 class LayerAnimator;
33 class Texture; 34 class Texture;
34 35
35 // Layer manages a texture, transform and a set of child Layers. Any View that 36 // Layer manages a texture, transform and a set of child Layers. Any View that
36 // has enabled layers ends up creating a Layer to manage the texture. 37 // has enabled layers ends up creating a Layer to manage the texture.
37 // A Layer can also be created without a texture, in which case it renders 38 // A Layer can also be created without a texture, in which case it renders
38 // nothing and is simply used as a node in a hierarchy of layers. 39 // nothing and is simply used as a node in a hierarchy of layers.
39 // Coordinate system used in layers is DIP (Density Independent Pixel) 40 // Coordinate system used in layers is DIP (Density Independent Pixel)
40 // coordinates unless explicitly mentioned as pixel coordinates. 41 // coordinates unless explicitly mentioned as pixel coordinates.
41 // 42 //
42 // NOTE: unlike Views, each Layer does *not* own its children views. If you 43 // NOTE: unlike Views, each Layer does *not* own its children views. If you
43 // delete a Layer and it has children, the parent of each child layer is set to 44 // delete a Layer and it has children, the parent of each child layer is set to
44 // NULL, but the children are not deleted. 45 // NULL, but the children are not deleted.
45 class COMPOSITOR_EXPORT Layer : 46 class COMPOSITOR_EXPORT Layer
46 public LayerAnimationDelegate, 47 : public LayerAnimationDelegate,
47 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) { 48 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient),
49 NON_EXPORTED_BASE(public WebKit::WebExternalTextureLayerClient) {
48 public: 50 public:
49 Layer(); 51 Layer();
50 explicit Layer(LayerType type); 52 explicit Layer(LayerType type);
51 virtual ~Layer(); 53 virtual ~Layer();
52 54
53 // Retrieves the Layer's compositor. The Layer will walk up its parent chain 55 // Retrieves the Layer's compositor. The Layer will walk up its parent chain
54 // to locate it. Returns NULL if the Layer is not attached to a compositor. 56 // to locate it. Returns NULL if the Layer is not attached to a compositor.
55 Compositor* GetCompositor(); 57 Compositor* GetCompositor();
56 58
57 // Called by the compositor when the Layer is set as its root Layer. This can 59 // Called by the compositor when the Layer is set as its root Layer. This can
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 virtual void paintContents(WebKit::WebCanvas*, 232 virtual void paintContents(WebKit::WebCanvas*,
231 const WebKit::WebRect& clip, 233 const WebKit::WebRect& clip,
232 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT) 234 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT)
233 WebKit::WebFloatRect& opaque); 235 WebKit::WebFloatRect& opaque);
234 #else 236 #else
235 WebKit::WebRect& opaque); 237 WebKit::WebRect& opaque);
236 #endif 238 #endif
237 239
238 WebKit::WebLayer web_layer() { return web_layer_; } 240 WebKit::WebLayer web_layer() { return web_layer_; }
239 241
242 // WebExternalTextureLayerClient
243 virtual unsigned prepareTexture(
244 WebKit::WebTextureUpdater& /* updater */) OVERRIDE;
245 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
246
240 float device_scale_factor() const { return device_scale_factor_; } 247 float device_scale_factor() const { return device_scale_factor_; }
241 248
242 // Forces a render surface to be used on this layer. This has no positive 249 // Forces a render surface to be used on this layer. This has no positive
243 // impact, and is only used for benchmarking/testing purpose. 250 // impact, and is only used for benchmarking/testing purpose.
244 void SetForceRenderSurface(bool force); 251 void SetForceRenderSurface(bool force);
245 bool force_render_surface() const { return force_render_surface_; } 252 bool force_render_surface() const { return force_render_surface_; }
246 253
247 private: 254 private:
248 // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than 255 // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than
249 // 1.0, we'll render to a separate texture, and then apply the alpha. 256 // 1.0, we'll render to a separate texture, and then apply the alpha.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 353
347 // A cached copy of |Compositor::device_scale_factor()|. 354 // A cached copy of |Compositor::device_scale_factor()|.
348 float device_scale_factor_; 355 float device_scale_factor_;
349 356
350 DISALLOW_COPY_AND_ASSIGN(Layer); 357 DISALLOW_COPY_AND_ASSIGN(Layer);
351 }; 358 };
352 359
353 } // namespace ui 360 } // namespace ui
354 361
355 #endif // UI_COMPOSITOR_LAYER_H_ 362 #endif // UI_COMPOSITOR_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698