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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Producer interface. | 128 // Producer interface. |
129 | 129 |
130 ResourceType default_resource_type() const { return default_resource_type_; } | 130 ResourceType default_resource_type() const { return default_resource_type_; } |
131 ResourceType GetResourceType(ResourceId id); | 131 ResourceType GetResourceType(ResourceId id); |
132 GLenum GetResourceTextureTarget(ResourceId id); | 132 GLenum GetResourceTextureTarget(ResourceId id); |
133 TextureHint GetTextureHint(ResourceId id); | 133 TextureHint GetTextureHint(ResourceId id); |
134 | 134 |
135 // Creates a resource of the default resource type. | 135 // Creates a resource of the default resource type. |
136 ResourceId CreateResource(const gfx::Size& size, | 136 ResourceId CreateResource(const gfx::Size& size, |
137 TextureHint hint, | 137 TextureHint hint, |
138 ResourceFormat format); | 138 ResourceFormat format, |
| 139 const gfx::ColorSpace& color_space); |
139 | 140 |
140 // Creates a resource for a particular texture target (the distinction between | 141 // Creates a resource for a particular texture target (the distinction between |
141 // texture targets has no effect in software mode). | 142 // texture targets has no effect in software mode). |
142 ResourceId CreateGpuMemoryBufferResource(const gfx::Size& size, | 143 ResourceId CreateGpuMemoryBufferResource(const gfx::Size& size, |
143 TextureHint hint, | 144 TextureHint hint, |
144 ResourceFormat format, | 145 ResourceFormat format, |
145 gfx::BufferUsage usage); | 146 gfx::BufferUsage usage, |
| 147 const gfx::ColorSpace& color_space); |
146 | 148 |
147 // Wraps an external texture mailbox into a GL resource. | 149 // Wraps an external texture mailbox into a GL resource. |
148 ResourceId CreateResourceFromTextureMailbox( | 150 ResourceId CreateResourceFromTextureMailbox( |
149 const TextureMailbox& mailbox, | 151 const TextureMailbox& mailbox, |
150 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl); | 152 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl); |
151 | 153 |
152 ResourceId CreateResourceFromTextureMailbox( | 154 ResourceId CreateResourceFromTextureMailbox( |
153 const TextureMailbox& mailbox, | 155 const TextureMailbox& mailbox, |
154 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, | 156 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, |
155 bool read_lock_fences_enabled); | 157 bool read_lock_fences_enabled); |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 629 |
628 bool ReadLockFenceHasPassed(const Resource* resource) { | 630 bool ReadLockFenceHasPassed(const Resource* resource) { |
629 return !resource->read_lock_fence.get() || | 631 return !resource->read_lock_fence.get() || |
630 resource->read_lock_fence->HasPassed(); | 632 resource->read_lock_fence->HasPassed(); |
631 } | 633 } |
632 | 634 |
633 ResourceId CreateGLTexture(const gfx::Size& size, | 635 ResourceId CreateGLTexture(const gfx::Size& size, |
634 TextureHint hint, | 636 TextureHint hint, |
635 ResourceType type, | 637 ResourceType type, |
636 ResourceFormat format, | 638 ResourceFormat format, |
637 gfx::BufferUsage usage); | 639 gfx::BufferUsage usage, |
638 ResourceId CreateBitmap(const gfx::Size& size); | 640 const gfx::ColorSpace& color_space); |
| 641 ResourceId CreateBitmap(const gfx::Size& size, |
| 642 const gfx::ColorSpace& color_space); |
639 Resource* InsertResource(ResourceId id, Resource resource); | 643 Resource* InsertResource(ResourceId id, Resource resource); |
640 Resource* GetResource(ResourceId id); | 644 Resource* GetResource(ResourceId id); |
641 const Resource* LockForRead(ResourceId id); | 645 const Resource* LockForRead(ResourceId id); |
642 void UnlockForRead(ResourceId id); | 646 void UnlockForRead(ResourceId id); |
643 Resource* LockForWrite(ResourceId id); | 647 Resource* LockForWrite(ResourceId id); |
644 void UnlockForWrite(Resource* resource); | 648 void UnlockForWrite(Resource* resource); |
645 | 649 |
646 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, | 650 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, |
647 const Resource* resource); | 651 const Resource* resource); |
648 | 652 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 // A process-unique ID used for disambiguating memory dumps from different | 717 // A process-unique ID used for disambiguating memory dumps from different |
714 // resource providers. | 718 // resource providers. |
715 int tracing_id_; | 719 int tracing_id_; |
716 | 720 |
717 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 721 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
718 }; | 722 }; |
719 | 723 |
720 } // namespace cc | 724 } // namespace cc |
721 | 725 |
722 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 726 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |