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.h" | 14 #include "base/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/texture_layer_client.h" | 19 #include "cc/layers/texture_layer_client.h" |
| 20 #include "cc/resources/texture_mailbox.h" |
20 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
21 #include "third_party/skia/include/core/SkRegion.h" | 22 #include "third_party/skia/include/core/SkRegion.h" |
22 #include "ui/compositor/compositor.h" | 23 #include "ui/compositor/compositor.h" |
23 #include "ui/compositor/layer_animation_delegate.h" | 24 #include "ui/compositor/layer_animation_delegate.h" |
24 #include "ui/compositor/layer_delegate.h" | 25 #include "ui/compositor/layer_delegate.h" |
25 #include "ui/compositor/layer_type.h" | 26 #include "ui/compositor/layer_type.h" |
26 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
27 #include "ui/gfx/transform.h" | 28 #include "ui/gfx/transform.h" |
28 | 29 |
29 class SkCanvas; | 30 class SkCanvas; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 const std::string& name() const { return name_; } | 244 const std::string& name() const { return name_; } |
244 void set_name(const std::string& name) { name_ = name; } | 245 void set_name(const std::string& name) { name_ = name; } |
245 | 246 |
246 const ui::Texture* texture() const { return texture_.get(); } | 247 const ui::Texture* texture() const { return texture_.get(); } |
247 | 248 |
248 // Assigns a new external texture. |texture| can be NULL to disable external | 249 // Assigns a new external texture. |texture| can be NULL to disable external |
249 // updates. | 250 // updates. |
250 void SetExternalTexture(ui::Texture* texture); | 251 void SetExternalTexture(ui::Texture* texture); |
251 ui::Texture* external_texture() { return texture_.get(); } | 252 ui::Texture* external_texture() { return texture_.get(); } |
252 | 253 |
| 254 // Set new TextureMailbox for this layer. Note that |mailbox| may hold a |
| 255 // shared memory resource or an actual mailbox for a texture. |
| 256 void SetTextureMailbox(const cc::TextureMailbox& mailbox, float scale_factor); |
| 257 cc::TextureMailbox GetTextureMailbox(float* scale_factor); |
| 258 |
253 // Sets a delegated frame, coming from a child compositor. | 259 // Sets a delegated frame, coming from a child compositor. |
254 void SetDelegatedFrame(scoped_ptr<cc::DelegatedFrameData> frame, | 260 void SetDelegatedFrame(scoped_ptr<cc::DelegatedFrameData> frame, |
255 gfx::Size frame_size_in_dip); | 261 gfx::Size frame_size_in_dip); |
256 | 262 |
257 // Gets unused resources to recycle to the child compositor. | 263 // Gets unused resources to recycle to the child compositor. |
258 void TakeUnusedResourcesForChildCompositor( | 264 void TakeUnusedResourcesForChildCompositor( |
259 cc::TransferableResourceArray* array); | 265 cc::TransferableResourceArray* array); |
260 | 266 |
261 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. | 267 // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
262 void SetColor(SkColor color); | 268 void SetColor(SkColor color); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; | 464 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; |
459 cc::Layer* cc_layer_; | 465 cc::Layer* cc_layer_; |
460 | 466 |
461 // If true, the layer scales the canvas and the texture with the device scale | 467 // If true, the layer scales the canvas and the texture with the device scale |
462 // factor as appropriate. When true, the texture size is in DIP. | 468 // factor as appropriate. When true, the texture size is in DIP. |
463 bool scale_content_; | 469 bool scale_content_; |
464 | 470 |
465 // A cached copy of |Compositor::device_scale_factor()|. | 471 // A cached copy of |Compositor::device_scale_factor()|. |
466 float device_scale_factor_; | 472 float device_scale_factor_; |
467 | 473 |
| 474 // A cached copy of the TextureMailbox given texture_layer_. |
| 475 cc::TextureMailbox mailbox_; |
| 476 |
| 477 // Device scale factor in which mailbox_ was rendered in. |
| 478 float mailbox_scale_factor_; |
| 479 |
468 // The size of the delegated frame in DIP, set when SetDelegatedFrame was | 480 // The size of the delegated frame in DIP, set when SetDelegatedFrame was |
469 // called. | 481 // called. |
470 gfx::Size delegated_frame_size_in_dip_; | 482 gfx::Size delegated_frame_size_in_dip_; |
471 | 483 |
472 DISALLOW_COPY_AND_ASSIGN(Layer); | 484 DISALLOW_COPY_AND_ASSIGN(Layer); |
473 }; | 485 }; |
474 | 486 |
475 } // namespace ui | 487 } // namespace ui |
476 | 488 |
477 #endif // UI_COMPOSITOR_LAYER_H_ | 489 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |