OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/texture_copier.h" | 7 #include "cc/texture_copier.h" |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/gl_renderer.h" // For the GLC() macro. | 10 #include "cc/gl_renderer.h" // For the GLC() macro. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 if (m_positionBuffer) | 42 if (m_positionBuffer) |
43 GLC(m_context, m_context->deleteBuffer(m_positionBuffer)); | 43 GLC(m_context, m_context->deleteBuffer(m_positionBuffer)); |
44 if (m_fbo) | 44 if (m_fbo) |
45 GLC(m_context, m_context->deleteFramebuffer(m_fbo)); | 45 GLC(m_context, m_context->deleteFramebuffer(m_fbo)); |
46 } | 46 } |
47 | 47 |
48 void AcceleratedTextureCopier::copyTexture(Parameters parameters) | 48 void AcceleratedTextureCopier::copyTexture(Parameters parameters) |
49 { | 49 { |
50 TRACE_EVENT0("cc", "TextureCopier::copyTexture"); | 50 TRACE_EVENT0("cc", "TextureCopier::copyTexture"); |
51 | 51 |
| 52 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); |
| 53 |
52 // Note: this code does not restore the viewport, bound program, 2D texture,
framebuffer, buffer or blend enable. | 54 // Note: this code does not restore the viewport, bound program, 2D texture,
framebuffer, buffer or blend enable. |
53 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo)); | 55 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo)); |
54 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, parameters.destTexture, 0)); | 56 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, parameters.destTexture, 0)); |
55 | 57 |
56 #if OS(ANDROID) | 58 #if OS(ANDROID) |
57 // Clear destination to improve performance on tiling GPUs. | 59 // Clear destination to improve performance on tiling GPUs. |
58 // TODO: Use EXT_discard_framebuffer or skip clearing if it isn't available. | 60 // TODO: Use EXT_discard_framebuffer or skip clearing if it isn't available. |
59 GLC(m_context, m_context->clear(GL_COLOR_BUFFER_BIT)); | 61 GLC(m_context, m_context->clear(GL_COLOR_BUFFER_BIT)); |
60 #endif | 62 #endif |
61 | 63 |
(...skipping 19 matching lines...) Expand all Loading... |
81 | 83 |
82 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER
, GL_LINEAR)); | 84 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER
, GL_LINEAR)); |
83 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER
, GL_LINEAR)); | 85 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER
, GL_LINEAR)); |
84 GLC(m_context, m_context->disableVertexAttribArray(kPositionAttribute)); | 86 GLC(m_context, m_context->disableVertexAttribArray(kPositionAttribute)); |
85 | 87 |
86 GLC(m_context, m_context->useProgram(0)); | 88 GLC(m_context, m_context->useProgram(0)); |
87 | 89 |
88 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, 0, 0)); | 90 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, 0, 0)); |
89 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); | 91 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); |
90 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, 0)); | 92 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, 0)); |
| 93 |
| 94 GLC(m_context, m_context->enable(GL_SCISSOR_TEST)); |
91 } | 95 } |
92 | 96 |
93 void AcceleratedTextureCopier::flush() | 97 void AcceleratedTextureCopier::flush() |
94 { | 98 { |
95 GLC(m_context, m_context->flush()); | 99 GLC(m_context, m_context->flush()); |
96 } | 100 } |
97 | 101 |
98 } // namespace cc | 102 } // namespace cc |
OLD | NEW |