| 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 27 matching lines...) Expand all Loading... |
| 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 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 46 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| 47 quad->SetNew(sharedQuadState, quadRect, opaqueRect, m_externalTextureResourc
e, m_premultipliedAlpha, m_uvRect, m_flipped); | 47 quad->SetNew(sharedQuadState, quadRect, opaqueRect, m_externalTextureResourc
e, m_premultipliedAlpha, m_uvRect, m_flipped); |
| 48 | 48 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); |
| 49 // Perform explicit clipping on a quad to avoid setting a scissor later. | |
| 50 if (sharedQuadState->is_clipped && quad->PerformClipping()) | |
| 51 sharedQuadState->is_clipped = false; | |
| 52 if (!quad->rect.IsEmpty()) | |
| 53 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); | |
| 54 } | 49 } |
| 55 | 50 |
| 56 void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider) | 51 void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider) |
| 57 { | 52 { |
| 58 if (!m_externalTextureResource) | 53 if (!m_externalTextureResource) |
| 59 return; | 54 return; |
| 60 // 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 |
| 61 // parent compositor. A synchronization scheme (double-buffering or | 56 // parent compositor. A synchronization scheme (double-buffering or |
| 62 // 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. |
| 63 DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); | 58 DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 77 m_textureId = 0; | 72 m_textureId = 0; |
| 78 m_externalTextureResource = 0; | 73 m_externalTextureResource = 0; |
| 79 } | 74 } |
| 80 | 75 |
| 81 const char* TextureLayerImpl::layerTypeAsString() const | 76 const char* TextureLayerImpl::layerTypeAsString() const |
| 82 { | 77 { |
| 83 return "TextureLayer"; | 78 return "TextureLayer"; |
| 84 } | 79 } |
| 85 | 80 |
| 86 } // namespace cc | 81 } // namespace cc |
| OLD | NEW |