| OLD | NEW |
| 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/WebExternalTextureL
ayerClient.h" |
| 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" |
| 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayer.h" | 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayer.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebSolidColorLayer.
h" | 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebSolidColorLayer.
h" |
| 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL
ayer.h" | 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL
ayer.h" |
| 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebDelegatedRendere
rLayer.h" |
| 21 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
| 22 #include "third_party/skia/include/core/SkRegion.h" | 23 #include "third_party/skia/include/core/SkRegion.h" |
| 23 #include "ui/compositor/compositor.h" | 24 #include "ui/compositor/compositor.h" |
| 24 #include "ui/compositor/layer_animation_delegate.h" | 25 #include "ui/compositor/layer_animation_delegate.h" |
| 25 #include "ui/compositor/layer_delegate.h" | 26 #include "ui/compositor/layer_delegate.h" |
| 26 #include "ui/compositor/layer_type.h" | 27 #include "ui/compositor/layer_type.h" |
| 27 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
| 28 #include "ui/gfx/transform.h" | 29 #include "ui/gfx/transform.h" |
| 29 | 30 |
| 30 class SkCanvas; | 31 class SkCanvas; |
| 31 | 32 |
| 33 namespace cc { |
| 34 struct TransferableResourceList; |
| 35 } |
| 36 |
| 32 namespace ui { | 37 namespace ui { |
| 33 | 38 |
| 34 class Compositor; | 39 class Compositor; |
| 35 class LayerAnimator; | 40 class LayerAnimator; |
| 36 class Texture; | 41 class Texture; |
| 37 | 42 |
| 38 // Layer manages a texture, transform and a set of child Layers. Any View that | 43 // Layer manages a texture, transform and a set of child Layers. Any View that |
| 39 // has enabled layers ends up creating a Layer to manage the texture. | 44 // has enabled layers ends up creating a Layer to manage the texture. |
| 40 // A Layer can also be created without a texture, in which case it renders | 45 // A Layer can also be created without a texture, in which case it renders |
| 41 // nothing and is simply used as a node in a hierarchy of layers. | 46 // nothing and is simply used as a node in a hierarchy of layers. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 const std::string& name() const { return name_; } | 220 const std::string& name() const { return name_; } |
| 216 void set_name(const std::string& name) { name_ = name; } | 221 void set_name(const std::string& name) { name_ = name; } |
| 217 | 222 |
| 218 const ui::Texture* texture() const { return texture_.get(); } | 223 const ui::Texture* texture() const { return texture_.get(); } |
| 219 | 224 |
| 220 // Assigns a new external texture. |texture| can be NULL to disable external | 225 // Assigns a new external texture. |texture| can be NULL to disable external |
| 221 // updates. | 226 // updates. |
| 222 void SetExternalTexture(ui::Texture* texture); | 227 void SetExternalTexture(ui::Texture* texture); |
| 223 ui::Texture* external_texture() { return texture_.get(); } | 228 ui::Texture* external_texture() { return texture_.get(); } |
| 224 | 229 |
| 230 void SetCompositorFrame(const WebKit::WebCompositorFrame& frame); |
| 231 void GetRecycledResources(cc::TransferableResourceList* list); |
| 232 |
| 225 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. | 233 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
| 226 void SetColor(SkColor color); | 234 void SetColor(SkColor color); |
| 227 | 235 |
| 228 // Adds |invalid_rect| to the Layer's pending invalid rect and calls | 236 // Adds |invalid_rect| to the Layer's pending invalid rect and calls |
| 229 // ScheduleDraw(). Returns false if the paint request is ignored. | 237 // ScheduleDraw(). Returns false if the paint request is ignored. |
| 230 bool SchedulePaint(const gfx::Rect& invalid_rect); | 238 bool SchedulePaint(const gfx::Rect& invalid_rect); |
| 231 | 239 |
| 232 // Schedules a redraw of the layer tree at the compositor. | 240 // Schedules a redraw of the layer tree at the compositor. |
| 233 // Note that this _does not_ invalidate any region of this layer; use | 241 // Note that this _does not_ invalidate any region of this layer; use |
| 234 // SchedulePaint() for that. | 242 // SchedulePaint() for that. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 384 |
| 377 LayerDelegate* delegate_; | 385 LayerDelegate* delegate_; |
| 378 | 386 |
| 379 scoped_refptr<LayerAnimator> animator_; | 387 scoped_refptr<LayerAnimator> animator_; |
| 380 | 388 |
| 381 // Ownership of the layer is held through one of the strongly typed layer | 389 // Ownership of the layer is held through one of the strongly typed layer |
| 382 // pointers, depending on which sort of layer this is. | 390 // pointers, depending on which sort of layer this is. |
| 383 scoped_ptr<WebKit::WebContentLayer> content_layer_; | 391 scoped_ptr<WebKit::WebContentLayer> content_layer_; |
| 384 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; | 392 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; |
| 385 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; | 393 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; |
| 394 scoped_ptr<WebKit::WebDelegatedRendererLayer> delegated_renderer_layer_; |
| 386 WebKit::WebLayer* web_layer_; | 395 WebKit::WebLayer* web_layer_; |
| 387 bool web_layer_is_accelerated_; | 396 bool web_layer_is_accelerated_; |
| 388 bool show_debug_borders_; | 397 bool show_debug_borders_; |
| 389 | 398 |
| 390 // If true, the layer scales the canvas and the texture with the device scale | 399 // If true, the layer scales the canvas and the texture with the device scale |
| 391 // factor as appropriate. When true, the texture size is in DIP. | 400 // factor as appropriate. When true, the texture size is in DIP. |
| 392 bool scale_content_; | 401 bool scale_content_; |
| 393 | 402 |
| 394 // A cached copy of |Compositor::device_scale_factor()|. | 403 // A cached copy of |Compositor::device_scale_factor()|. |
| 395 float device_scale_factor_; | 404 float device_scale_factor_; |
| 396 | 405 |
| 397 DISALLOW_COPY_AND_ASSIGN(Layer); | 406 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 398 }; | 407 }; |
| 399 | 408 |
| 400 } // namespace ui | 409 } // namespace ui |
| 401 | 410 |
| 402 #endif // UI_COMPOSITOR_LAYER_H_ | 411 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |