| 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 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // The following lock classes are part of the ResourceProvider API and are | 216 // The following lock classes are part of the ResourceProvider API and are |
| 217 // needed to read and write the resource contents. The user must ensure | 217 // needed to read and write the resource contents. The user must ensure |
| 218 // that they only use GL locks on GL resources, etc, and this is enforced | 218 // that they only use GL locks on GL resources, etc, and this is enforced |
| 219 // by assertions. | 219 // by assertions. |
| 220 class CC_EXPORT ScopedReadLockGL { | 220 class CC_EXPORT ScopedReadLockGL { |
| 221 public: | 221 public: |
| 222 ScopedReadLockGL(ResourceProvider* resource_provider, | 222 ScopedReadLockGL(ResourceProvider* resource_provider, |
| 223 ResourceProvider::ResourceId resource_id); | 223 ResourceProvider::ResourceId resource_id); |
| 224 virtual ~ScopedReadLockGL(); | 224 virtual ~ScopedReadLockGL(); |
| 225 | 225 |
| 226 unsigned texture_id() const { return texture_id_; } | 226 unsigned texture_id() const { return resource_->gl_id; } |
| 227 GLenum target() const { return resource_->target; } |
| 227 | 228 |
| 228 protected: | 229 protected: |
| 229 ResourceProvider* resource_provider_; | 230 ResourceProvider* resource_provider_; |
| 230 ResourceProvider::ResourceId resource_id_; | 231 ResourceProvider::ResourceId resource_id_; |
| 231 | 232 |
| 232 private: | 233 private: |
| 233 unsigned texture_id_; | 234 const ResourceProvider::Resource* resource_; |
| 234 | 235 |
| 235 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL); | 236 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL); |
| 236 }; | 237 }; |
| 237 | 238 |
| 238 class CC_EXPORT ScopedSamplerGL : public ScopedReadLockGL { | 239 class CC_EXPORT ScopedSamplerGL : public ScopedReadLockGL { |
| 239 public: | 240 public: |
| 240 ScopedSamplerGL(ResourceProvider* resource_provider, | 241 ScopedSamplerGL(ResourceProvider* resource_provider, |
| 241 ResourceProvider::ResourceId resource_id, | 242 ResourceProvider::ResourceId resource_id, |
| 242 GLenum filter); | 243 GLenum filter); |
| 243 ScopedSamplerGL(ResourceProvider* resource_provider, | 244 ScopedSamplerGL(ResourceProvider* resource_provider, |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 return format_gl_data_format[format]; | 659 return format_gl_data_format[format]; |
| 659 } | 660 } |
| 660 | 661 |
| 661 inline GLenum GLInternalFormat(ResourceFormat format) { | 662 inline GLenum GLInternalFormat(ResourceFormat format) { |
| 662 return GLDataFormat(format); | 663 return GLDataFormat(format); |
| 663 } | 664 } |
| 664 | 665 |
| 665 } // namespace cc | 666 } // namespace cc |
| 666 | 667 |
| 667 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 668 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |