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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 target_(resource_provider->BindForSampling(resource_id, unit_, filter)) { | 825 target_(resource_provider->BindForSampling(resource_id, unit_, filter)) { |
826 } | 826 } |
827 | 827 |
828 ResourceProvider::ScopedSamplerGL::~ScopedSamplerGL() { | 828 ResourceProvider::ScopedSamplerGL::~ScopedSamplerGL() { |
829 } | 829 } |
830 | 830 |
831 ResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL( | 831 ResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL( |
832 ResourceProvider* resource_provider, | 832 ResourceProvider* resource_provider, |
833 ResourceProvider::ResourceId resource_id) | 833 ResourceProvider::ResourceId resource_id) |
834 : resource_provider_(resource_provider), | 834 : resource_provider_(resource_provider), |
835 resource_id_(resource_id), | 835 resource_id_(resource_id) { |
836 texture_id_(resource_provider->LockForWrite(resource_id)->gl_id) { | 836 const Resource* resource = resource_provider->LockForWrite(resource_id); |
| 837 texture_id_ = resource->gl_id; |
| 838 format_ = resource->format; |
837 DCHECK(texture_id_); | 839 DCHECK(texture_id_); |
838 } | 840 } |
839 | 841 |
840 ResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() { | 842 ResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() { |
841 resource_provider_->UnlockForWrite(resource_id_); | 843 resource_provider_->UnlockForWrite(resource_id_); |
842 } | 844 } |
843 | 845 |
844 void ResourceProvider::PopulateSkBitmapWithResource( | 846 void ResourceProvider::PopulateSkBitmapWithResource( |
845 SkBitmap* sk_bitmap, const Resource* resource) { | 847 SkBitmap* sk_bitmap, const Resource* resource) { |
846 DCHECK(resource->pixels); | 848 DCHECK(resource->pixels); |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 1806 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
1805 return active_unit; | 1807 return active_unit; |
1806 } | 1808 } |
1807 | 1809 |
1808 GLES2Interface* ResourceProvider::ContextGL() const { | 1810 GLES2Interface* ResourceProvider::ContextGL() const { |
1809 ContextProvider* context_provider = output_surface_->context_provider(); | 1811 ContextProvider* context_provider = output_surface_->context_provider(); |
1810 return context_provider ? context_provider->ContextGL() : NULL; | 1812 return context_provider ? context_provider->ContextGL() : NULL; |
1811 } | 1813 } |
1812 | 1814 |
1813 } // namespace cc | 1815 } // namespace cc |
OLD | NEW |