| 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 25 matching lines...) Expand all Loading... |
| 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 gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect()); | 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 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| 47 quad->SetNew(sharedQuadState, quadRect, opaqueRect, m_externalTextureResourc
e, m_premultipliedAlpha, m_uvRect, m_flipped); |
| 48 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); |
| 47 } | 49 } |
| 48 | 50 |
| 49 void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider) | 51 void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider) |
| 50 { | 52 { |
| 51 if (!m_externalTextureResource) | 53 if (!m_externalTextureResource) |
| 52 return; | 54 return; |
| 53 // FIXME: the following assert will not be true when sending resources to a | 55 // FIXME: the following assert will not be true when sending resources to a |
| 54 // parent compositor. A synchronization scheme (double-buffering or | 56 // parent compositor. A synchronization scheme (double-buffering or |
| 55 // pipelining of updates) for the client will need to exist to solve this. | 57 // pipelining of updates) for the client will need to exist to solve this. |
| 56 DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); | 58 DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 70 m_textureId = 0; | 72 m_textureId = 0; |
| 71 m_externalTextureResource = 0; | 73 m_externalTextureResource = 0; |
| 72 } | 74 } |
| 73 | 75 |
| 74 const char* TextureLayerImpl::layerTypeAsString() const | 76 const char* TextureLayerImpl::layerTypeAsString() const |
| 75 { | 77 { |
| 76 return "TextureLayer"; | 78 return "TextureLayer"; |
| 77 } | 79 } |
| 78 | 80 |
| 79 } // namespace cc | 81 } // namespace cc |
| OLD | NEW |