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