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 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); | 48 |
| 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); |
49 } | 54 } |
50 | 55 |
51 void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider) | 56 void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider) |
52 { | 57 { |
53 if (!m_externalTextureResource) | 58 if (!m_externalTextureResource) |
54 return; | 59 return; |
55 // FIXME: the following assert will not be true when sending resources to a | 60 // FIXME: the following assert will not be true when sending resources to a |
56 // parent compositor. A synchronization scheme (double-buffering or | 61 // parent compositor. A synchronization scheme (double-buffering or |
57 // pipelining of updates) for the client will need to exist to solve this. | 62 // pipelining of updates) for the client will need to exist to solve this. |
58 DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); | 63 DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); |
(...skipping 13 matching lines...) Expand all Loading... |
72 m_textureId = 0; | 77 m_textureId = 0; |
73 m_externalTextureResource = 0; | 78 m_externalTextureResource = 0; |
74 } | 79 } |
75 | 80 |
76 const char* TextureLayerImpl::layerTypeAsString() const | 81 const char* TextureLayerImpl::layerTypeAsString() const |
77 { | 82 { |
78 return "TextureLayer"; | 83 return "TextureLayer"; |
79 } | 84 } |
80 | 85 |
81 } // namespace cc | 86 } // namespace cc |
OLD | NEW |