Index: cc/resources/resource_provider.cc |
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc |
index e58ed0b73b7c33c01b62ae654d8ec3bdf1664704..46cf4f26e9fb3316de9b997dbb2730e07d753670 100644 |
--- a/cc/resources/resource_provider.cc |
+++ b/cc/resources/resource_provider.cc |
@@ -2150,10 +2150,14 @@ uint8_t* ResourceProvider::MapImage(const Resource* resource, int* stride) { |
DCHECK(resource->image_id); |
GLES2Interface* gl = ContextGL(); |
DCHECK(gl); |
+ // In Android, the on-going SurfaceTexture based GpuMemoryBuffer can |
+ // only get the exact stride after it is mapped. So it should call |
+ // MapImage() first and then call GetStride(). |
reveman
2014/03/03 16:57:48
No need to leak details of the implementation into
junj
2014/03/04 11:11:23
Done.
|
+ uint8_t* pixels = static_cast<uint8_t*>( |
+ gl->MapImageCHROMIUM(resource->image_id, GL_READ_WRITE)); |
gl->GetImageParameterivCHROMIUM( |
resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, stride); |
- return static_cast<uint8_t*>( |
- gl->MapImageCHROMIUM(resource->image_id, GL_READ_WRITE)); |
+ return pixels; |
} |
DCHECK_EQ(Bitmap, resource->type); |
*stride = 0; |