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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ui/compositor/layer_animation_delegate.h" | 24 #include "ui/compositor/layer_animation_delegate.h" |
25 #include "ui/compositor/layer_delegate.h" | 25 #include "ui/compositor/layer_delegate.h" |
26 #include "ui/compositor/layer_type.h" | 26 #include "ui/compositor/layer_type.h" |
27 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
28 #include "ui/gfx/transform.h" | 28 #include "ui/gfx/transform.h" |
29 | 29 |
30 class SkCanvas; | 30 class SkCanvas; |
31 | 31 |
32 namespace cc { | 32 namespace cc { |
33 class ContentLayer; | 33 class ContentLayer; |
| 34 class CopyOutputRequest; |
34 class DelegatedFrameData; | 35 class DelegatedFrameData; |
35 class DelegatedRendererLayer; | 36 class DelegatedRendererLayer; |
36 class Layer; | 37 class Layer; |
37 class ResourceUpdateQueue; | 38 class ResourceUpdateQueue; |
38 class SolidColorLayer; | 39 class SolidColorLayer; |
39 class TextureLayer; | 40 class TextureLayer; |
40 struct TransferableResource; | 41 struct TransferableResource; |
41 typedef std::vector<TransferableResource> TransferableResourceArray; | 42 typedef std::vector<TransferableResource> TransferableResourceArray; |
42 } | 43 } |
43 | 44 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 254 |
254 // Set new TextureMailbox for this layer. Note that |mailbox| may hold a | 255 // Set new TextureMailbox for this layer. Note that |mailbox| may hold a |
255 // shared memory resource or an actual mailbox for a texture. | 256 // shared memory resource or an actual mailbox for a texture. |
256 void SetTextureMailbox(const cc::TextureMailbox& mailbox, float scale_factor); | 257 void SetTextureMailbox(const cc::TextureMailbox& mailbox, float scale_factor); |
257 cc::TextureMailbox GetTextureMailbox(float* scale_factor); | 258 cc::TextureMailbox GetTextureMailbox(float* scale_factor); |
258 | 259 |
259 // Sets a delegated frame, coming from a child compositor. | 260 // Sets a delegated frame, coming from a child compositor. |
260 void SetDelegatedFrame(scoped_ptr<cc::DelegatedFrameData> frame, | 261 void SetDelegatedFrame(scoped_ptr<cc::DelegatedFrameData> frame, |
261 gfx::Size frame_size_in_dip); | 262 gfx::Size frame_size_in_dip); |
262 | 263 |
| 264 bool has_external_content() { |
| 265 return texture_layer_.get() || delegated_renderer_layer_.get(); |
| 266 } |
| 267 |
263 // Gets unused resources to recycle to the child compositor. | 268 // Gets unused resources to recycle to the child compositor. |
264 void TakeUnusedResourcesForChildCompositor( | 269 void TakeUnusedResourcesForChildCompositor( |
265 cc::TransferableResourceArray* array); | 270 cc::TransferableResourceArray* array); |
266 | 271 |
267 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. | 272 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
268 void SetColor(SkColor color); | 273 void SetColor(SkColor color); |
269 | 274 |
270 // Adds |invalid_rect| to the Layer's pending invalid rect and calls | 275 // Adds |invalid_rect| to the Layer's pending invalid rect and calls |
271 // ScheduleDraw(). Returns false if the paint request is ignored. | 276 // ScheduleDraw(). Returns false if the paint request is ignored. |
272 bool SchedulePaint(const gfx::Rect& invalid_rect); | 277 bool SchedulePaint(const gfx::Rect& invalid_rect); |
(...skipping 22 matching lines...) Expand all Loading... |
295 // not apply to the canvas passed to the pending draw. | 300 // not apply to the canvas passed to the pending draw. |
296 void set_scale_content(bool scale_content) { scale_content_ = scale_content; } | 301 void set_scale_content(bool scale_content) { scale_content_ = scale_content; } |
297 | 302 |
298 // Returns true if the layer scales its content. | 303 // Returns true if the layer scales its content. |
299 bool scale_content() const { return scale_content_; } | 304 bool scale_content() const { return scale_content_; } |
300 | 305 |
301 // Sometimes the Layer is being updated by something other than SetCanvas | 306 // Sometimes the Layer is being updated by something other than SetCanvas |
302 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). | 307 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). |
303 bool layer_updated_externally() const { return layer_updated_externally_; } | 308 bool layer_updated_externally() const { return layer_updated_externally_; } |
304 | 309 |
| 310 // Requets a copy of the layer's output as a texture or bitmap. |
| 311 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); |
| 312 |
305 // ContentLayerClient | 313 // ContentLayerClient |
306 virtual void PaintContents( | 314 virtual void PaintContents( |
307 SkCanvas* canvas, gfx::Rect clip, gfx::RectF* opaque) OVERRIDE; | 315 SkCanvas* canvas, gfx::Rect clip, gfx::RectF* opaque) OVERRIDE; |
308 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} | 316 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} |
309 | 317 |
310 cc::Layer* cc_layer() { return cc_layer_; } | 318 cc::Layer* cc_layer() { return cc_layer_; } |
311 | 319 |
312 // TextureLayerClient | 320 // TextureLayerClient |
313 virtual unsigned PrepareTexture(cc::ResourceUpdateQueue* queue) OVERRIDE; | 321 virtual unsigned PrepareTexture(cc::ResourceUpdateQueue* queue) OVERRIDE; |
314 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; | 322 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 // The size of the delegated frame in DIP, set when SetDelegatedFrame was | 485 // The size of the delegated frame in DIP, set when SetDelegatedFrame was |
478 // called. | 486 // called. |
479 gfx::Size delegated_frame_size_in_dip_; | 487 gfx::Size delegated_frame_size_in_dip_; |
480 | 488 |
481 DISALLOW_COPY_AND_ASSIGN(Layer); | 489 DISALLOW_COPY_AND_ASSIGN(Layer); |
482 }; | 490 }; |
483 | 491 |
484 } // namespace ui | 492 } // namespace ui |
485 | 493 |
486 #endif // UI_COMPOSITOR_LAYER_H_ | 494 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |