| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 249 |
| 250 const ui::Texture* texture() const { return texture_.get(); } | 250 const ui::Texture* texture() const { return texture_.get(); } |
| 251 | 251 |
| 252 // Assigns a new external texture. |texture| can be NULL to disable external | 252 // Assigns a new external texture. |texture| can be NULL to disable external |
| 253 // updates. | 253 // updates. |
| 254 void SetExternalTexture(ui::Texture* texture); | 254 void SetExternalTexture(ui::Texture* texture); |
| 255 ui::Texture* external_texture() { return texture_.get(); } | 255 ui::Texture* external_texture() { return texture_.get(); } |
| 256 | 256 |
| 257 // Set new TextureMailbox for this layer. Note that |mailbox| may hold a | 257 // Set new TextureMailbox for this layer. Note that |mailbox| may hold a |
| 258 // shared memory resource or an actual mailbox for a texture. | 258 // shared memory resource or an actual mailbox for a texture. |
| 259 void SetTextureMailbox(const cc::TextureMailbox& mailbox, float scale_factor); | 259 void SetTextureMailbox(const cc::TextureMailbox& mailbox, |
| 260 scoped_ptr<cc::ScopedReleaseCallback> release_callback, |
| 261 float scale_factor); |
| 260 cc::TextureMailbox GetTextureMailbox(float* scale_factor); | 262 cc::TextureMailbox GetTextureMailbox(float* scale_factor); |
| 261 | 263 |
| 262 // Sets a delegated frame, coming from a child compositor. | 264 // Sets a delegated frame, coming from a child compositor. |
| 263 void SetDelegatedFrame(scoped_ptr<cc::DelegatedFrameData> frame, | 265 void SetDelegatedFrame(scoped_ptr<cc::DelegatedFrameData> frame, |
| 264 gfx::Size frame_size_in_dip); | 266 gfx::Size frame_size_in_dip); |
| 265 | 267 |
| 266 bool has_external_content() { | 268 bool has_external_content() { |
| 267 return texture_layer_.get() || delegated_renderer_layer_.get(); | 269 return texture_layer_.get() || delegated_renderer_layer_.get(); |
| 268 } | 270 } |
| 269 | 271 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // ContentLayerClient | 317 // ContentLayerClient |
| 316 virtual void PaintContents( | 318 virtual void PaintContents( |
| 317 SkCanvas* canvas, gfx::Rect clip, gfx::RectF* opaque) OVERRIDE; | 319 SkCanvas* canvas, gfx::Rect clip, gfx::RectF* opaque) OVERRIDE; |
| 318 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} | 320 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} |
| 319 | 321 |
| 320 cc::Layer* cc_layer() { return cc_layer_; } | 322 cc::Layer* cc_layer() { return cc_layer_; } |
| 321 | 323 |
| 322 // TextureLayerClient | 324 // TextureLayerClient |
| 323 virtual unsigned PrepareTexture() OVERRIDE; | 325 virtual unsigned PrepareTexture() OVERRIDE; |
| 324 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; | 326 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; |
| 325 virtual bool PrepareTextureMailbox(cc::TextureMailbox* mailbox, | 327 virtual bool PrepareTextureMailbox( |
| 326 bool use_shared_memory) OVERRIDE; | 328 cc::TextureMailbox* mailbox, |
| 329 scoped_ptr<cc::ScopedReleaseCallback>* release_callback, |
| 330 bool use_shared_memory) OVERRIDE; |
| 327 | 331 |
| 328 float device_scale_factor() const { return device_scale_factor_; } | 332 float device_scale_factor() const { return device_scale_factor_; } |
| 329 | 333 |
| 330 // Forces a render surface to be used on this layer. This has no positive | 334 // Forces a render surface to be used on this layer. This has no positive |
| 331 // impact, and is only used for benchmarking/testing purpose. | 335 // impact, and is only used for benchmarking/testing purpose. |
| 332 void SetForceRenderSurface(bool force); | 336 void SetForceRenderSurface(bool force); |
| 333 bool force_render_surface() const { return force_render_surface_; } | 337 bool force_render_surface() const { return force_render_surface_; } |
| 334 | 338 |
| 335 // LayerClient | 339 // LayerClient |
| 336 virtual std::string DebugName() OVERRIDE; | 340 virtual std::string DebugName() OVERRIDE; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 473 |
| 470 // Ownership of the layer is held through one of the strongly typed layer | 474 // Ownership of the layer is held through one of the strongly typed layer |
| 471 // pointers, depending on which sort of layer this is. | 475 // pointers, depending on which sort of layer this is. |
| 472 scoped_refptr<cc::ContentLayer> content_layer_; | 476 scoped_refptr<cc::ContentLayer> content_layer_; |
| 473 scoped_refptr<cc::TextureLayer> texture_layer_; | 477 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 474 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; | 478 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; |
| 475 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; | 479 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; |
| 476 cc::Layer* cc_layer_; | 480 cc::Layer* cc_layer_; |
| 477 | 481 |
| 478 // If true, the layer scales the canvas and the texture with the device scale | 482 // If true, the layer scales the canvas and the texture with the device scale |
| 479 // factor as appropriate. When true, the texture size is in DIP. | 483 // factor as apporpriate. When true, the texture size is in DIP. |
| 480 bool scale_content_; | 484 bool scale_content_; |
| 481 | 485 |
| 482 // A cached copy of |Compositor::device_scale_factor()|. | 486 // A cached copy of |Compositor::device_scale_factor()|. |
| 483 float device_scale_factor_; | 487 float device_scale_factor_; |
| 484 | 488 |
| 485 // A cached copy of the TextureMailbox given texture_layer_. | 489 // A cached copy of the TextureMailbox given texture_layer_. |
| 486 cc::TextureMailbox mailbox_; | 490 cc::TextureMailbox mailbox_; |
| 487 | 491 |
| 488 // Device scale factor in which mailbox_ was rendered in. | 492 // Device scale factor in which mailbox_ was rendered in. |
| 489 float mailbox_scale_factor_; | 493 float mailbox_scale_factor_; |
| 490 | 494 |
| 491 // The size of the delegated frame in DIP, set when SetDelegatedFrame was | 495 // The size of the delegated frame in DIP, set when SetDelegatedFrame was |
| 492 // called. | 496 // called. |
| 493 gfx::Size delegated_frame_size_in_dip_; | 497 gfx::Size delegated_frame_size_in_dip_; |
| 494 | 498 |
| 495 DISALLOW_COPY_AND_ASSIGN(Layer); | 499 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 496 }; | 500 }; |
| 497 | 501 |
| 498 } // namespace ui | 502 } // namespace ui |
| 499 | 503 |
| 500 #endif // UI_COMPOSITOR_LAYER_H_ | 504 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |