| 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 | 14 |
| 14 namespace WebKit { | 15 namespace WebKit { |
| 15 class WebGraphicsContext3D; | 16 class WebGraphicsContext3D; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 class TextureLayerClient; | 21 class TextureLayerClient; |
| 21 | 22 |
| 22 // A Layer containing a the rendered output of a plugin instance. | 23 // A Layer containing a the rendered output of a plugin instance. |
| 23 class CC_EXPORT TextureLayer : public Layer { | 24 class CC_EXPORT TextureLayer : public Layer { |
| 24 public: | 25 public: |
| 25 typedef base::Callback<void(unsigned)> MailboxCallback; | |
| 26 | |
| 27 // 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 |
| 28 // 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 |
| 29 // are driven by an external process. | 28 // are driven by an external process. |
| 30 static scoped_refptr<TextureLayer> create(TextureLayerClient*); | 29 static scoped_refptr<TextureLayer> create(TextureLayerClient*); |
| 31 | 30 |
| 32 // Used when mailbox names are specified instead of texture IDs. | 31 // Used when mailbox names are specified instead of texture IDs. |
| 33 static scoped_refptr<TextureLayer> createForMailbox(); | 32 static scoped_refptr<TextureLayer> createForMailbox(); |
| 34 | 33 |
| 35 void clearClient() { m_client = 0; } | 34 void clearClient() { m_client = 0; } |
| 36 | 35 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 | 49 |
| 51 // 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 |
| 52 // 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. |
| 53 // Defaults to false. | 52 // Defaults to false. |
| 54 void setRateLimitContext(bool); | 53 void setRateLimitContext(bool); |
| 55 | 54 |
| 56 // Code path for plugins which supply their own texture ID. | 55 // Code path for plugins which supply their own texture ID. |
| 57 void setTextureId(unsigned); | 56 void setTextureId(unsigned); |
| 58 | 57 |
| 59 // Code path for plugins which supply their own texture ID. | 58 // Code path for plugins which supply their own texture ID. |
| 60 void setTextureMailbox(const std::string&, const MailboxCallback&); | 59 void setTextureMailbox(const TextureMailbox&); |
| 61 | 60 |
| 62 void willModifyTexture(); | 61 void willModifyTexture(); |
| 63 | 62 |
| 64 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE; | 63 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE; |
| 65 | 64 |
| 66 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; | 65 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; |
| 67 virtual bool drawsContent() const OVERRIDE; | 66 virtual bool drawsContent() const OVERRIDE; |
| 68 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) OVERRIDE; | 67 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) OVERRIDE; |
| 69 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; | 68 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; |
| 70 virtual bool blocksPendingCommit() const OVERRIDE; | 69 virtual bool blocksPendingCommit() const OVERRIDE; |
| 71 | 70 |
| 72 virtual bool canClipSelf() const OVERRIDE; | 71 virtual bool canClipSelf() const OVERRIDE; |
| 73 | 72 |
| 74 protected: | 73 protected: |
| 75 TextureLayer(TextureLayerClient*, bool usesMailbox); | 74 TextureLayer(TextureLayerClient*, bool usesMailbox); |
| 76 virtual ~TextureLayer(); | 75 virtual ~TextureLayer(); |
| 77 | 76 |
| 78 private: | 77 private: |
| 79 TextureLayerClient* m_client; | 78 TextureLayerClient* m_client; |
| 80 bool m_usesMailbox; | 79 bool m_usesMailbox; |
| 81 MailboxCallback m_mailboxReleaseCallback; | |
| 82 | 80 |
| 83 bool m_flipped; | 81 bool m_flipped; |
| 84 gfx::RectF m_uvRect; | 82 gfx::RectF m_uvRect; |
| 85 // [bottom left, top left, top right, bottom right] | 83 // [bottom left, top left, top right, bottom right] |
| 86 float m_vertexOpacity[4]; | 84 float m_vertexOpacity[4]; |
| 87 bool m_premultipliedAlpha; | 85 bool m_premultipliedAlpha; |
| 88 bool m_rateLimitContext; | 86 bool m_rateLimitContext; |
| 89 bool m_contextLost; | 87 bool m_contextLost; |
| 90 bool m_contentCommitted; | 88 bool m_contentCommitted; |
| 91 | 89 |
| 92 unsigned m_textureId; | 90 unsigned m_textureId; |
| 93 std::string m_mailboxName; | 91 TextureMailbox m_textureMailbox; |
| 94 }; | 92 }; |
| 95 | 93 |
| 96 } | 94 } |
| 97 #endif // CC_TEXTURE_LAYER_H_ | 95 #endif // CC_TEXTURE_LAYER_H_ |
| OLD | NEW |