| 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 18 matching lines...) Expand all Loading... |
| 29 #include "ui/gfx/transform.h" | 29 #include "ui/gfx/transform.h" |
| 30 | 30 |
| 31 class SkCanvas; | 31 class SkCanvas; |
| 32 | 32 |
| 33 namespace cc { | 33 namespace cc { |
| 34 class ContentLayer; | 34 class ContentLayer; |
| 35 class CopyOutputRequest; | 35 class CopyOutputRequest; |
| 36 class DelegatedFrameProvider; | 36 class DelegatedFrameProvider; |
| 37 class DelegatedRendererLayer; | 37 class DelegatedRendererLayer; |
| 38 class Layer; | 38 class Layer; |
| 39 class NinePatchLayer; |
| 39 class ResourceUpdateQueue; | 40 class ResourceUpdateQueue; |
| 40 class SolidColorLayer; | 41 class SolidColorLayer; |
| 41 class TextureLayer; | 42 class TextureLayer; |
| 42 struct ReturnedResource; | 43 struct ReturnedResource; |
| 43 typedef std::vector<ReturnedResource> ReturnedResourceArray; | 44 typedef std::vector<ReturnedResource> ReturnedResourceArray; |
| 44 } | 45 } |
| 45 | 46 |
| 46 namespace ui { | 47 namespace ui { |
| 47 | 48 |
| 48 class Compositor; | 49 class Compositor; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // Begins showing delegated frames from the |frame_provider|. | 267 // Begins showing delegated frames from the |frame_provider|. |
| 267 void SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, | 268 void SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, |
| 268 gfx::Size frame_size_in_dip); | 269 gfx::Size frame_size_in_dip); |
| 269 | 270 |
| 270 bool has_external_content() { | 271 bool has_external_content() { |
| 271 return texture_layer_.get() || delegated_renderer_layer_.get(); | 272 return texture_layer_.get() || delegated_renderer_layer_.get(); |
| 272 } | 273 } |
| 273 | 274 |
| 274 void SetShowPaintedContent(); | 275 void SetShowPaintedContent(); |
| 275 | 276 |
| 277 void SetShowNinePatch(); |
| 278 |
| 279 void UpdateNinePatchBitmap(const SkBitmap& bitmap, |
| 280 const gfx::Rect& aperture, |
| 281 const gfx::Rect& border); |
| 282 |
| 276 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. | 283 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
| 277 void SetColor(SkColor color); | 284 void SetColor(SkColor color); |
| 278 | 285 |
| 279 // Adds |invalid_rect| to the Layer's pending invalid rect and calls | 286 // Adds |invalid_rect| to the Layer's pending invalid rect and calls |
| 280 // ScheduleDraw(). Returns false if the paint request is ignored. | 287 // ScheduleDraw(). Returns false if the paint request is ignored. |
| 281 bool SchedulePaint(const gfx::Rect& invalid_rect); | 288 bool SchedulePaint(const gfx::Rect& invalid_rect); |
| 282 | 289 |
| 283 // Schedules a redraw of the layer tree at the compositor. | 290 // Schedules a redraw of the layer tree at the compositor. |
| 284 // Note that this _does not_ invalidate any region of this layer; use | 291 // Note that this _does not_ invalidate any region of this layer; use |
| 285 // SchedulePaint() for that. | 292 // SchedulePaint() for that. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 469 |
| 463 scoped_refptr<LayerAnimator> animator_; | 470 scoped_refptr<LayerAnimator> animator_; |
| 464 | 471 |
| 465 // Animations that are passed to AddThreadedAnimation before this layer is | 472 // Animations that are passed to AddThreadedAnimation before this layer is |
| 466 // added to a tree. | 473 // added to a tree. |
| 467 cc::ScopedPtrVector<cc::Animation> pending_threaded_animations_; | 474 cc::ScopedPtrVector<cc::Animation> pending_threaded_animations_; |
| 468 | 475 |
| 469 // Ownership of the layer is held through one of the strongly typed layer | 476 // Ownership of the layer is held through one of the strongly typed layer |
| 470 // pointers, depending on which sort of layer this is. | 477 // pointers, depending on which sort of layer this is. |
| 471 scoped_refptr<cc::Layer> content_layer_; | 478 scoped_refptr<cc::Layer> content_layer_; |
| 479 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; |
| 472 scoped_refptr<cc::TextureLayer> texture_layer_; | 480 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 473 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; | 481 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; |
| 474 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; | 482 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; |
| 475 cc::Layer* cc_layer_; | 483 cc::Layer* cc_layer_; |
| 476 | 484 |
| 477 // A cached copy of |Compositor::device_scale_factor()|. | 485 // A cached copy of |Compositor::device_scale_factor()|. |
| 478 float device_scale_factor_; | 486 float device_scale_factor_; |
| 479 | 487 |
| 480 // The mailbox used by texture_layer_. | 488 // The mailbox used by texture_layer_. |
| 481 cc::TextureMailbox mailbox_; | 489 cc::TextureMailbox mailbox_; |
| 482 | 490 |
| 483 // The callback to release the mailbox. This is only set after | 491 // The callback to release the mailbox. This is only set after |
| 484 // SetTextureMailbox is called, before we give it to the TextureLayer. | 492 // SetTextureMailbox is called, before we give it to the TextureLayer. |
| 485 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_; | 493 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_; |
| 486 | 494 |
| 487 // The size of the frame or texture in DIP, set when SetShowDelegatedContent | 495 // The size of the frame or texture in DIP, set when SetShowDelegatedContent |
| 488 // or SetTextureMailbox was called. | 496 // or SetTextureMailbox was called. |
| 489 gfx::Size frame_size_in_dip_; | 497 gfx::Size frame_size_in_dip_; |
| 490 | 498 |
| 491 DISALLOW_COPY_AND_ASSIGN(Layer); | 499 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 492 }; | 500 }; |
| 493 | 501 |
| 494 } // namespace ui | 502 } // namespace ui |
| 495 | 503 |
| 496 #endif // UI_COMPOSITOR_LAYER_H_ | 504 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |