| 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/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "cc/animation/animation_events.h" | 15 #include "cc/animation/animation_events.h" |
| 16 #include "cc/animation/layer_animation_event_observer.h" | 16 #include "cc/animation/layer_animation_event_observer.h" |
| 17 #include "cc/base/scoped_ptr_vector.h" | 17 #include "cc/base/scoped_ptr_vector.h" |
| 18 #include "cc/layers/content_layer_client.h" | 18 #include "cc/layers/content_layer_client.h" |
| 19 #include "cc/layers/layer_client.h" | 19 #include "cc/layers/layer_client.h" |
| 20 #include "cc/layers/texture_layer_client.h" | 20 #include "cc/layers/texture_layer_client.h" |
| 21 #include "cc/resources/texture_mailbox.h" | 21 #include "cc/resources/texture_mailbox.h" |
| 22 #include "cc/surfaces/surface_id.h" |
| 22 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
| 23 #include "third_party/skia/include/core/SkRegion.h" | 24 #include "third_party/skia/include/core/SkRegion.h" |
| 24 #include "ui/compositor/compositor.h" | 25 #include "ui/compositor/compositor.h" |
| 25 #include "ui/compositor/layer_animation_delegate.h" | 26 #include "ui/compositor/layer_animation_delegate.h" |
| 26 #include "ui/compositor/layer_delegate.h" | 27 #include "ui/compositor/layer_delegate.h" |
| 27 #include "ui/compositor/layer_type.h" | 28 #include "ui/compositor/layer_type.h" |
| 28 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
| 29 #include "ui/gfx/transform.h" | 30 #include "ui/gfx/transform.h" |
| 30 | 31 |
| 31 class SkCanvas; | 32 class SkCanvas; |
| 32 | 33 |
| 33 namespace cc { | 34 namespace cc { |
| 34 class ContentLayer; | 35 class ContentLayer; |
| 35 class CopyOutputRequest; | 36 class CopyOutputRequest; |
| 36 class DelegatedFrameProvider; | 37 class DelegatedFrameProvider; |
| 37 class DelegatedRendererLayer; | 38 class DelegatedRendererLayer; |
| 38 class Layer; | 39 class Layer; |
| 39 class NinePatchLayer; | 40 class NinePatchLayer; |
| 40 class ResourceUpdateQueue; | 41 class ResourceUpdateQueue; |
| 41 class SolidColorLayer; | 42 class SolidColorLayer; |
| 43 class SurfaceLayer; |
| 42 class TextureLayer; | 44 class TextureLayer; |
| 43 struct ReturnedResource; | 45 struct ReturnedResource; |
| 44 typedef std::vector<ReturnedResource> ReturnedResourceArray; | 46 typedef std::vector<ReturnedResource> ReturnedResourceArray; |
| 45 } | 47 } |
| 46 | 48 |
| 47 namespace ui { | 49 namespace ui { |
| 48 | 50 |
| 49 class Compositor; | 51 class Compositor; |
| 50 class LayerAnimator; | 52 class LayerAnimator; |
| 51 class LayerOwner; | 53 class LayerOwner; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // shared memory resource or an actual mailbox for a texture. | 266 // shared memory resource or an actual mailbox for a texture. |
| 265 void SetTextureMailbox(const cc::TextureMailbox& mailbox, | 267 void SetTextureMailbox(const cc::TextureMailbox& mailbox, |
| 266 scoped_ptr<cc::SingleReleaseCallback> release_callback, | 268 scoped_ptr<cc::SingleReleaseCallback> release_callback, |
| 267 gfx::Size texture_size_in_dip); | 269 gfx::Size texture_size_in_dip); |
| 268 void SetTextureSize(gfx::Size texture_size_in_dip); | 270 void SetTextureSize(gfx::Size texture_size_in_dip); |
| 269 | 271 |
| 270 // Begins showing delegated frames from the |frame_provider|. | 272 // Begins showing delegated frames from the |frame_provider|. |
| 271 void SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, | 273 void SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, |
| 272 gfx::Size frame_size_in_dip); | 274 gfx::Size frame_size_in_dip); |
| 273 | 275 |
| 276 // Begins showing content from a surface with a particular id. |
| 277 void SetShowSurface(cc::SurfaceId id, gfx::Size frame_size_in_dip); |
| 278 |
| 274 bool has_external_content() { | 279 bool has_external_content() { |
| 275 return texture_layer_.get() || delegated_renderer_layer_.get(); | 280 return texture_layer_.get() || delegated_renderer_layer_.get() || |
| 281 surface_layer_.get(); |
| 276 } | 282 } |
| 277 | 283 |
| 278 void SetShowPaintedContent(); | 284 void SetShowPaintedContent(); |
| 279 | 285 |
| 280 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. | 286 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
| 281 void SetColor(SkColor color); | 287 void SetColor(SkColor color); |
| 282 | 288 |
| 283 // Updates the nine patch layer's bitmap and aperture. May only be called for | 289 // Updates the nine patch layer's bitmap and aperture. May only be called for |
| 284 // LAYER_NINE_PATCH. | 290 // LAYER_NINE_PATCH. |
| 285 void UpdateNinePatchLayerBitmap(const SkBitmap& bitmap, | 291 void UpdateNinePatchLayerBitmap(const SkBitmap& bitmap, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 // added to a tree. | 485 // added to a tree. |
| 480 cc::ScopedPtrVector<cc::Animation> pending_threaded_animations_; | 486 cc::ScopedPtrVector<cc::Animation> pending_threaded_animations_; |
| 481 | 487 |
| 482 // Ownership of the layer is held through one of the strongly typed layer | 488 // Ownership of the layer is held through one of the strongly typed layer |
| 483 // pointers, depending on which sort of layer this is. | 489 // pointers, depending on which sort of layer this is. |
| 484 scoped_refptr<cc::Layer> content_layer_; | 490 scoped_refptr<cc::Layer> content_layer_; |
| 485 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; | 491 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; |
| 486 scoped_refptr<cc::TextureLayer> texture_layer_; | 492 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 487 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; | 493 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; |
| 488 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; | 494 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; |
| 495 scoped_refptr<cc::SurfaceLayer> surface_layer_; |
| 489 cc::Layer* cc_layer_; | 496 cc::Layer* cc_layer_; |
| 490 | 497 |
| 491 // A cached copy of |Compositor::device_scale_factor()|. | 498 // A cached copy of |Compositor::device_scale_factor()|. |
| 492 float device_scale_factor_; | 499 float device_scale_factor_; |
| 493 | 500 |
| 494 // The mailbox used by texture_layer_. | 501 // The mailbox used by texture_layer_. |
| 495 cc::TextureMailbox mailbox_; | 502 cc::TextureMailbox mailbox_; |
| 496 | 503 |
| 497 // The callback to release the mailbox. This is only set after | 504 // The callback to release the mailbox. This is only set after |
| 498 // SetTextureMailbox is called, before we give it to the TextureLayer. | 505 // SetTextureMailbox is called, before we give it to the TextureLayer. |
| 499 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_; | 506 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_; |
| 500 | 507 |
| 501 // The size of the frame or texture in DIP, set when SetShowDelegatedContent | 508 // The size of the frame or texture in DIP, set when SetShowDelegatedContent |
| 502 // or SetTextureMailbox was called. | 509 // or SetTextureMailbox was called. |
| 503 gfx::Size frame_size_in_dip_; | 510 gfx::Size frame_size_in_dip_; |
| 504 | 511 |
| 505 DISALLOW_COPY_AND_ASSIGN(Layer); | 512 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 506 }; | 513 }; |
| 507 | 514 |
| 508 } // namespace ui | 515 } // namespace ui |
| 509 | 516 |
| 510 #endif // UI_COMPOSITOR_LAYER_H_ | 517 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |