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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1609983003: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 5bf0492c8d49a6650c21b06423fe6c87ad236e7a..154f807453cd039c008c808563263b00bf1cbdb4 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -11393,12 +11393,16 @@
Clip(x, width, size.width(), &copyX, &copyWidth);
Clip(y, height, size.height(), &copyY, &copyHeight);
- if (xoffset != 0 || yoffset != 0 || width != size.width() ||
- height != size.height()) {
+ GLint dx = copyX - x;
+ GLint dy = copyY - y;
+ GLint destX = xoffset + dx;
+ GLint destY = yoffset + dy;
+ if (destX != 0 || destY != 0 || copyWidth != size.width() ||
+ copyHeight != size.height()) {
gfx::Rect cleared_rect;
if (TextureManager::CombineAdjacentRects(
texture->GetLevelClearedRect(target, level),
- gfx::Rect(xoffset, yoffset, width, height), &cleared_rect)) {
+ gfx::Rect(destX, destY, copyWidth, copyHeight), &cleared_rect)) {
DCHECK_GE(cleared_rect.size().GetArea(),
texture->GetLevelClearedRect(target, level).size().GetArea());
texture_manager()->SetLevelClearedRect(texture_ref, target, level,
@@ -11417,31 +11421,7 @@
texture_manager()->SetLevelCleared(texture_ref, target, level, true);
}
- if (copyX != x ||
- copyY != y ||
- copyWidth != width ||
- copyHeight != height) {
- // some part was clipped so clear the sub rect.
- uint32_t pixels_size = 0;
- if (!GLES2Util::ComputeImageDataSizes(
- width, height, 1, format, type, state_.unpack_alignment, &pixels_size,
- NULL, NULL)) {
- LOCAL_SET_GL_ERROR(
- GL_INVALID_VALUE, "glCopyTexSubImage2D", "dimensions too large");
- return;
- }
- scoped_ptr<char[]> zero(new char[pixels_size]);
- memset(zero.get(), 0, pixels_size);
- glTexSubImage2D(
- target, level, xoffset, yoffset, width, height,
- format, type, zero.get());
- }
-
if (copyHeight > 0 && copyWidth > 0) {
- GLint dx = copyX - x;
- GLint dy = copyY - y;
- GLint destX = xoffset + dx;
- GLint destY = yoffset + dy;
glCopyTexSubImage2D(target, level,
destX, destY, copyX, copyY,
copyWidth, copyHeight);
« 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