| 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 target_(resource_provider->BindForSampling(resource_id, unit_, filter)) { | 815 target_(resource_provider->BindForSampling(resource_id, unit_, filter)) { |
| 816 } | 816 } |
| 817 | 817 |
| 818 ResourceProvider::ScopedSamplerGL::~ScopedSamplerGL() { | 818 ResourceProvider::ScopedSamplerGL::~ScopedSamplerGL() { |
| 819 } | 819 } |
| 820 | 820 |
| 821 ResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL( | 821 ResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL( |
| 822 ResourceProvider* resource_provider, | 822 ResourceProvider* resource_provider, |
| 823 ResourceProvider::ResourceId resource_id) | 823 ResourceProvider::ResourceId resource_id) |
| 824 : resource_provider_(resource_provider), | 824 : resource_provider_(resource_provider), |
| 825 resource_id_(resource_id), | 825 resource_id_(resource_id) { |
| 826 texture_id_(resource_provider->LockForWrite(resource_id)->gl_id) { | 826 const Resource* resource = resource_provider->LockForWrite(resource_id); |
| 827 texture_id_ = resource->gl_id; |
| 828 format_ = resource->format; |
| 827 DCHECK(texture_id_); | 829 DCHECK(texture_id_); |
| 828 } | 830 } |
| 829 | 831 |
| 830 ResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() { | 832 ResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() { |
| 831 resource_provider_->UnlockForWrite(resource_id_); | 833 resource_provider_->UnlockForWrite(resource_id_); |
| 832 } | 834 } |
| 833 | 835 |
| 834 void ResourceProvider::PopulateSkBitmapWithResource( | 836 void ResourceProvider::PopulateSkBitmapWithResource( |
| 835 SkBitmap* sk_bitmap, const Resource* resource) { | 837 SkBitmap* sk_bitmap, const Resource* resource) { |
| 836 DCHECK(resource->pixels); | 838 DCHECK(resource->pixels); |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 1836 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
| 1835 return active_unit; | 1837 return active_unit; |
| 1836 } | 1838 } |
| 1837 | 1839 |
| 1838 blink::WebGraphicsContext3D* ResourceProvider::Context3d() const { | 1840 blink::WebGraphicsContext3D* ResourceProvider::Context3d() const { |
| 1839 ContextProvider* context_provider = output_surface_->context_provider(); | 1841 ContextProvider* context_provider = output_surface_->context_provider(); |
| 1840 return context_provider ? context_provider->Context3d() : NULL; | 1842 return context_provider ? context_provider->Context3d() : NULL; |
| 1841 } | 1843 } |
| 1842 | 1844 |
| 1843 } // namespace cc | 1845 } // namespace cc |
| OLD | NEW |