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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 7541074: Fix 2 Dr. Memory issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | gpu/command_buffer/service/texture_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index a0f3dd3eb2ab1b308f63d1b24ba1955e105d14e5..81ac70ce64b11f1351d4a245ff2d509a349afc92 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -1384,7 +1384,8 @@ void GLES2Implementation::TexSubImage2DImpl(
static_cast<GLsizeiptr>(1));
while (height) {
GLint num_rows = std::min(height, max_rows);
- GLsizeiptr part_size = num_rows * padded_row_size;
+ GLsizeiptr part_size =
+ (num_rows - 1) * padded_row_size + unpadded_row_size;
void* buffer = transfer_buffer_.Alloc(part_size);
GLint y;
if (unpack_flip_y_) {
@@ -1401,7 +1402,7 @@ void GLES2Implementation::TexSubImage2DImpl(
transfer_buffer_id_, transfer_buffer_.GetOffset(buffer), internal);
transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken());
yoffset += num_rows;
- source += part_size;
+ source += num_rows * padded_row_size;
height -= num_rows;
}
} else {
@@ -1741,7 +1742,7 @@ void GLES2Implementation::ReadPixels(
// Compute how much space those rows will take. The last row will not
// include padding.
GLsizeiptr part_size =
- unpadded_row_size + (padded_row_size * std::max(num_rows - 1, 0));
+ unpadded_row_size + padded_row_size * (num_rows - 1);
void* buffer = transfer_buffer_.Alloc(part_size);
*result = 0; // mark as failed.
helper_->ReadPixels(
« no previous file with comments | « no previous file | gpu/command_buffer/service/texture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698