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> | |
danakj
2013/01/02 16:17:22
nit: space below <> headers
| |
9 #include "base/callback.h" | |
8 #include "cc/cc_export.h" | 10 #include "cc/cc_export.h" |
9 #include "cc/layer_impl.h" | 11 #include "cc/layer_impl.h" |
10 | 12 |
11 namespace cc { | 13 namespace cc { |
12 | 14 |
13 class CC_EXPORT TextureLayerImpl : public LayerImpl { | 15 class CC_EXPORT TextureLayerImpl : public LayerImpl { |
14 public: | 16 public: |
15 static scoped_ptr<TextureLayerImpl> create(LayerTreeImpl* treeImpl, int id) | 17 static scoped_ptr<TextureLayerImpl> create(LayerTreeImpl* treeImpl, int id, bool mailboxLayer = false) |
danakj
2013/01/02 16:17:22
no default values for parameters in chromium style
| |
16 { | 18 { |
17 return make_scoped_ptr(new TextureLayerImpl(treeImpl, id)); | 19 return make_scoped_ptr(new TextureLayerImpl(treeImpl, id, mailboxLayer)) ; |
18 } | 20 } |
19 virtual ~TextureLayerImpl(); | 21 virtual ~TextureLayerImpl(); |
20 | 22 |
21 virtual void willDraw(ResourceProvider*) OVERRIDE; | 23 virtual void willDraw(ResourceProvider*) OVERRIDE; |
22 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; | 24 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; |
23 virtual void didDraw(ResourceProvider*) OVERRIDE; | 25 virtual void didDraw(ResourceProvider*) OVERRIDE; |
24 | 26 |
25 virtual void didLoseOutputSurface() OVERRIDE; | 27 virtual void didLoseOutputSurface() OVERRIDE; |
26 | 28 |
27 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; | 29 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; |
28 | 30 |
29 unsigned textureId() const { return m_textureId; } | 31 unsigned textureId() const { return m_textureId; } |
30 void setTextureId(unsigned id) { m_textureId = id; } | 32 void setTextureId(unsigned id) { m_textureId = id; } |
31 void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha = premultipliedAlpha; } | 33 void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha = premultipliedAlpha; } |
32 void setFlipped(bool flipped) { m_flipped = flipped; } | 34 void setFlipped(bool flipped) { m_flipped = flipped; } |
33 void setUVRect(const gfx::RectF& rect) { m_uvRect = rect; } | 35 void setUVRect(const gfx::RectF& rect) { m_uvRect = rect; } |
34 | 36 |
35 // 1--2 | 37 // 1--2 |
36 // | | | 38 // | | |
37 // 0--3 | 39 // 0--3 |
38 void setVertexOpacity(const float vertexOpacity[4]); | 40 void setVertexOpacity(const float vertexOpacity[4]); |
39 | 41 |
42 void setTextureMailbox(const std::string& mailboxName, | |
danakj
2013/01/02 16:17:22
nit: don't line split (old style here still), or p
alexst (slow to review)
2013/01/02 19:31:35
Done.
| |
43 const base::Callback<void(unsigned)>& releaseCallback ); | |
44 | |
40 private: | 45 private: |
41 TextureLayerImpl(LayerTreeImpl* treeImpl, int id); | 46 TextureLayerImpl(LayerTreeImpl* treeImpl, int id, bool mailboxLayer); |
42 | 47 |
43 virtual const char* layerTypeAsString() const OVERRIDE; | 48 virtual const char* layerTypeAsString() const OVERRIDE; |
44 | 49 |
50 void handleMailboxResources(ResourceProvider*); | |
51 | |
45 unsigned m_textureId; | 52 unsigned m_textureId; |
46 ResourceProvider::ResourceId m_externalTextureResource; | 53 ResourceProvider::ResourceId m_externalTextureResource; |
47 bool m_premultipliedAlpha; | 54 bool m_premultipliedAlpha; |
48 bool m_flipped; | 55 bool m_flipped; |
49 gfx::RectF m_uvRect; | 56 gfx::RectF m_uvRect; |
50 float m_vertexOpacity[4]; | 57 float m_vertexOpacity[4]; |
58 | |
59 bool m_newMailboxPending; | |
60 std::string m_mailboxName; | |
61 bool m_mailboxLayer; | |
62 base::Callback<void(unsigned)> m_mailboxReleaseCallback; | |
51 }; | 63 }; |
52 | 64 |
53 } | 65 } |
54 | 66 |
55 #endif // CC_TEXTURE_LAYER_IMPL_H_ | 67 #endif // CC_TEXTURE_LAYER_IMPL_H_ |
OLD | NEW |