| 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> | 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_impl.h" | 12 #include "cc/layer_impl.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class CC_EXPORT TextureLayerImpl : public LayerImpl { | 16 class CC_EXPORT TextureLayerImpl : public LayerImpl { |
| 17 public: | 17 public: |
| 18 static scoped_ptr<TextureLayerImpl> create(LayerTreeImpl* treeImpl, int id,
bool usesMailbox) | 18 static scoped_ptr<TextureLayerImpl> Create(LayerTreeImpl* treeImpl, int id,
bool usesMailbox) |
| 19 { | 19 { |
| 20 return make_scoped_ptr(new TextureLayerImpl(treeImpl, id, usesMailbox)); | 20 return make_scoped_ptr(new TextureLayerImpl(treeImpl, id, usesMailbox)); |
| 21 } | 21 } |
| 22 virtual ~TextureLayerImpl(); | 22 virtual ~TextureLayerImpl(); |
| 23 | 23 |
| 24 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl*) OVERRIDE; | 24 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl*) OVERRIDE; |
| 25 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; | 25 virtual void PushPropertiesTo(LayerImpl*) OVERRIDE; |
| 26 | 26 |
| 27 virtual void willDraw(ResourceProvider*) OVERRIDE; | 27 virtual void WillDraw(ResourceProvider*) OVERRIDE; |
| 28 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; | 28 virtual void AppendQuads(QuadSink* quad_sink, |
| 29 virtual void didDraw(ResourceProvider*) OVERRIDE; | 29 AppendQuadsData* append_quads_data) OVERRIDE; |
| 30 virtual void DidDraw(ResourceProvider*) OVERRIDE; |
| 30 | 31 |
| 31 virtual void didLoseOutputSurface() OVERRIDE; | 32 virtual void DidLoseOutputSurface() OVERRIDE; |
| 32 | 33 |
| 33 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; | 34 virtual void DumpLayerProperties(std::string*, int indent) const OVERRIDE; |
| 34 virtual void didBecomeActive() OVERRIDE; | 35 virtual void DidBecomeActive() OVERRIDE; |
| 35 | 36 |
| 36 unsigned textureId() const { return m_textureId; } | 37 unsigned textureId() const { return m_textureId; } |
| 37 void setTextureId(unsigned id) { m_textureId = id; } | 38 void setTextureId(unsigned id) { m_textureId = id; } |
| 38 void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha =
premultipliedAlpha; } | 39 void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha =
premultipliedAlpha; } |
| 39 void setFlipped(bool flipped) { m_flipped = flipped; } | 40 void setFlipped(bool flipped) { m_flipped = flipped; } |
| 40 void setUVTopLeft(gfx::PointF topLeft) { m_uvTopLeft = topLeft; } | 41 void setUVTopLeft(gfx::PointF topLeft) { m_uvTopLeft = topLeft; } |
| 41 void setUVBottomRight(gfx::PointF bottomRight) { m_uvBottomRight = bottomRig
ht; } | 42 void setUVBottomRight(gfx::PointF bottomRight) { m_uvBottomRight = bottomRig
ht; } |
| 42 | 43 |
| 43 // 1--2 | 44 // 1--2 |
| 44 // | | | 45 // | | |
| 45 // 0--3 | 46 // 0--3 |
| 46 void setVertexOpacity(const float vertexOpacity[4]); | 47 void setVertexOpacity(const float vertexOpacity[4]); |
| 47 virtual bool canClipSelf() const OVERRIDE; | 48 virtual bool CanClipSelf() const OVERRIDE; |
| 48 | 49 |
| 49 void setTextureMailbox(const TextureMailbox&); | 50 void setTextureMailbox(const TextureMailbox&); |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 TextureLayerImpl(LayerTreeImpl* treeImpl, int id, bool usesMailbox); | 53 TextureLayerImpl(LayerTreeImpl* treeImpl, int id, bool usesMailbox); |
| 53 | 54 |
| 54 virtual const char* layerTypeAsString() const OVERRIDE; | 55 virtual const char* LayerTypeAsString() const OVERRIDE; |
| 55 void freeTextureMailbox(); | 56 void freeTextureMailbox(); |
| 56 | 57 |
| 57 unsigned m_textureId; | 58 unsigned m_textureId; |
| 58 ResourceProvider::ResourceId m_externalTextureResource; | 59 ResourceProvider::ResourceId m_externalTextureResource; |
| 59 bool m_premultipliedAlpha; | 60 bool m_premultipliedAlpha; |
| 60 bool m_flipped; | 61 bool m_flipped; |
| 61 gfx::PointF m_uvTopLeft; | 62 gfx::PointF m_uvTopLeft; |
| 62 gfx::PointF m_uvBottomRight; | 63 gfx::PointF m_uvBottomRight; |
| 63 float m_vertexOpacity[4]; | 64 float m_vertexOpacity[4]; |
| 64 | 65 |
| 65 TextureMailbox m_textureMailbox; | 66 TextureMailbox m_textureMailbox; |
| 66 bool m_usesMailbox; | 67 bool m_usesMailbox; |
| 67 bool m_ownMailbox; | 68 bool m_ownMailbox; |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } | 71 } |
| 71 | 72 |
| 72 #endif // CC_TEXTURE_LAYER_IMPL_H_ | 73 #endif // CC_TEXTURE_LAYER_IMPL_H_ |
| OLD | NEW |