| 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 10 matching lines...) Expand all Loading... |
| 21 #include "cc/layers/texture_layer_client.h" | 21 #include "cc/layers/texture_layer_client.h" |
| 22 #include "cc/resources/texture_mailbox.h" | 22 #include "cc/resources/texture_mailbox.h" |
| 23 #include "cc/surfaces/surface_id.h" | 23 #include "cc/surfaces/surface_id.h" |
| 24 #include "third_party/skia/include/core/SkColor.h" | 24 #include "third_party/skia/include/core/SkColor.h" |
| 25 #include "third_party/skia/include/core/SkRegion.h" | 25 #include "third_party/skia/include/core/SkRegion.h" |
| 26 #include "ui/compositor/compositor.h" | 26 #include "ui/compositor/compositor.h" |
| 27 #include "ui/compositor/layer_animation_delegate.h" | 27 #include "ui/compositor/layer_animation_delegate.h" |
| 28 #include "ui/compositor/layer_delegate.h" | 28 #include "ui/compositor/layer_delegate.h" |
| 29 #include "ui/compositor/layer_type.h" | 29 #include "ui/compositor/layer_type.h" |
| 30 #include "ui/gfx/geometry/rect.h" | 30 #include "ui/gfx/geometry/rect.h" |
| 31 #include "ui/gfx/image/image_skia.h" |
| 31 #include "ui/gfx/transform.h" | 32 #include "ui/gfx/transform.h" |
| 32 | 33 |
| 33 class SkCanvas; | 34 class SkCanvas; |
| 34 | 35 |
| 35 namespace cc { | 36 namespace cc { |
| 36 class ContentLayer; | 37 class ContentLayer; |
| 37 class CopyOutputRequest; | 38 class CopyOutputRequest; |
| 38 class DelegatedFrameProvider; | 39 class DelegatedFrameProvider; |
| 39 class DelegatedRendererLayer; | 40 class DelegatedRendererLayer; |
| 40 class Layer; | 41 class Layer; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 return texture_layer_.get() || delegated_renderer_layer_.get() || | 294 return texture_layer_.get() || delegated_renderer_layer_.get() || |
| 294 surface_layer_.get(); | 295 surface_layer_.get(); |
| 295 } | 296 } |
| 296 | 297 |
| 297 // Show a solid color instead of delegated or surface contents. | 298 // Show a solid color instead of delegated or surface contents. |
| 298 void SetShowSolidColorContent(); | 299 void SetShowSolidColorContent(); |
| 299 | 300 |
| 300 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. | 301 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
| 301 void SetColor(SkColor color); | 302 void SetColor(SkColor color); |
| 302 | 303 |
| 303 // Updates the nine patch layer's bitmap, aperture and border. May only be | 304 // Updates the nine patch layer's image, aperture and border. May only be |
| 304 // called for LAYER_NINE_PATCH. | 305 // called for LAYER_NINE_PATCH. |
| 305 void UpdateNinePatchLayerBitmap(const SkBitmap& bitmap); | 306 void UpdateNinePatchLayerImage(const gfx::ImageSkia& image); |
| 306 void UpdateNinePatchLayerAperture(const gfx::Rect& aperture); | 307 void UpdateNinePatchLayerAperture(const gfx::Rect& aperture); |
| 307 void UpdateNinePatchLayerBorder(const gfx::Rect& border); | 308 void UpdateNinePatchLayerBorder(const gfx::Rect& border); |
| 308 | 309 |
| 309 // Adds |invalid_rect| to the Layer's pending invalid rect and calls | 310 // Adds |invalid_rect| to the Layer's pending invalid rect and calls |
| 310 // ScheduleDraw(). Returns false if the paint request is ignored. | 311 // ScheduleDraw(). Returns false if the paint request is ignored. |
| 311 bool SchedulePaint(const gfx::Rect& invalid_rect); | 312 bool SchedulePaint(const gfx::Rect& invalid_rect); |
| 312 | 313 |
| 313 // Schedules a redraw of the layer tree at the compositor. | 314 // Schedules a redraw of the layer tree at the compositor. |
| 314 // Note that this _does not_ invalidate any region of this layer; use | 315 // Note that this _does not_ invalidate any region of this layer; use |
| 315 // SchedulePaint() for that. | 316 // SchedulePaint() for that. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; | 506 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; |
| 506 scoped_refptr<cc::TextureLayer> texture_layer_; | 507 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 507 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; | 508 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; |
| 508 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; | 509 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; |
| 509 scoped_refptr<cc::SurfaceLayer> surface_layer_; | 510 scoped_refptr<cc::SurfaceLayer> surface_layer_; |
| 510 cc::Layer* cc_layer_; | 511 cc::Layer* cc_layer_; |
| 511 | 512 |
| 512 // A cached copy of |Compositor::device_scale_factor()|. | 513 // A cached copy of |Compositor::device_scale_factor()|. |
| 513 float device_scale_factor_; | 514 float device_scale_factor_; |
| 514 | 515 |
| 516 // A cached copy of the scale factor of the nine patch layer's bitmap. |
| 517 float nine_patch_layer_bitmap_scale_factor_; |
| 518 |
| 515 // The mailbox used by texture_layer_. | 519 // The mailbox used by texture_layer_. |
| 516 cc::TextureMailbox mailbox_; | 520 cc::TextureMailbox mailbox_; |
| 517 | 521 |
| 518 // The callback to release the mailbox. This is only set after | 522 // The callback to release the mailbox. This is only set after |
| 519 // SetTextureMailbox is called, before we give it to the TextureLayer. | 523 // SetTextureMailbox is called, before we give it to the TextureLayer. |
| 520 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_; | 524 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_; |
| 521 | 525 |
| 522 // The size of the frame or texture in DIP, set when SetShowDelegatedContent | 526 // The size of the frame or texture in DIP, set when SetShowDelegatedContent |
| 523 // or SetTextureMailbox was called. | 527 // or SetTextureMailbox was called. |
| 524 gfx::Size frame_size_in_dip_; | 528 gfx::Size frame_size_in_dip_; |
| 525 | 529 |
| 526 DISALLOW_COPY_AND_ASSIGN(Layer); | 530 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 527 }; | 531 }; |
| 528 | 532 |
| 529 } // namespace ui | 533 } // namespace ui |
| 530 | 534 |
| 531 #endif // UI_COMPOSITOR_LAYER_H_ | 535 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |