| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_LAYERS_TEXTURE_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_TEXTURE_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_TEXTURE_LAYER_IMPL_H_ | 6 #define CC_LAYERS_TEXTURE_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "cc/layers/layer_impl.h" | 12 #include "cc/layers/layer_impl.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 class SingleReleaseCallbackImpl; | 15 class SingleReleaseCallbackImpl; |
| 16 class ScopedResource; | 16 class ScopedResource; |
| 17 | 17 |
| 18 class CC_EXPORT TextureLayerImpl : public LayerImpl { | 18 class CC_EXPORT TextureLayerImpl : public LayerImpl { |
| 19 public: | 19 public: |
| 20 static scoped_ptr<TextureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 20 static scoped_ptr<TextureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
| 21 return make_scoped_ptr(new TextureLayerImpl(tree_impl, id)); | 21 return make_scoped_ptr(new TextureLayerImpl(tree_impl, id)); |
| 22 } | 22 } |
| 23 virtual ~TextureLayerImpl(); | 23 virtual ~TextureLayerImpl(); |
| 24 | 24 |
| 25 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* layer_tree_impl) | 25 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* layer_tree_impl) |
| 26 OVERRIDE; | 26 override; |
| 27 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 27 virtual void PushPropertiesTo(LayerImpl* layer) override; |
| 28 | 28 |
| 29 virtual bool WillDraw(DrawMode draw_mode, | 29 virtual bool WillDraw(DrawMode draw_mode, |
| 30 ResourceProvider* resource_provider) OVERRIDE; | 30 ResourceProvider* resource_provider) override; |
| 31 virtual void AppendQuads(RenderPass* render_pass, | 31 virtual void AppendQuads(RenderPass* render_pass, |
| 32 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 32 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 33 AppendQuadsData* append_quads_data) OVERRIDE; | 33 AppendQuadsData* append_quads_data) override; |
| 34 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const OVERRIDE; | 34 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const override; |
| 35 virtual void ReleaseResources() OVERRIDE; | 35 virtual void ReleaseResources() override; |
| 36 | 36 |
| 37 // These setter methods don't cause any implicit damage, so the texture client | 37 // These setter methods don't cause any implicit damage, so the texture client |
| 38 // must explicitly invalidate if they intend to cause a visible change in the | 38 // must explicitly invalidate if they intend to cause a visible change in the |
| 39 // layer's output. | 39 // layer's output. |
| 40 void SetTextureId(unsigned id); | 40 void SetTextureId(unsigned id); |
| 41 void SetPremultipliedAlpha(bool premultiplied_alpha); | 41 void SetPremultipliedAlpha(bool premultiplied_alpha); |
| 42 void SetBlendBackgroundColor(bool blend); | 42 void SetBlendBackgroundColor(bool blend); |
| 43 void SetFlipped(bool flipped); | 43 void SetFlipped(bool flipped); |
| 44 void SetUVTopLeft(const gfx::PointF top_left); | 44 void SetUVTopLeft(const gfx::PointF top_left); |
| 45 void SetUVBottomRight(const gfx::PointF bottom_right); | 45 void SetUVBottomRight(const gfx::PointF bottom_right); |
| 46 | 46 |
| 47 // 1--2 | 47 // 1--2 |
| 48 // | | | 48 // | | |
| 49 // 0--3 | 49 // 0--3 |
| 50 void SetVertexOpacity(const float vertex_opacity[4]); | 50 void SetVertexOpacity(const float vertex_opacity[4]); |
| 51 | 51 |
| 52 void SetTextureMailbox( | 52 void SetTextureMailbox( |
| 53 const TextureMailbox& mailbox, | 53 const TextureMailbox& mailbox, |
| 54 scoped_ptr<SingleReleaseCallbackImpl> release_callback); | 54 scoped_ptr<SingleReleaseCallbackImpl> release_callback); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 TextureLayerImpl(LayerTreeImpl* tree_impl, int id); | 57 TextureLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 58 | 58 |
| 59 virtual const char* LayerTypeAsString() const OVERRIDE; | 59 virtual const char* LayerTypeAsString() const override; |
| 60 void FreeTextureMailbox(); | 60 void FreeTextureMailbox(); |
| 61 | 61 |
| 62 ResourceProvider::ResourceId external_texture_resource_; | 62 ResourceProvider::ResourceId external_texture_resource_; |
| 63 bool premultiplied_alpha_; | 63 bool premultiplied_alpha_; |
| 64 bool blend_background_color_; | 64 bool blend_background_color_; |
| 65 bool flipped_; | 65 bool flipped_; |
| 66 gfx::PointF uv_top_left_; | 66 gfx::PointF uv_top_left_; |
| 67 gfx::PointF uv_bottom_right_; | 67 gfx::PointF uv_bottom_right_; |
| 68 float vertex_opacity_[4]; | 68 float vertex_opacity_[4]; |
| 69 // This is a resource that's a GL copy of a software texture mailbox. | 69 // This is a resource that's a GL copy of a software texture mailbox. |
| 70 scoped_ptr<ScopedResource> texture_copy_; | 70 scoped_ptr<ScopedResource> texture_copy_; |
| 71 | 71 |
| 72 TextureMailbox texture_mailbox_; | 72 TextureMailbox texture_mailbox_; |
| 73 scoped_ptr<SingleReleaseCallbackImpl> release_callback_; | 73 scoped_ptr<SingleReleaseCallbackImpl> release_callback_; |
| 74 bool own_mailbox_; | 74 bool own_mailbox_; |
| 75 bool valid_texture_copy_; | 75 bool valid_texture_copy_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(TextureLayerImpl); | 77 DISALLOW_COPY_AND_ASSIGN(TextureLayerImpl); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace cc | 80 } // namespace cc |
| 81 | 81 |
| 82 #endif // CC_LAYERS_TEXTURE_LAYER_IMPL_H_ | 82 #endif // CC_LAYERS_TEXTURE_LAYER_IMPL_H_ |
| OLD | NEW |