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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
276 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. | 277 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
277 void SetColor(SkColor color); | 278 void SetColor(SkColor color); |
278 | 279 |
| 280 // Updates the nine patch layer's bitmap and aperture. May only be called for |
| 281 // LAYER_NINE_PATCH. |
| 282 void UpdateNinePatchLayerBitmap(const SkBitmap& bitmap, |
| 283 const gfx::Rect& aperture); |
| 284 |
| 285 // Updates the nine patch layer's border. May only be called for |
| 286 // LAYER_NINE_PATCH. |
| 287 void UpdateNinePatchLayerBorder(const gfx::Rect& border); |
| 288 |
279 // Adds |invalid_rect| to the Layer's pending invalid rect and calls | 289 // Adds |invalid_rect| to the Layer's pending invalid rect and calls |
280 // ScheduleDraw(). Returns false if the paint request is ignored. | 290 // ScheduleDraw(). Returns false if the paint request is ignored. |
281 bool SchedulePaint(const gfx::Rect& invalid_rect); | 291 bool SchedulePaint(const gfx::Rect& invalid_rect); |
282 | 292 |
283 // Schedules a redraw of the layer tree at the compositor. | 293 // Schedules a redraw of the layer tree at the compositor. |
284 // Note that this _does not_ invalidate any region of this layer; use | 294 // Note that this _does not_ invalidate any region of this layer; use |
285 // SchedulePaint() for that. | 295 // SchedulePaint() for that. |
286 void ScheduleDraw(); | 296 void ScheduleDraw(); |
287 | 297 |
288 // Uses damaged rectangles recorded in |damaged_region_| to invalidate the | 298 // Uses damaged rectangles recorded in |damaged_region_| to invalidate the |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 472 |
463 scoped_refptr<LayerAnimator> animator_; | 473 scoped_refptr<LayerAnimator> animator_; |
464 | 474 |
465 // Animations that are passed to AddThreadedAnimation before this layer is | 475 // Animations that are passed to AddThreadedAnimation before this layer is |
466 // added to a tree. | 476 // added to a tree. |
467 cc::ScopedPtrVector<cc::Animation> pending_threaded_animations_; | 477 cc::ScopedPtrVector<cc::Animation> pending_threaded_animations_; |
468 | 478 |
469 // Ownership of the layer is held through one of the strongly typed layer | 479 // Ownership of the layer is held through one of the strongly typed layer |
470 // pointers, depending on which sort of layer this is. | 480 // pointers, depending on which sort of layer this is. |
471 scoped_refptr<cc::Layer> content_layer_; | 481 scoped_refptr<cc::Layer> content_layer_; |
| 482 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; |
472 scoped_refptr<cc::TextureLayer> texture_layer_; | 483 scoped_refptr<cc::TextureLayer> texture_layer_; |
473 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; | 484 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; |
474 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; | 485 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; |
475 cc::Layer* cc_layer_; | 486 cc::Layer* cc_layer_; |
476 | 487 |
477 // A cached copy of |Compositor::device_scale_factor()|. | 488 // A cached copy of |Compositor::device_scale_factor()|. |
478 float device_scale_factor_; | 489 float device_scale_factor_; |
479 | 490 |
480 // The mailbox used by texture_layer_. | 491 // The mailbox used by texture_layer_. |
481 cc::TextureMailbox mailbox_; | 492 cc::TextureMailbox mailbox_; |
482 | 493 |
483 // The callback to release the mailbox. This is only set after | 494 // The callback to release the mailbox. This is only set after |
484 // SetTextureMailbox is called, before we give it to the TextureLayer. | 495 // SetTextureMailbox is called, before we give it to the TextureLayer. |
485 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_; | 496 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_; |
486 | 497 |
487 // The size of the frame or texture in DIP, set when SetShowDelegatedContent | 498 // The size of the frame or texture in DIP, set when SetShowDelegatedContent |
488 // or SetTextureMailbox was called. | 499 // or SetTextureMailbox was called. |
489 gfx::Size frame_size_in_dip_; | 500 gfx::Size frame_size_in_dip_; |
490 | 501 |
491 DISALLOW_COPY_AND_ASSIGN(Layer); | 502 DISALLOW_COPY_AND_ASSIGN(Layer); |
492 }; | 503 }; |
493 | 504 |
494 } // namespace ui | 505 } // namespace ui |
495 | 506 |
496 #endif // UI_COMPOSITOR_LAYER_H_ | 507 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |