| 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/quad_sink.h" | 8 #include "cc/quad_sink.h" |
| 9 #include "cc/renderer.h" | 9 #include "cc/renderer.h" |
| 10 #include "cc/texture_draw_quad.h" | 10 #include "cc/texture_draw_quad.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 void TextureLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQu
adsData) | 36 void TextureLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQu
adsData) |
| 37 { | 37 { |
| 38 if (!m_externalTextureResource) | 38 if (!m_externalTextureResource) |
| 39 return; | 39 return; |
| 40 | 40 |
| 41 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ
uadState()); | 41 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ
uadState()); |
| 42 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); | 42 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); |
| 43 | 43 |
| 44 gfx::Rect quadRect(gfx::Point(), contentBounds()); | 44 gfx::Rect quadRect(gfx::Point(), contentBounds()); |
| 45 quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, m_externa
lTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped).PassAs<DrawQuad>(),
appendQuadsData); | 45 gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect()); |
| 46 quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, opaqueRec
t, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped).PassAs<
DrawQuad>(), appendQuadsData); |
| 46 } | 47 } |
| 47 | 48 |
| 48 void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider) | 49 void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider) |
| 49 { | 50 { |
| 50 if (!m_externalTextureResource) | 51 if (!m_externalTextureResource) |
| 51 return; | 52 return; |
| 52 // FIXME: the following assert will not be true when sending resources to a | 53 // FIXME: the following assert will not be true when sending resources to a |
| 53 // parent compositor. A synchronization scheme (double-buffering or | 54 // parent compositor. A synchronization scheme (double-buffering or |
| 54 // pipelining of updates) for the client will need to exist to solve this. | 55 // pipelining of updates) for the client will need to exist to solve this. |
| 55 DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); | 56 DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 69 m_textureId = 0; | 70 m_textureId = 0; |
| 70 m_externalTextureResource = 0; | 71 m_externalTextureResource = 0; |
| 71 } | 72 } |
| 72 | 73 |
| 73 const char* TextureLayerImpl::layerTypeAsString() const | 74 const char* TextureLayerImpl::layerTypeAsString() const |
| 74 { | 75 { |
| 75 return "TextureLayer"; | 76 return "TextureLayer"; |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace cc | 79 } // namespace cc |
| OLD | NEW |