| 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 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 // If this texture layer requires special preparation logic for each frame | 28 // If this texture layer requires special preparation logic for each frame |
| 29 // driven by the compositor, pass in a non-nil client. Pass in a nil client | 29 // driven by the compositor, pass in a non-nil client. Pass in a nil client |
| 30 // pointer if texture updates are driven by an external process. | 30 // pointer if texture updates are driven by an external process. |
| 31 static scoped_refptr<TextureLayer> Create(TextureLayerClient* client); | 31 static scoped_refptr<TextureLayer> Create(TextureLayerClient* client); |
| 32 | 32 |
| 33 // Used when mailbox names are specified instead of texture IDs. | 33 // Used when mailbox names are specified instead of texture IDs. |
| 34 static scoped_refptr<TextureLayer> CreateForMailbox( | 34 static scoped_refptr<TextureLayer> CreateForMailbox( |
| 35 TextureLayerClient* client); | 35 TextureLayerClient* client); |
| 36 | 36 |
| 37 // Resets the client, which also resets the texture. This may synchronize with |
| 38 // the impl thread if it is currently drawing a texture or a mailbox from the |
| 39 // client. After this call it is safe to destroy the texture / mailbox. |
| 37 void ClearClient(); | 40 void ClearClient(); |
| 38 | 41 |
| 42 // Resets the texture. This may synchronize with the impl thread if it is |
| 43 // currently drawing a texture or a mailbox from the client. After this call |
| 44 // it is safe to destroy the texture / mailbox. |
| 45 void ClearTexture(); |
| 46 |
| 39 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 47 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
| 40 OVERRIDE; | 48 OVERRIDE; |
| 41 | 49 |
| 42 // Sets whether this texture should be Y-flipped at draw time. Defaults to | 50 // Sets whether this texture should be Y-flipped at draw time. Defaults to |
| 43 // true. | 51 // true. |
| 44 void SetFlipped(bool flipped); | 52 void SetFlipped(bool flipped); |
| 45 | 53 |
| 46 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). | 54 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). |
| 47 void SetUV(gfx::PointF top_left, gfx::PointF bottom_right); | 55 void SetUV(gfx::PointF top_left, gfx::PointF bottom_right); |
| 48 | 56 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 59 | 67 |
| 60 // Sets whether the texture should be blended with the background color | 68 // Sets whether the texture should be blended with the background color |
| 61 // at draw time. Defaults to false. | 69 // at draw time. Defaults to false. |
| 62 void SetBlendBackgroundColor(bool blend); | 70 void SetBlendBackgroundColor(bool blend); |
| 63 | 71 |
| 64 // Sets whether this context should rate limit on damage to prevent too many | 72 // Sets whether this context should rate limit on damage to prevent too many |
| 65 // frames from being queued up before the compositor gets a chance to run. | 73 // frames from being queued up before the compositor gets a chance to run. |
| 66 // Requires a non-nil client. Defaults to false. | 74 // Requires a non-nil client. Defaults to false. |
| 67 void SetRateLimitContext(bool rate_limit); | 75 void SetRateLimitContext(bool rate_limit); |
| 68 | 76 |
| 69 // Code path for plugins which supply their own texture ID. | |
| 70 void SetTextureId(unsigned texture_id); | |
| 71 | |
| 72 // Code path for plugins which supply their own mailbox. | 77 // Code path for plugins which supply their own mailbox. |
| 73 bool uses_mailbox() const { return uses_mailbox_; } | 78 bool uses_mailbox() const { return uses_mailbox_; } |
| 74 void SetTextureMailbox(const TextureMailbox& mailbox); | 79 void SetTextureMailbox(const TextureMailbox& mailbox); |
| 75 | 80 |
| 76 void WillModifyTexture(); | |
| 77 | |
| 78 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) OVERRIDE; | 81 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) OVERRIDE; |
| 79 | 82 |
| 80 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; | 83 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; |
| 81 virtual bool DrawsContent() const OVERRIDE; | 84 virtual bool DrawsContent() const OVERRIDE; |
| 82 virtual bool Update(ResourceUpdateQueue* queue, | 85 virtual bool Update(ResourceUpdateQueue* queue, |
| 83 const OcclusionTracker* occlusion) OVERRIDE; | 86 const OcclusionTracker* occlusion) OVERRIDE; |
| 84 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 87 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
| 85 virtual bool BlocksPendingCommit() const OVERRIDE; | 88 virtual bool BlocksPendingCommit() const OVERRIDE; |
| 86 | 89 |
| 87 virtual bool CanClipSelf() const OVERRIDE; | 90 virtual bool CanClipSelf() const OVERRIDE; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // are only used on the main thread, or on the impl thread during commit | 131 // are only used on the main thread, or on the impl thread during commit |
| 129 // where the main thread is blocked. | 132 // where the main thread is blocked. |
| 130 const scoped_refptr<base::MessageLoopProxy> message_loop_; | 133 const scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 131 unsigned internal_references_; | 134 unsigned internal_references_; |
| 132 TextureMailbox mailbox_; | 135 TextureMailbox mailbox_; |
| 133 unsigned sync_point_; | 136 unsigned sync_point_; |
| 134 bool is_lost_; | 137 bool is_lost_; |
| 135 DISALLOW_COPY_AND_ASSIGN(MailboxHolder); | 138 DISALLOW_COPY_AND_ASSIGN(MailboxHolder); |
| 136 }; | 139 }; |
| 137 | 140 |
| 141 // Returns true if we draw content coming from the client, which implies we |
| 142 // may need to synchronize with the impl thread when the client goes away. |
| 143 bool DrawsClientData() const; |
| 144 |
| 138 TextureLayerClient* client_; | 145 TextureLayerClient* client_; |
| 139 bool uses_mailbox_; | 146 bool uses_mailbox_; |
| 140 | 147 |
| 141 bool flipped_; | 148 bool flipped_; |
| 142 gfx::PointF uv_top_left_; | 149 gfx::PointF uv_top_left_; |
| 143 gfx::PointF uv_bottom_right_; | 150 gfx::PointF uv_bottom_right_; |
| 144 // [bottom left, top left, top right, bottom right] | 151 // [bottom left, top left, top right, bottom right] |
| 145 float vertex_opacity_[4]; | 152 float vertex_opacity_[4]; |
| 146 bool premultiplied_alpha_; | 153 bool premultiplied_alpha_; |
| 147 bool blend_background_color_; | 154 bool blend_background_color_; |
| 148 bool rate_limit_context_; | 155 bool rate_limit_context_; |
| 149 bool content_committed_; | 156 bool impl_may_draw_client_data_; |
| 150 | 157 |
| 151 unsigned texture_id_; | 158 unsigned texture_id_; |
| 152 scoped_ptr<MailboxHolder::MainThreadReference> holder_ref_; | 159 scoped_ptr<MailboxHolder::MainThreadReference> holder_ref_; |
| 153 bool needs_set_mailbox_; | 160 bool needs_set_mailbox_; |
| 154 | 161 |
| 155 DISALLOW_COPY_AND_ASSIGN(TextureLayer); | 162 DISALLOW_COPY_AND_ASSIGN(TextureLayer); |
| 156 }; | 163 }; |
| 157 | 164 |
| 158 } // namespace cc | 165 } // namespace cc |
| 159 #endif // CC_LAYERS_TEXTURE_LAYER_H_ | 166 #endif // CC_LAYERS_TEXTURE_LAYER_H_ |
| OLD | NEW |