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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 | 1346 |
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 DCHECK_EQ(static_cast<GLenum>(GL_RGBA), resource->format); |
1356 resource->image_id = context3d->createImageCHROMIUM( | 1357 resource->image_id = context3d->createImageCHROMIUM( |
1357 resource->size.width(), resource->size.height(), GL_RGBA8_OES); | 1358 resource->size.width(), resource->size.height(), GL_RGBA8_OES); |
1358 DCHECK(resource->image_id); | 1359 DCHECK(resource->image_id); |
1359 } | 1360 } |
1360 | 1361 |
1361 void ResourceProvider::ReleaseImage(ResourceId id) { | 1362 void ResourceProvider::ReleaseImage(ResourceId id) { |
1362 DCHECK(thread_checker_.CalledOnValidThread()); | 1363 DCHECK(thread_checker_.CalledOnValidThread()); |
1363 ResourceMap::iterator it = resources_.find(id); | 1364 ResourceMap::iterator it = resources_.find(id); |
1364 CHECK(it != resources_.end()); | 1365 CHECK(it != resources_.end()); |
1365 Resource* resource = &it->second; | 1366 Resource* resource = &it->second; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 return stride; | 1438 return stride; |
1438 } | 1439 } |
1439 | 1440 |
1440 GLint ResourceProvider::GetActiveTextureUnit(WebGraphicsContext3D* context) { | 1441 GLint ResourceProvider::GetActiveTextureUnit(WebGraphicsContext3D* context) { |
1441 GLint active_unit = 0; | 1442 GLint active_unit = 0; |
1442 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 1443 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
1443 return active_unit; | 1444 return active_unit; |
1444 } | 1445 } |
1445 | 1446 |
1446 } // namespace cc | 1447 } // namespace cc |
OLD | NEW |