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/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 if (resource->type != GLTexture) | 1349 if (resource->type != GLTexture) |
1350 return; | 1350 return; |
1351 | 1351 |
1352 if (resource->image_id) | 1352 if (resource->image_id) |
1353 return; | 1353 return; |
1354 | 1354 |
1355 resource->allocated = true; | 1355 resource->allocated = true; |
1356 WebGraphicsContext3D* context3d = output_surface_->context3d(); | 1356 WebGraphicsContext3D* context3d = output_surface_->context3d(); |
1357 DCHECK(context3d); | 1357 DCHECK(context3d); |
1358 resource->image_id = context3d->createImageCHROMIUM( | 1358 resource->image_id = context3d->createImageCHROMIUM( |
1359 resource->size.width(), resource->size.height(), GL_RGBA8_OES); | 1359 resource->size.width(), resource->size.height(), resource->format); |
1360 DCHECK(resource->image_id); | 1360 DCHECK(resource->image_id); |
1361 } | 1361 } |
1362 | 1362 |
1363 void ResourceProvider::ReleaseImage(ResourceId id) { | 1363 void ResourceProvider::ReleaseImage(ResourceId id) { |
1364 DCHECK(thread_checker_.CalledOnValidThread()); | 1364 DCHECK(thread_checker_.CalledOnValidThread()); |
1365 ResourceMap::iterator it = resources_.find(id); | 1365 ResourceMap::iterator it = resources_.find(id); |
1366 CHECK(it != resources_.end()); | 1366 CHECK(it != resources_.end()); |
1367 Resource* resource = &it->second; | 1367 Resource* resource = &it->second; |
1368 | 1368 |
1369 DCHECK(!resource->external); | 1369 DCHECK(!resource->external); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 return stride; | 1439 return stride; |
1440 } | 1440 } |
1441 | 1441 |
1442 GLint ResourceProvider::GetActiveTextureUnit(WebGraphicsContext3D* context) { | 1442 GLint ResourceProvider::GetActiveTextureUnit(WebGraphicsContext3D* context) { |
1443 GLint active_unit = 0; | 1443 GLint active_unit = 0; |
1444 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 1444 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
1445 return active_unit; | 1445 return active_unit; |
1446 } | 1446 } |
1447 | 1447 |
1448 } // namespace cc | 1448 } // namespace cc |
OLD | NEW |