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 SingleReleaseCallback; |
15 class ScopedResource; | 16 class ScopedResource; |
16 | 17 |
17 class CC_EXPORT TextureLayerImpl : public LayerImpl { | 18 class CC_EXPORT TextureLayerImpl : public LayerImpl { |
18 public: | 19 public: |
19 static scoped_ptr<TextureLayerImpl> Create(LayerTreeImpl* tree_impl, | 20 static scoped_ptr<TextureLayerImpl> Create(LayerTreeImpl* tree_impl, |
20 int id, | 21 int id, |
21 bool uses_mailbox) { | 22 bool uses_mailbox) { |
22 return make_scoped_ptr(new TextureLayerImpl(tree_impl, id, uses_mailbox)); | 23 return make_scoped_ptr(new TextureLayerImpl(tree_impl, id, uses_mailbox)); |
23 } | 24 } |
24 virtual ~TextureLayerImpl(); | 25 virtual ~TextureLayerImpl(); |
(...skipping 29 matching lines...) Expand all Loading... |
54 // 0--3 | 55 // 0--3 |
55 void set_vertex_opacity(const float vertex_opacity[4]) { | 56 void set_vertex_opacity(const float vertex_opacity[4]) { |
56 vertex_opacity_[0] = vertex_opacity[0]; | 57 vertex_opacity_[0] = vertex_opacity[0]; |
57 vertex_opacity_[1] = vertex_opacity[1]; | 58 vertex_opacity_[1] = vertex_opacity[1]; |
58 vertex_opacity_[2] = vertex_opacity[2]; | 59 vertex_opacity_[2] = vertex_opacity[2]; |
59 vertex_opacity_[3] = vertex_opacity[3]; | 60 vertex_opacity_[3] = vertex_opacity[3]; |
60 } | 61 } |
61 | 62 |
62 virtual bool CanClipSelf() const OVERRIDE; | 63 virtual bool CanClipSelf() const OVERRIDE; |
63 | 64 |
64 void SetTextureMailbox(const TextureMailbox& mailbox); | 65 void SetTextureMailbox(const TextureMailbox& mailbox, |
| 66 scoped_ptr<SingleReleaseCallback> release_callback); |
65 | 67 |
66 private: | 68 private: |
67 TextureLayerImpl(LayerTreeImpl* tree_impl, int id, bool uses_mailbox); | 69 TextureLayerImpl(LayerTreeImpl* tree_impl, int id, bool uses_mailbox); |
68 | 70 |
69 virtual const char* LayerTypeAsString() const OVERRIDE; | 71 virtual const char* LayerTypeAsString() const OVERRIDE; |
70 void FreeTextureMailbox(); | 72 void FreeTextureMailbox(); |
71 | 73 |
72 unsigned texture_id_; | 74 unsigned texture_id_; |
73 ResourceProvider::ResourceId external_texture_resource_; | 75 ResourceProvider::ResourceId external_texture_resource_; |
74 bool premultiplied_alpha_; | 76 bool premultiplied_alpha_; |
75 bool blend_background_color_; | 77 bool blend_background_color_; |
76 bool flipped_; | 78 bool flipped_; |
77 gfx::PointF uv_top_left_; | 79 gfx::PointF uv_top_left_; |
78 gfx::PointF uv_bottom_right_; | 80 gfx::PointF uv_bottom_right_; |
79 float vertex_opacity_[4]; | 81 float vertex_opacity_[4]; |
80 // This is a resource that's a GL copy of a software texture mailbox. | 82 // This is a resource that's a GL copy of a software texture mailbox. |
81 scoped_ptr<ScopedResource> texture_copy_; | 83 scoped_ptr<ScopedResource> texture_copy_; |
82 | 84 |
83 TextureMailbox texture_mailbox_; | 85 TextureMailbox texture_mailbox_; |
| 86 scoped_ptr<SingleReleaseCallback> release_callback_; |
84 bool uses_mailbox_; | 87 bool uses_mailbox_; |
85 bool own_mailbox_; | 88 bool own_mailbox_; |
86 bool valid_texture_copy_; | 89 bool valid_texture_copy_; |
87 | 90 |
88 DISALLOW_COPY_AND_ASSIGN(TextureLayerImpl); | 91 DISALLOW_COPY_AND_ASSIGN(TextureLayerImpl); |
89 }; | 92 }; |
90 | 93 |
91 } // namespace cc | 94 } // namespace cc |
92 | 95 |
93 #endif // CC_LAYERS_TEXTURE_LAYER_IMPL_H_ | 96 #endif // CC_LAYERS_TEXTURE_LAYER_IMPL_H_ |
OLD | NEW |