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. After | |
95 // this call it is safe to destroy the texture. | |
danakj
2014/04/02 14:47:37
Ah, I see what you changed here, but to me it read
piman
2014/04/02 22:11:37
Done.
| |
93 void ClearClient(); | 96 void ClearClient(); |
94 | 97 |
98 // Resets the texture. This may synchronize with the impl thread if it is | |
99 // currently drawing a texture from the client. After this call it is safe to | |
100 // destroy the texture. | |
101 void ClearTexture(); | |
102 | |
95 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 103 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
96 OVERRIDE; | 104 OVERRIDE; |
97 | 105 |
98 // Sets whether this texture should be Y-flipped at draw time. Defaults to | 106 // Sets whether this texture should be Y-flipped at draw time. Defaults to |
99 // true. | 107 // true. |
100 void SetFlipped(bool flipped); | 108 void SetFlipped(bool flipped); |
101 | 109 |
102 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). | 110 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). |
103 void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); | 111 void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); |
104 | 112 |
(...skipping 10 matching lines...) Expand all Loading... | |
115 | 123 |
116 // Sets whether the texture should be blended with the background color | 124 // Sets whether the texture should be blended with the background color |
117 // at draw time. Defaults to false. | 125 // at draw time. Defaults to false. |
118 void SetBlendBackgroundColor(bool blend); | 126 void SetBlendBackgroundColor(bool blend); |
119 | 127 |
120 // Sets whether this context should rate limit on damage to prevent too many | 128 // Sets whether this context should rate limit on damage to prevent too many |
121 // frames from being queued up before the compositor gets a chance to run. | 129 // frames from being queued up before the compositor gets a chance to run. |
122 // Requires a non-nil client. Defaults to false. | 130 // Requires a non-nil client. Defaults to false. |
123 void SetRateLimitContext(bool rate_limit); | 131 void SetRateLimitContext(bool rate_limit); |
124 | 132 |
125 // Code path for plugins which supply their own texture ID. | |
126 // DEPRECATED. DO NOT USE. | |
127 void SetTextureId(unsigned texture_id); | |
128 | |
129 // Code path for plugins which supply their own mailbox. | 133 // Code path for plugins which supply their own mailbox. |
130 bool uses_mailbox() const { return uses_mailbox_; } | 134 bool uses_mailbox() const { return uses_mailbox_; } |
131 void SetTextureMailbox(const TextureMailbox& mailbox, | 135 void SetTextureMailbox(const TextureMailbox& mailbox, |
132 scoped_ptr<SingleReleaseCallback> release_callback); | 136 scoped_ptr<SingleReleaseCallback> release_callback); |
133 | 137 |
134 // Use this for special cases where the same texture is used to back the | 138 // Use this for special cases where the same texture is used to back the |
135 // TextureLayer across all frames. | 139 // TextureLayer across all frames. |
136 // WARNING: DON'T ACTUALLY USE THIS WHAT YOU ARE DOING IS WRONG. | 140 // WARNING: DON'T ACTUALLY USE THIS WHAT YOU ARE DOING IS WRONG. |
137 // TODO(danakj): Remove this when pepper doesn't need it. crbug.com/350204 | 141 // TODO(danakj): Remove this when pepper doesn't need it. crbug.com/350204 |
138 void SetTextureMailboxWithoutReleaseCallback(const TextureMailbox& mailbox); | 142 void SetTextureMailboxWithoutReleaseCallback(const TextureMailbox& mailbox); |
139 | 143 |
140 void WillModifyTexture(); | |
141 | |
142 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) OVERRIDE; | 144 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) OVERRIDE; |
143 | 145 |
144 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; | 146 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; |
145 virtual bool DrawsContent() const OVERRIDE; | 147 virtual bool DrawsContent() const OVERRIDE; |
146 virtual bool Update(ResourceUpdateQueue* queue, | 148 virtual bool Update(ResourceUpdateQueue* queue, |
147 const OcclusionTracker<Layer>* occlusion) OVERRIDE; | 149 const OcclusionTracker<Layer>* occlusion) OVERRIDE; |
148 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 150 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
149 virtual Region VisibleContentOpaqueRegion() const OVERRIDE; | 151 virtual Region VisibleContentOpaqueRegion() const OVERRIDE; |
150 | 152 |
151 protected: | 153 protected: |
(...skipping 11 matching lines...) Expand all Loading... | |
163 bool uses_mailbox_; | 165 bool uses_mailbox_; |
164 | 166 |
165 bool flipped_; | 167 bool flipped_; |
166 gfx::PointF uv_top_left_; | 168 gfx::PointF uv_top_left_; |
167 gfx::PointF uv_bottom_right_; | 169 gfx::PointF uv_bottom_right_; |
168 // [bottom left, top left, top right, bottom right] | 170 // [bottom left, top left, top right, bottom right] |
169 float vertex_opacity_[4]; | 171 float vertex_opacity_[4]; |
170 bool premultiplied_alpha_; | 172 bool premultiplied_alpha_; |
171 bool blend_background_color_; | 173 bool blend_background_color_; |
172 bool rate_limit_context_; | 174 bool rate_limit_context_; |
173 bool content_committed_; | 175 bool impl_may_draw_client_data_; |
174 | 176 |
175 unsigned texture_id_; | 177 unsigned texture_id_; |
176 scoped_ptr<TextureMailboxHolder::MainThreadReference> holder_ref_; | 178 scoped_ptr<TextureMailboxHolder::MainThreadReference> holder_ref_; |
177 bool needs_set_mailbox_; | 179 bool needs_set_mailbox_; |
178 | 180 |
179 DISALLOW_COPY_AND_ASSIGN(TextureLayer); | 181 DISALLOW_COPY_AND_ASSIGN(TextureLayer); |
180 }; | 182 }; |
181 | 183 |
182 } // namespace cc | 184 } // namespace cc |
183 #endif // CC_LAYERS_TEXTURE_LAYER_H_ | 185 #endif // CC_LAYERS_TEXTURE_LAYER_H_ |
OLD | NEW |