| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_IMPL_H_ | 5 #ifndef CC_TEXTURE_LAYER_IMPL_H_ |
| 6 #define CC_TEXTURE_LAYER_IMPL_H_ | 6 #define CC_TEXTURE_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 8 #include "cc/cc_export.h" | 11 #include "cc/cc_export.h" |
| 9 #include "cc/layer_impl.h" | 12 #include "cc/layer_impl.h" |
| 10 | 13 |
| 11 namespace cc { | 14 namespace cc { |
| 12 | 15 |
| 13 class CC_EXPORT TextureLayerImpl : public LayerImpl { | 16 class CC_EXPORT TextureLayerImpl : public LayerImpl { |
| 14 public: | 17 public: |
| 15 static scoped_ptr<TextureLayerImpl> create(LayerTreeImpl* treeImpl, int id) | 18 static scoped_ptr<TextureLayerImpl> create(LayerTreeImpl* treeImpl, int id,
bool usesMailbox) |
| 16 { | 19 { |
| 17 return make_scoped_ptr(new TextureLayerImpl(treeImpl, id)); | 20 return make_scoped_ptr(new TextureLayerImpl(treeImpl, id, usesMailbox)); |
| 18 } | 21 } |
| 19 virtual ~TextureLayerImpl(); | 22 virtual ~TextureLayerImpl(); |
| 20 | 23 |
| 21 virtual void willDraw(ResourceProvider*) OVERRIDE; | 24 virtual void willDraw(ResourceProvider*) OVERRIDE; |
| 22 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; | 25 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; |
| 23 virtual void didDraw(ResourceProvider*) OVERRIDE; | 26 virtual void didDraw(ResourceProvider*) OVERRIDE; |
| 24 | 27 |
| 25 virtual void didLoseOutputSurface() OVERRIDE; | 28 virtual void didLoseOutputSurface() OVERRIDE; |
| 26 | 29 |
| 27 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; | 30 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; |
| 28 | 31 |
| 29 unsigned textureId() const { return m_textureId; } | 32 unsigned textureId() const { return m_textureId; } |
| 30 void setTextureId(unsigned id) { m_textureId = id; } | 33 void setTextureId(unsigned id) { m_textureId = id; } |
| 31 void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha =
premultipliedAlpha; } | 34 void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha =
premultipliedAlpha; } |
| 32 void setFlipped(bool flipped) { m_flipped = flipped; } | 35 void setFlipped(bool flipped) { m_flipped = flipped; } |
| 33 void setUVRect(const gfx::RectF& rect) { m_uvRect = rect; } | 36 void setUVRect(const gfx::RectF& rect) { m_uvRect = rect; } |
| 34 | 37 |
| 35 // 1--2 | 38 // 1--2 |
| 36 // | | | 39 // | | |
| 37 // 0--3 | 40 // 0--3 |
| 38 void setVertexOpacity(const float vertexOpacity[4]); | 41 void setVertexOpacity(const float vertexOpacity[4]); |
| 39 | 42 |
| 43 void setTextureMailbox(const std::string& mailboxName, const base::Callback<
void(unsigned)>& releaseCallback); |
| 44 |
| 40 private: | 45 private: |
| 41 TextureLayerImpl(LayerTreeImpl* treeImpl, int id); | 46 TextureLayerImpl(LayerTreeImpl* treeImpl, int id, bool usesMailbox); |
| 42 | 47 |
| 43 virtual const char* layerTypeAsString() const OVERRIDE; | 48 virtual const char* layerTypeAsString() const OVERRIDE; |
| 44 | 49 |
| 45 unsigned m_textureId; | 50 unsigned m_textureId; |
| 46 ResourceProvider::ResourceId m_externalTextureResource; | 51 ResourceProvider::ResourceId m_externalTextureResource; |
| 47 bool m_premultipliedAlpha; | 52 bool m_premultipliedAlpha; |
| 48 bool m_flipped; | 53 bool m_flipped; |
| 49 gfx::RectF m_uvRect; | 54 gfx::RectF m_uvRect; |
| 50 float m_vertexOpacity[4]; | 55 float m_vertexOpacity[4]; |
| 56 |
| 57 bool m_hasPendingMailbox; |
| 58 std::string m_pendingMailboxName; |
| 59 base::Callback<void(unsigned)> m_pendingMailboxReleaseCallback; |
| 60 bool m_usesMailbox; |
| 51 }; | 61 }; |
| 52 | 62 |
| 53 } | 63 } |
| 54 | 64 |
| 55 #endif // CC_TEXTURE_LAYER_IMPL_H_ | 65 #endif // CC_TEXTURE_LAYER_IMPL_H_ |
| OLD | NEW |