summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc7
-rw-r--r--gpu/command_buffer/service/texture_manager_unittest.cc5
2 files changed, 7 insertions, 5 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index d3fcf87..06108d4 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -1416,7 +1416,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_) {
@@ -1433,7 +1434,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 {
@@ -1805,7 +1806,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(
diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc
index 356453d..dd634e8 100644
--- a/gpu/command_buffer/service/texture_manager_unittest.cc
+++ b/gpu/command_buffer/service/texture_manager_unittest.cc
@@ -308,10 +308,11 @@ class TextureInfoTest : public testing::Test {
::gfx::GLInterface::SetGLInterface(gl_.get());
manager_.CreateTextureInfo(&feature_info_, kClient1Id, kService1Id);
info_ = manager_.GetTextureInfo(kClient1Id);
- ASSERT_TRUE(info_ != NULL);
+ ASSERT_TRUE(info_.get() != NULL);
}
virtual void TearDown() {
+ info_ = NULL;
::gfx::GLInterface::SetGLInterface(NULL);
gl_.reset();
}
@@ -319,7 +320,7 @@ class TextureInfoTest : public testing::Test {
// Use StrictMock to make 100% sure we know how GL will be called.
scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
TextureManager manager_;
- TextureManager::TextureInfo* info_;
+ TextureManager::TextureInfo::Ref info_;
FeatureInfo feature_info_;
};