| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 9122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9133 | 9133 |
| 9134 ScopedResolvedFrameBufferBinder binder(this, false, true); | 9134 ScopedResolvedFrameBufferBinder binder(this, false, true); |
| 9135 gfx::Size size = GetBoundReadFrameBufferSize(); | 9135 gfx::Size size = GetBoundReadFrameBufferSize(); |
| 9136 GLint copyX = 0; | 9136 GLint copyX = 0; |
| 9137 GLint copyY = 0; | 9137 GLint copyY = 0; |
| 9138 GLint copyWidth = 0; | 9138 GLint copyWidth = 0; |
| 9139 GLint copyHeight = 0; | 9139 GLint copyHeight = 0; |
| 9140 Clip(x, width, size.width(), ©X, ©Width); | 9140 Clip(x, width, size.width(), ©X, ©Width); |
| 9141 Clip(y, height, size.height(), ©Y, ©Height); | 9141 Clip(y, height, size.height(), ©Y, ©Height); |
| 9142 | 9142 |
| 9143 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, level)) { | 9143 if (xoffset != 0 || yoffset != 0 || width != size.width() || |
| 9144 LOCAL_SET_GL_ERROR( | 9144 height != size.height()) { |
| 9145 GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", "dimensions too big"); | 9145 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, |
| 9146 return; | 9146 level)) { |
| 9147 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", |
| 9148 "dimensions too big"); |
| 9149 return; |
| 9150 } |
| 9151 } else { |
| 9152 // Write all pixels in below. |
| 9153 texture_manager()->SetLevelCleared(texture_ref, target, level, true); |
| 9147 } | 9154 } |
| 9148 | 9155 |
| 9149 if (copyX != x || | 9156 if (copyX != x || |
| 9150 copyY != y || | 9157 copyY != y || |
| 9151 copyWidth != width || | 9158 copyWidth != width || |
| 9152 copyHeight != height) { | 9159 copyHeight != height) { |
| 9153 // some part was clipped so clear the sub rect. | 9160 // some part was clipped so clear the sub rect. |
| 9154 uint32 pixels_size = 0; | 9161 uint32 pixels_size = 0; |
| 9155 if (!GLES2Util::ComputeImageDataSizes( | 9162 if (!GLES2Util::ComputeImageDataSizes( |
| 9156 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, | 9163 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, |
| (...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11635 } | 11642 } |
| 11636 } | 11643 } |
| 11637 | 11644 |
| 11638 // Include the auto-generated part of this file. We split this because it means | 11645 // Include the auto-generated part of this file. We split this because it means |
| 11639 // we can easily edit the non-auto generated parts right here in this file | 11646 // we can easily edit the non-auto generated parts right here in this file |
| 11640 // instead of having to edit some template or the code generator. | 11647 // instead of having to edit some template or the code generator. |
| 11641 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11648 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 11642 | 11649 |
| 11643 } // namespace gles2 | 11650 } // namespace gles2 |
| 11644 } // namespace gpu | 11651 } // namespace gpu |
| OLD | NEW |