| 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 WebGraphicsContext3D* context3d = output_surface_->context3d(); | 961 WebGraphicsContext3D* context3d = output_surface_->context3d(); |
| 962 DCHECK(context3d); | 962 DCHECK(context3d); |
| 963 DCHECK(resource->gl_pixel_buffer_id); | 963 DCHECK(resource->gl_pixel_buffer_id); |
| 964 context3d->bindBuffer( | 964 context3d->bindBuffer( |
| 965 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, | 965 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, |
| 966 resource->gl_pixel_buffer_id); | 966 resource->gl_pixel_buffer_id); |
| 967 uint8_t* image = static_cast<uint8_t*>( | 967 uint8_t* image = static_cast<uint8_t*>( |
| 968 context3d->mapBufferCHROMIUM( | 968 context3d->mapBufferCHROMIUM( |
| 969 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, GL_WRITE_ONLY)); | 969 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, GL_WRITE_ONLY)); |
| 970 context3d->bindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); | 970 context3d->bindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); |
| 971 // Buffer is required to be 4-byte aligned. |
| 972 CHECK(!(reinterpret_cast<intptr_t>(image) & 3)); |
| 971 return image; | 973 return image; |
| 972 } | 974 } |
| 973 | 975 |
| 974 if (resource->pixels) | 976 if (resource->pixels) |
| 975 return resource->pixel_buffer; | 977 return resource->pixel_buffer; |
| 976 | 978 |
| 977 return NULL; | 979 return NULL; |
| 978 } | 980 } |
| 979 | 981 |
| 980 void ResourceProvider::UnmapPixelBuffer(ResourceId id) { | 982 void ResourceProvider::UnmapPixelBuffer(ResourceId id) { |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 void ResourceProvider::EnableReadLockFences(ResourceProvider::ResourceId id, | 1238 void ResourceProvider::EnableReadLockFences(ResourceProvider::ResourceId id, |
| 1237 bool enable) { | 1239 bool enable) { |
| 1238 DCHECK(thread_checker_.CalledOnValidThread()); | 1240 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1239 ResourceMap::iterator it = resources_.find(id); | 1241 ResourceMap::iterator it = resources_.find(id); |
| 1240 CHECK(it != resources_.end()); | 1242 CHECK(it != resources_.end()); |
| 1241 Resource* resource = &it->second; | 1243 Resource* resource = &it->second; |
| 1242 resource->enable_read_lock_fences = enable; | 1244 resource->enable_read_lock_fences = enable; |
| 1243 } | 1245 } |
| 1244 | 1246 |
| 1245 } // namespace cc | 1247 } // namespace cc |
| OLD | NEW |