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