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