| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 WebGraphicsContext3D* context3d = output_surface_->context3d(); | 974 WebGraphicsContext3D* context3d = output_surface_->context3d(); |
| 975 DCHECK(context3d); | 975 DCHECK(context3d); |
| 976 DCHECK(resource->gl_pixel_buffer_id); | 976 DCHECK(resource->gl_pixel_buffer_id); |
| 977 context3d->bindBuffer( | 977 context3d->bindBuffer( |
| 978 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, | 978 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, |
| 979 resource->gl_pixel_buffer_id); | 979 resource->gl_pixel_buffer_id); |
| 980 uint8_t* image = static_cast<uint8_t*>( | 980 uint8_t* image = static_cast<uint8_t*>( |
| 981 context3d->mapBufferCHROMIUM( | 981 context3d->mapBufferCHROMIUM( |
| 982 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, GL_WRITE_ONLY)); | 982 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, GL_WRITE_ONLY)); |
| 983 context3d->bindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); | 983 context3d->bindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); |
| 984 // Buffer is required to be 4-byte aligned. | |
| 985 CHECK(!(reinterpret_cast<intptr_t>(image) & 3)); | |
| 986 return image; | 984 return image; |
| 987 } | 985 } |
| 988 | 986 |
| 989 if (resource->pixels) | 987 if (resource->pixels) |
| 990 return resource->pixel_buffer; | 988 return resource->pixel_buffer; |
| 991 | 989 |
| 992 return NULL; | 990 return NULL; |
| 993 } | 991 } |
| 994 | 992 |
| 995 void ResourceProvider::UnmapPixelBuffer(ResourceId id) { | 993 void ResourceProvider::UnmapPixelBuffer(ResourceId id) { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 WebGraphicsContext3D* context3d = output_surface_->context3d(); | 1365 WebGraphicsContext3D* context3d = output_surface_->context3d(); |
| 1368 DCHECK(context3d); | 1366 DCHECK(context3d); |
| 1369 int stride = 0; | 1367 int stride = 0; |
| 1370 context3d->getImageParameterivCHROMIUM( | 1368 context3d->getImageParameterivCHROMIUM( |
| 1371 resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, &stride); | 1369 resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, &stride); |
| 1372 return stride; | 1370 return stride; |
| 1373 } | 1371 } |
| 1374 | 1372 |
| 1375 | 1373 |
| 1376 } // namespace cc | 1374 } // namespace cc |
| OLD | NEW |