| 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 { | 15 namespace WebKit { |
| 16 class WebGraphicsContext3D; | 16 class WebGraphicsContext3D; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 class TextureLayerClient; | 21 class TextureLayerClient; |
| 22 | 22 |
| 23 // A Layer containing a the rendered output of a plugin instance. | 23 // A Layer containing a the rendered output of a plugin instance. |
| 24 class CC_EXPORT TextureLayer : public Layer { | 24 class CC_EXPORT TextureLayer : public Layer { |
| 25 public: | 25 public: |
| 26 // If this texture layer requires special preparation logic for each frame d
riven by | 26 // If this texture layer requires special preparation logic for each frame d
riven by |
| 27 // the compositor, pass in a non-nil client. Pass in a nil client pointer if
texture updates | 27 // the compositor, pass in a non-nil client. Pass in a nil client pointer if
texture updates |
| 28 // are driven by an external process. | 28 // are driven by an external process. |
| 29 static scoped_refptr<TextureLayer> create(TextureLayerClient*); | 29 static scoped_refptr<TextureLayer> Create(TextureLayerClient*); |
| 30 | 30 |
| 31 // Used when mailbox names are specified instead of texture IDs. | 31 // Used when mailbox names are specified instead of texture IDs. |
| 32 static scoped_refptr<TextureLayer> createForMailbox(); | 32 static scoped_refptr<TextureLayer> CreateForMailbox(); |
| 33 | 33 |
| 34 void clearClient() { m_client = 0; } | 34 void clearClient() { m_client = 0; } |
| 35 | 35 |
| 36 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; | 36 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; |
| 37 | 37 |
| 38 // Sets whether this texture should be Y-flipped at draw time. Defaults to t
rue. | 38 // Sets whether this texture should be Y-flipped at draw time. Defaults to t
rue. |
| 39 void setFlipped(bool); | 39 void setFlipped(bool); |
| 40 | 40 |
| 41 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1
). | 41 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1
). |
| 42 void setUV(gfx::PointF topLeft, gfx::PointF bottomRight); | 42 void setUV(gfx::PointF topLeft, gfx::PointF bottomRight); |
| 43 | 43 |
| 44 // Sets an opacity value per vertex. It will be multiplied by the layer opac
ity value. | 44 // Sets an opacity value per vertex. It will be multiplied by the layer opac
ity value. |
| 45 void setVertexOpacity(float bottomLeft, float topLeft, float topRight, float
bottomRight); | 45 void setVertexOpacity(float bottomLeft, float topLeft, float topRight, float
bottomRight); |
| 46 | 46 |
| 47 // Sets whether the alpha channel is premultiplied or unpremultiplied. Defau
lts to true. | 47 // Sets whether the alpha channel is premultiplied or unpremultiplied. Defau
lts to true. |
| 48 void setPremultipliedAlpha(bool); | 48 void setPremultipliedAlpha(bool); |
| 49 | 49 |
| 50 // Sets whether this context should rate limit on damage to prevent too many
frames from | 50 // Sets whether this context should rate limit on damage to prevent too many
frames from |
| 51 // being queued up before the compositor gets a chance to run. Requires a no
n-nil client. | 51 // being queued up before the compositor gets a chance to run. Requires a no
n-nil client. |
| 52 // Defaults to false. | 52 // Defaults to false. |
| 53 void setRateLimitContext(bool); | 53 void setRateLimitContext(bool); |
| 54 | 54 |
| 55 // Code path for plugins which supply their own texture ID. | 55 // Code path for plugins which supply their own texture ID. |
| 56 void setTextureId(unsigned); | 56 void setTextureId(unsigned); |
| 57 | 57 |
| 58 // Code path for plugins which supply their own texture ID. | 58 // Code path for plugins which supply their own texture ID. |
| 59 void setTextureMailbox(const TextureMailbox&); | 59 void setTextureMailbox(const TextureMailbox&); |
| 60 | 60 |
| 61 void willModifyTexture(); | 61 void willModifyTexture(); |
| 62 | 62 |
| 63 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE; | 63 virtual void SetNeedsDisplayRect(const gfx::RectF&) OVERRIDE; |
| 64 | 64 |
| 65 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; | 65 virtual void SetLayerTreeHost(LayerTreeHost*) OVERRIDE; |
| 66 virtual bool drawsContent() const OVERRIDE; | 66 virtual bool DrawsContent() const OVERRIDE; |
| 67 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats*) OVERRIDE; | 67 virtual void Update(ResourceUpdateQueue*, const OcclusionTracker*, Rendering
Stats*) OVERRIDE; |
| 68 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; | 68 virtual void PushPropertiesTo(LayerImpl*) OVERRIDE; |
| 69 virtual bool blocksPendingCommit() const OVERRIDE; | 69 virtual bool BlocksPendingCommit() const OVERRIDE; |
| 70 | 70 |
| 71 virtual bool canClipSelf() const OVERRIDE; | 71 virtual bool CanClipSelf() const OVERRIDE; |
| 72 | 72 |
| 73 protected: | 73 protected: |
| 74 TextureLayer(TextureLayerClient*, bool usesMailbox); | 74 TextureLayer(TextureLayerClient*, bool usesMailbox); |
| 75 virtual ~TextureLayer(); | 75 virtual ~TextureLayer(); |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 TextureLayerClient* m_client; | 78 TextureLayerClient* m_client; |
| 79 bool m_usesMailbox; | 79 bool m_usesMailbox; |
| 80 | 80 |
| 81 bool m_flipped; | 81 bool m_flipped; |
| 82 gfx::PointF m_uvTopLeft; | 82 gfx::PointF m_uvTopLeft; |
| 83 gfx::PointF m_uvBottomRight; | 83 gfx::PointF m_uvBottomRight; |
| 84 // [bottom left, top left, top right, bottom right] | 84 // [bottom left, top left, top right, bottom right] |
| 85 float m_vertexOpacity[4]; | 85 float m_vertexOpacity[4]; |
| 86 bool m_premultipliedAlpha; | 86 bool m_premultipliedAlpha; |
| 87 bool m_rateLimitContext; | 87 bool m_rateLimitContext; |
| 88 bool m_contextLost; | 88 bool m_contextLost; |
| 89 bool m_contentCommitted; | 89 bool m_contentCommitted; |
| 90 | 90 |
| 91 unsigned m_textureId; | 91 unsigned m_textureId; |
| 92 TextureMailbox m_textureMailbox; | 92 TextureMailbox m_textureMailbox; |
| 93 bool m_ownMailbox; | 93 bool m_ownMailbox; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } | 96 } |
| 97 #endif // CC_TEXTURE_LAYER_H_ | 97 #endif // CC_TEXTURE_LAYER_H_ |
| OLD | NEW |