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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 | 1343 |
1344 if (resource->type != GLTexture) | 1344 if (resource->type != GLTexture) |
1345 return; | 1345 return; |
1346 | 1346 |
1347 if (resource->image_id) | 1347 if (resource->image_id) |
1348 return; | 1348 return; |
1349 | 1349 |
1350 resource->allocated = true; | 1350 resource->allocated = true; |
1351 WebGraphicsContext3D* context3d = Context3d(); | 1351 WebGraphicsContext3D* context3d = Context3d(); |
1352 DCHECK(context3d); | 1352 DCHECK(context3d); |
| 1353 DCHECK_EQ(static_cast<GLenum>(GL_RGBA), resource->format); |
1353 resource->image_id = context3d->createImageCHROMIUM( | 1354 resource->image_id = context3d->createImageCHROMIUM( |
1354 resource->size.width(), resource->size.height(), GL_RGBA8_OES); | 1355 resource->size.width(), resource->size.height(), GL_RGBA8_OES); |
1355 DCHECK(resource->image_id); | 1356 DCHECK(resource->image_id); |
1356 } | 1357 } |
1357 | 1358 |
1358 void ResourceProvider::ReleaseImage(ResourceId id) { | 1359 void ResourceProvider::ReleaseImage(ResourceId id) { |
1359 DCHECK(thread_checker_.CalledOnValidThread()); | 1360 DCHECK(thread_checker_.CalledOnValidThread()); |
1360 ResourceMap::iterator it = resources_.find(id); | 1361 ResourceMap::iterator it = resources_.find(id); |
1361 CHECK(it != resources_.end()); | 1362 CHECK(it != resources_.end()); |
1362 Resource* resource = &it->second; | 1363 Resource* resource = &it->second; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 1440 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
1440 return active_unit; | 1441 return active_unit; |
1441 } | 1442 } |
1442 | 1443 |
1443 WebKit::WebGraphicsContext3D* ResourceProvider::Context3d() const { | 1444 WebKit::WebGraphicsContext3D* ResourceProvider::Context3d() const { |
1444 ContextProvider* context_provider = output_surface_->context_provider(); | 1445 ContextProvider* context_provider = output_surface_->context_provider(); |
1445 return context_provider ? context_provider->Context3d() : NULL; | 1446 return context_provider ? context_provider->Context3d() : NULL; |
1446 } | 1447 } |
1447 | 1448 |
1448 } // namespace cc | 1449 } // namespace cc |
OLD | NEW |