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; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 const std::string& name() const { return name_; } | 216 const std::string& name() const { return name_; } |
216 void set_name(const std::string& name) { name_ = name; } | 217 void set_name(const std::string& name) { name_ = name; } |
217 | 218 |
218 const ui::Texture* texture() const { return texture_.get(); } | 219 const ui::Texture* texture() const { return texture_.get(); } |
219 | 220 |
220 // Assigns a new external texture. |texture| can be NULL to disable external | 221 // Assigns a new external texture. |texture| can be NULL to disable external |
221 // updates. | 222 // updates. |
222 void SetExternalTexture(ui::Texture* texture); | 223 void SetExternalTexture(ui::Texture* texture); |
223 ui::Texture* external_texture() { return texture_.get(); } | 224 ui::Texture* external_texture() { return texture_.get(); } |
224 | 225 |
| 226 void SetCompositorFrame(const WebKit::WebCompositorFrame& frame); |
| 227 void GetRecycledResources(cc::TransferableResourceList* list); |
| 228 |
225 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. | 229 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
226 void SetColor(SkColor color); | 230 void SetColor(SkColor color); |
227 | 231 |
228 // Adds |invalid_rect| to the Layer's pending invalid rect and calls | 232 // Adds |invalid_rect| to the Layer's pending invalid rect and calls |
229 // ScheduleDraw(). Returns false if the paint request is ignored. | 233 // ScheduleDraw(). Returns false if the paint request is ignored. |
230 bool SchedulePaint(const gfx::Rect& invalid_rect); | 234 bool SchedulePaint(const gfx::Rect& invalid_rect); |
231 | 235 |
232 // Schedules a redraw of the layer tree at the compositor. | 236 // Schedules a redraw of the layer tree at the compositor. |
233 // Note that this _does not_ invalidate any region of this layer; use | 237 // Note that this _does not_ invalidate any region of this layer; use |
234 // SchedulePaint() for that. | 238 // SchedulePaint() for that. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 380 |
377 LayerDelegate* delegate_; | 381 LayerDelegate* delegate_; |
378 | 382 |
379 scoped_refptr<LayerAnimator> animator_; | 383 scoped_refptr<LayerAnimator> animator_; |
380 | 384 |
381 // Ownership of the layer is held through one of the strongly typed layer | 385 // Ownership of the layer is held through one of the strongly typed layer |
382 // pointers, depending on which sort of layer this is. | 386 // pointers, depending on which sort of layer this is. |
383 scoped_ptr<WebKit::WebContentLayer> content_layer_; | 387 scoped_ptr<WebKit::WebContentLayer> content_layer_; |
384 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; | 388 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; |
385 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; | 389 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; |
| 390 scoped_ptr<WebKit::WebDelegatedRendererLayer> delegated_renderer_layer_; |
386 WebKit::WebLayer* web_layer_; | 391 WebKit::WebLayer* web_layer_; |
387 bool web_layer_is_accelerated_; | 392 bool web_layer_is_accelerated_; |
388 bool show_debug_borders_; | 393 bool show_debug_borders_; |
389 | 394 |
390 // If true, the layer scales the canvas and the texture with the device scale | 395 // 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. | 396 // factor as appropriate. When true, the texture size is in DIP. |
392 bool scale_content_; | 397 bool scale_content_; |
393 | 398 |
394 // A cached copy of |Compositor::device_scale_factor()|. | 399 // A cached copy of |Compositor::device_scale_factor()|. |
395 float device_scale_factor_; | 400 float device_scale_factor_; |
396 | 401 |
397 DISALLOW_COPY_AND_ASSIGN(Layer); | 402 DISALLOW_COPY_AND_ASSIGN(Layer); |
398 }; | 403 }; |
399 | 404 |
400 } // namespace ui | 405 } // namespace ui |
401 | 406 |
402 #endif // UI_COMPOSITOR_LAYER_H_ | 407 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |