| 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_TEXTURE_LAYER_H_ | 5 #ifndef CC_TEXTURE_LAYER_H_ |
| 6 #define CC_TEXTURE_LAYER_H_ | 6 #define CC_TEXTURE_LAYER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "cc/cc_export.h" | 11 #include "cc/cc_export.h" |
| 12 #include "cc/layer.h" | 12 #include "cc/layer.h" |
| 13 #include "cc/texture_mailbox.h" | 13 #include "cc/texture_mailbox.h" |
| 14 | 14 |
| 15 namespace WebKit { class WebGraphicsContext3D; } | 15 namespace WebKit { class WebGraphicsContext3D; } |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 class TextureLayerClient; | 19 class TextureLayerClient; |
| 20 | 20 |
| 21 // A Layer containing a the rendered output of a plugin instance. | 21 // A Layer containing a the rendered output of a plugin instance. |
| 22 class CC_EXPORT TextureLayer : public Layer { | 22 class CC_EXPORT TextureLayer : public Layer { |
| 23 public: | 23 public: |
| 24 // If this texture layer requires special preparation logic for each frame | 24 // If this texture layer requires special preparation logic for each frame |
| 25 // driven by the compositor, pass in a non-nil client. Pass in a nil client | 25 // driven by the compositor, pass in a non-nil client. Pass in a nil client |
| 26 // pointer if texture updates are driven by an external process. | 26 // pointer if texture updates are driven by an external process. |
| 27 static scoped_refptr<TextureLayer> Create(TextureLayerClient* client); | 27 static scoped_refptr<TextureLayer> Create(TextureLayerClient* client, bool sin
gle_buffer = false); |
| 28 | 28 |
| 29 // Used when mailbox names are specified instead of texture IDs. | 29 // Used when mailbox names are specified instead of texture IDs. |
| 30 static scoped_refptr<TextureLayer> CreateForMailbox(); | 30 static scoped_refptr<TextureLayer> CreateForMailbox(); |
| 31 | 31 |
| 32 void ClearClient() { client_ = NULL; } | 32 void ClearClient() { client_ = NULL; } |
| 33 | 33 |
| 34 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 34 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
| 35 OVERRIDE; | 35 OVERRIDE; |
| 36 | 36 |
| 37 // Sets whether this texture should be Y-flipped at draw time. Defaults to | 37 // Sets whether this texture should be Y-flipped at draw time. Defaults to |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 virtual bool DrawsContent() const OVERRIDE; | 71 virtual bool DrawsContent() const OVERRIDE; |
| 72 virtual void Update(ResourceUpdateQueue* queue, | 72 virtual void Update(ResourceUpdateQueue* queue, |
| 73 const OcclusionTracker* occlusion, | 73 const OcclusionTracker* occlusion, |
| 74 RenderingStats* stats) OVERRIDE; | 74 RenderingStats* stats) OVERRIDE; |
| 75 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 75 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
| 76 virtual bool BlocksPendingCommit() const OVERRIDE; | 76 virtual bool BlocksPendingCommit() const OVERRIDE; |
| 77 | 77 |
| 78 virtual bool CanClipSelf() const OVERRIDE; | 78 virtual bool CanClipSelf() const OVERRIDE; |
| 79 | 79 |
| 80 protected: | 80 protected: |
| 81 TextureLayer(TextureLayerClient* client, bool uses_mailbox); | 81 TextureLayer(TextureLayerClient* client, bool uses_mailbox, bool single_buffer
); |
| 82 virtual ~TextureLayer(); | 82 virtual ~TextureLayer(); |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 TextureLayerClient* client_; | 85 TextureLayerClient* client_; |
| 86 bool uses_mailbox_; | 86 bool uses_mailbox_; |
| 87 | 87 |
| 88 bool flipped_; | 88 bool flipped_; |
| 89 gfx::PointF uv_top_left_; | 89 gfx::PointF uv_top_left_; |
| 90 gfx::PointF uv_bottom_right_; | 90 gfx::PointF uv_bottom_right_; |
| 91 // [bottom left, top left, top right, bottom right] | 91 // [bottom left, top left, top right, bottom right] |
| 92 float vertex_opacity_[4]; | 92 float vertex_opacity_[4]; |
| 93 bool premultiplied_alpha_; | 93 bool premultiplied_alpha_; |
| 94 bool rate_limit_context_; | 94 bool rate_limit_context_; |
| 95 bool context_lost_; | 95 bool context_lost_; |
| 96 bool content_committed_; | 96 bool content_committed_; |
| 97 | 97 |
| 98 unsigned texture_id_; | 98 unsigned texture_id_; |
| 99 TextureMailbox texture_mailbox_; | 99 TextureMailbox texture_mailbox_; |
| 100 bool own_mailbox_; | 100 bool own_mailbox_; |
| 101 | 101 |
| 102 // indicate the layer usage, it's a const after set in constructor |
| 103 bool single_buffer_; |
| 104 |
| 102 DISALLOW_COPY_AND_ASSIGN(TextureLayer); | 105 DISALLOW_COPY_AND_ASSIGN(TextureLayer); |
| 103 }; | 106 }; |
| 104 | 107 |
| 105 } | 108 } |
| 106 #endif // CC_TEXTURE_LAYER_H_ | 109 #endif // CC_TEXTURE_LAYER_H_ |
| OLD | NEW |