Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1586053002: Reland of Untouch out of bound pixels for CopyTexSubImage2D (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 11379 matching lines...) Expand 10 before | Expand all | Expand 10 after
11390 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", 11390 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D",
11391 "dimensions too big"); 11391 "dimensions too big");
11392 return; 11392 return;
11393 } 11393 }
11394 } 11394 }
11395 } else { 11395 } else {
11396 // Write all pixels in below. 11396 // Write all pixels in below.
11397 texture_manager()->SetLevelCleared(texture_ref, target, level, true); 11397 texture_manager()->SetLevelCleared(texture_ref, target, level, true);
11398 } 11398 }
11399 11399
11400 if (copyX != x ||
11401 copyY != y ||
11402 copyWidth != width ||
11403 copyHeight != height) {
11404 // some part was clipped so clear the sub rect.
11405 uint32_t pixels_size = 0;
11406 if (!GLES2Util::ComputeImageDataSizes(
11407 width, height, 1, format, type, state_.unpack_alignment, &pixels_size,
11408 NULL, NULL)) {
11409 LOCAL_SET_GL_ERROR(
11410 GL_INVALID_VALUE, "glCopyTexSubImage2D", "dimensions too large");
11411 return;
11412 }
11413 scoped_ptr<char[]> zero(new char[pixels_size]);
11414 memset(zero.get(), 0, pixels_size);
11415 glTexSubImage2D(
11416 target, level, xoffset, yoffset, width, height,
11417 format, type, zero.get());
11418 }
Zhenyao Mo 2016/01/14 18:13:37 Look at the code above SetLevelClearedRect(), sinc
qiankun 2016/01/19 16:07:31 Thanks for pointing this. I updated the CL. PTAL.
11419
11420 if (copyHeight > 0 && copyWidth > 0) { 11400 if (copyHeight > 0 && copyWidth > 0) {
11421 GLint dx = copyX - x; 11401 GLint dx = copyX - x;
11422 GLint dy = copyY - y; 11402 GLint dy = copyY - y;
11423 GLint destX = xoffset + dx; 11403 GLint destX = xoffset + dx;
11424 GLint destY = yoffset + dy; 11404 GLint destY = yoffset + dy;
11425 glCopyTexSubImage2D(target, level, 11405 glCopyTexSubImage2D(target, level,
11426 destX, destY, copyX, copyY, 11406 destX, destY, copyX, copyY,
11427 copyWidth, copyHeight); 11407 copyWidth, copyHeight);
11428 } 11408 }
11429 11409
(...skipping 4150 matching lines...) Expand 10 before | Expand all | Expand 10 after
15580 } 15560 }
15581 15561
15582 // Include the auto-generated part of this file. We split this because it means 15562 // Include the auto-generated part of this file. We split this because it means
15583 // we can easily edit the non-auto generated parts right here in this file 15563 // we can easily edit the non-auto generated parts right here in this file
15584 // instead of having to edit some template or the code generator. 15564 // instead of having to edit some template or the code generator.
15585 #include "base/macros.h" 15565 #include "base/macros.h"
15586 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15566 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15587 15567
15588 } // namespace gles2 15568 } // namespace gles2
15589 } // namespace gpu 15569 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698