OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_H_ | 5 #ifndef CC_LAYERS_TEXTURE_LAYER_H_ |
6 #define CC_LAYERS_TEXTURE_LAYER_H_ | 6 #define CC_LAYERS_TEXTURE_LAYER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // If this texture layer requires special preparation logic for each frame | 84 // If this texture layer requires special preparation logic for each frame |
85 // driven by the compositor, pass in a non-nil client. Pass in a nil client | 85 // driven by the compositor, pass in a non-nil client. Pass in a nil client |
86 // pointer if texture updates are driven by an external process. | 86 // pointer if texture updates are driven by an external process. |
87 static scoped_refptr<TextureLayer> Create(TextureLayerClient* client); | 87 static scoped_refptr<TextureLayer> Create(TextureLayerClient* client); |
88 | 88 |
89 // Used when mailbox names are specified instead of texture IDs. | 89 // Used when mailbox names are specified instead of texture IDs. |
90 static scoped_refptr<TextureLayer> CreateForMailbox( | 90 static scoped_refptr<TextureLayer> CreateForMailbox( |
91 TextureLayerClient* client); | 91 TextureLayerClient* client); |
92 | 92 |
93 // Resets the client, which also resets the texture. This may synchronize with | |
94 // the impl thread if it is currently drawing a texture from the client, that | |
95 // was given via TextureLayerClient::PrepareTexture. After this call it is | |
96 // safe to destroy that texture. Note: it doesn't synchronize for mailboxes, | |
97 // those can only be destroyed after the release callback has been called. | |
98 void ClearClient(); | 93 void ClearClient(); |
99 | 94 |
100 // Resets the texture. This may synchronize with the impl thread if it is | |
101 // currently drawing a texture from the client, that was given via | |
102 // TextureLayerClient::PrepareTexture. After this call it is safe to destroy | |
103 // that texture. Note: it doesn't synchronize for mailboxes, those can only be | |
104 // destroyed after the release callback has been called. | |
105 void ClearTexture(); | |
106 | |
107 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 95 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
108 OVERRIDE; | 96 OVERRIDE; |
109 | 97 |
110 // Sets whether this texture should be Y-flipped at draw time. Defaults to | 98 // Sets whether this texture should be Y-flipped at draw time. Defaults to |
111 // true. | 99 // true. |
112 void SetFlipped(bool flipped); | 100 void SetFlipped(bool flipped); |
113 | 101 |
114 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). | 102 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). |
115 void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); | 103 void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); |
116 | 104 |
(...skipping 10 matching lines...) Expand all Loading... |
127 | 115 |
128 // Sets whether the texture should be blended with the background color | 116 // Sets whether the texture should be blended with the background color |
129 // at draw time. Defaults to false. | 117 // at draw time. Defaults to false. |
130 void SetBlendBackgroundColor(bool blend); | 118 void SetBlendBackgroundColor(bool blend); |
131 | 119 |
132 // Sets whether this context should rate limit on damage to prevent too many | 120 // Sets whether this context should rate limit on damage to prevent too many |
133 // frames from being queued up before the compositor gets a chance to run. | 121 // frames from being queued up before the compositor gets a chance to run. |
134 // Requires a non-nil client. Defaults to false. | 122 // Requires a non-nil client. Defaults to false. |
135 void SetRateLimitContext(bool rate_limit); | 123 void SetRateLimitContext(bool rate_limit); |
136 | 124 |
| 125 // Code path for plugins which supply their own texture ID. |
| 126 // DEPRECATED. DO NOT USE. |
| 127 void SetTextureId(unsigned texture_id); |
| 128 |
137 // Code path for plugins which supply their own mailbox. | 129 // Code path for plugins which supply their own mailbox. |
138 bool uses_mailbox() const { return uses_mailbox_; } | 130 bool uses_mailbox() const { return uses_mailbox_; } |
139 void SetTextureMailbox(const TextureMailbox& mailbox, | 131 void SetTextureMailbox(const TextureMailbox& mailbox, |
140 scoped_ptr<SingleReleaseCallback> release_callback); | 132 scoped_ptr<SingleReleaseCallback> release_callback); |
141 | 133 |
142 // Use this for special cases where the same texture is used to back the | 134 // Use this for special cases where the same texture is used to back the |
143 // TextureLayer across all frames. | 135 // TextureLayer across all frames. |
144 // WARNING: DON'T ACTUALLY USE THIS WHAT YOU ARE DOING IS WRONG. | 136 // WARNING: DON'T ACTUALLY USE THIS WHAT YOU ARE DOING IS WRONG. |
145 // TODO(danakj): Remove this when pepper doesn't need it. crbug.com/350204 | 137 // TODO(danakj): Remove this when pepper doesn't need it. crbug.com/350204 |
146 void SetTextureMailboxWithoutReleaseCallback(const TextureMailbox& mailbox); | 138 void SetTextureMailboxWithoutReleaseCallback(const TextureMailbox& mailbox); |
147 | 139 |
| 140 void WillModifyTexture(); |
| 141 |
148 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) OVERRIDE; | 142 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) OVERRIDE; |
149 | 143 |
150 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; | 144 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; |
151 virtual bool DrawsContent() const OVERRIDE; | 145 virtual bool DrawsContent() const OVERRIDE; |
152 virtual bool Update(ResourceUpdateQueue* queue, | 146 virtual bool Update(ResourceUpdateQueue* queue, |
153 const OcclusionTracker<Layer>* occlusion) OVERRIDE; | 147 const OcclusionTracker<Layer>* occlusion) OVERRIDE; |
154 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 148 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
155 virtual Region VisibleContentOpaqueRegion() const OVERRIDE; | 149 virtual Region VisibleContentOpaqueRegion() const OVERRIDE; |
156 | 150 |
157 protected: | 151 protected: |
(...skipping 11 matching lines...) Expand all Loading... |
169 bool uses_mailbox_; | 163 bool uses_mailbox_; |
170 | 164 |
171 bool flipped_; | 165 bool flipped_; |
172 gfx::PointF uv_top_left_; | 166 gfx::PointF uv_top_left_; |
173 gfx::PointF uv_bottom_right_; | 167 gfx::PointF uv_bottom_right_; |
174 // [bottom left, top left, top right, bottom right] | 168 // [bottom left, top left, top right, bottom right] |
175 float vertex_opacity_[4]; | 169 float vertex_opacity_[4]; |
176 bool premultiplied_alpha_; | 170 bool premultiplied_alpha_; |
177 bool blend_background_color_; | 171 bool blend_background_color_; |
178 bool rate_limit_context_; | 172 bool rate_limit_context_; |
179 bool impl_may_draw_client_data_; | 173 bool content_committed_; |
180 | 174 |
181 unsigned texture_id_; | 175 unsigned texture_id_; |
182 scoped_ptr<TextureMailboxHolder::MainThreadReference> holder_ref_; | 176 scoped_ptr<TextureMailboxHolder::MainThreadReference> holder_ref_; |
183 bool needs_set_mailbox_; | 177 bool needs_set_mailbox_; |
184 | 178 |
185 DISALLOW_COPY_AND_ASSIGN(TextureLayer); | 179 DISALLOW_COPY_AND_ASSIGN(TextureLayer); |
186 }; | 180 }; |
187 | 181 |
188 } // namespace cc | 182 } // namespace cc |
189 #endif // CC_LAYERS_TEXTURE_LAYER_H_ | 183 #endif // CC_LAYERS_TEXTURE_LAYER_H_ |
OLD | NEW |