| 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 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 uint8_t* ResourceProvider::MapImage(ResourceId id) { | 1357 uint8_t* ResourceProvider::MapImage(ResourceId id) { |
| 1358 DCHECK(thread_checker_.CalledOnValidThread()); | 1358 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1359 ResourceMap::iterator it = resources_.find(id); | 1359 ResourceMap::iterator it = resources_.find(id); |
| 1360 CHECK(it != resources_.end()); | 1360 CHECK(it != resources_.end()); |
| 1361 Resource* resource = &it->second; | 1361 Resource* resource = &it->second; |
| 1362 | 1362 |
| 1363 DCHECK(ReadLockFenceHasPassed(resource)); | 1363 DCHECK(ReadLockFenceHasPassed(resource)); |
| 1364 DCHECK(!resource->external); | 1364 DCHECK(!resource->external); |
| 1365 DCHECK(!resource->exported); | 1365 DCHECK(!resource->exported); |
| 1366 DCHECK(!resource->pixels); | 1366 DCHECK(!resource->pixels); |
| 1367 DCHECK(resource->image_id); | 1367 |
| 1368 if (!resource->image_id) |
| 1369 return NULL; |
| 1368 | 1370 |
| 1369 WebGraphicsContext3D* context3d = output_surface_->context3d(); | 1371 WebGraphicsContext3D* context3d = output_surface_->context3d(); |
| 1370 DCHECK(context3d); | 1372 DCHECK(context3d); |
| 1371 return static_cast<uint8_t*>( | 1373 return static_cast<uint8_t*>( |
| 1372 context3d->mapImageCHROMIUM(resource->image_id, GL_READ_WRITE)); | 1374 context3d->mapImageCHROMIUM(resource->image_id, GL_READ_WRITE)); |
| 1373 } | 1375 } |
| 1374 | 1376 |
| 1375 void ResourceProvider::UnmapImage(ResourceId id) { | 1377 void ResourceProvider::UnmapImage(ResourceId id) { |
| 1376 DCHECK(thread_checker_.CalledOnValidThread()); | 1378 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1377 ResourceMap::iterator it = resources_.find(id); | 1379 ResourceMap::iterator it = resources_.find(id); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 | 1423 |
| 1422 WebGraphicsContext3D* context3d = output_surface_->context3d(); | 1424 WebGraphicsContext3D* context3d = output_surface_->context3d(); |
| 1423 DCHECK(context3d); | 1425 DCHECK(context3d); |
| 1424 int stride = 0; | 1426 int stride = 0; |
| 1425 context3d->getImageParameterivCHROMIUM( | 1427 context3d->getImageParameterivCHROMIUM( |
| 1426 resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, &stride); | 1428 resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, &stride); |
| 1427 return stride; | 1429 return stride; |
| 1428 } | 1430 } |
| 1429 | 1431 |
| 1430 } // namespace cc | 1432 } // namespace cc |
| OLD | NEW |