OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #include "cc/texture_layer_impl.h" | 5 #include "cc/texture_layer_impl.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "cc/layer_tree_impl.h" | 8 #include "cc/layer_tree_impl.h" |
9 #include "cc/quad_sink.h" | 9 #include "cc/quad_sink.h" |
10 #include "cc/renderer.h" | 10 #include "cc/renderer.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (m_pendingTextureMailbox.Equals(mailbox)) | 47 if (m_pendingTextureMailbox.Equals(mailbox)) |
48 return; | 48 return; |
49 // Two commits without a draw, ack the previous mailbox. | 49 // Two commits without a draw, ack the previous mailbox. |
50 if (m_hasPendingMailbox) | 50 if (m_hasPendingMailbox) |
51 m_pendingTextureMailbox.RunReleaseCallback(0); | 51 m_pendingTextureMailbox.RunReleaseCallback(0); |
52 | 52 |
53 m_pendingTextureMailbox = mailbox; | 53 m_pendingTextureMailbox = mailbox; |
54 m_hasPendingMailbox = true; | 54 m_hasPendingMailbox = true; |
55 } | 55 } |
56 | 56 |
| 57 scoped_ptr<LayerImpl> TextureLayerImpl::createLayerImpl(LayerTreeImpl* treeImpl) |
| 58 { |
| 59 return TextureLayerImpl::create(treeImpl, id(), m_usesMailbox).PassAs<LayerI
mpl>(); |
| 60 } |
| 61 |
| 62 void TextureLayerImpl::pushPropertiesTo(LayerImpl* layer) |
| 63 { |
| 64 LayerImpl::pushPropertiesTo(layer); |
| 65 |
| 66 TextureLayerImpl* textureLayer = static_cast<TextureLayerImpl*>(layer); |
| 67 textureLayer->setFlipped(m_flipped); |
| 68 textureLayer->setUVTopLeft(m_uvTopLeft); |
| 69 textureLayer->setUVBottomRight(m_uvBottomRight); |
| 70 textureLayer->setVertexOpacity(m_vertexOpacity); |
| 71 textureLayer->setPremultipliedAlpha(m_premultipliedAlpha); |
| 72 if (m_usesMailbox) { |
| 73 textureLayer->setTextureMailbox(m_pendingTextureMailbox); |
| 74 } else { |
| 75 textureLayer->setTextureId(m_textureId); |
| 76 } |
| 77 } |
| 78 |
| 79 |
57 void TextureLayerImpl::willDraw(ResourceProvider* resourceProvider) | 80 void TextureLayerImpl::willDraw(ResourceProvider* resourceProvider) |
58 { | 81 { |
59 if (!m_usesMailbox) { | 82 if (!m_usesMailbox) { |
60 if (!m_textureId) | 83 if (!m_textureId) |
61 return; | 84 return; |
62 DCHECK(!m_externalTextureResource); | 85 DCHECK(!m_externalTextureResource); |
63 m_externalTextureResource = resourceProvider->createResourceFromExternal
Texture(m_textureId); | 86 m_externalTextureResource = resourceProvider->createResourceFromExternal
Texture(m_textureId); |
64 return; | 87 return; |
65 } | 88 } |
66 | 89 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 { | 157 { |
135 return "TextureLayer"; | 158 return "TextureLayer"; |
136 } | 159 } |
137 | 160 |
138 bool TextureLayerImpl::canClipSelf() const | 161 bool TextureLayerImpl::canClipSelf() const |
139 { | 162 { |
140 return true; | 163 return true; |
141 } | 164 } |
142 | 165 |
143 } // namespace cc | 166 } // namespace cc |
OLD | NEW |