Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Side by Side Diff: cc/resources/resource_provider.h

Issue 486853002: cc: Use a normal texture for background texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class TextureUploader; 53 class TextureUploader;
54 54
55 // This class is not thread-safe and can only be called from the thread it was 55 // This class is not thread-safe and can only be called from the thread it was
56 // created on (in practice, the impl thread). 56 // created on (in practice, the impl thread).
57 class CC_EXPORT ResourceProvider { 57 class CC_EXPORT ResourceProvider {
58 public: 58 public:
59 typedef unsigned ResourceId; 59 typedef unsigned ResourceId;
60 typedef std::vector<ResourceId> ResourceIdArray; 60 typedef std::vector<ResourceId> ResourceIdArray;
61 typedef std::set<ResourceId> ResourceIdSet; 61 typedef std::set<ResourceId> ResourceIdSet;
62 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; 62 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
63 enum TextureUsageHint { 63 enum TextureHint {
64 TextureUsageAny, 64 TextureHintDefault,
65 TextureUsageFramebuffer, 65 TextureHintImmutable,
66 TextureHintFramebuffer,
66 }; 67 };
67 enum ResourceType { 68 enum ResourceType {
68 InvalidType = 0, 69 InvalidType = 0,
69 GLTexture = 1, 70 GLTexture = 1,
70 Bitmap, 71 Bitmap,
71 }; 72 };
72 73
73 static scoped_ptr<ResourceProvider> Create( 74 static scoped_ptr<ResourceProvider> Create(
74 OutputSurface* output_surface, 75 OutputSurface* output_surface,
75 SharedBitmapManager* shared_bitmap_manager, 76 SharedBitmapManager* shared_bitmap_manager,
(...skipping 23 matching lines...) Expand all
99 bool AllowOverlay(ResourceId id); 100 bool AllowOverlay(ResourceId id);
100 101
101 // Producer interface. 102 // Producer interface.
102 103
103 ResourceType default_resource_type() const { return default_resource_type_; } 104 ResourceType default_resource_type() const { return default_resource_type_; }
104 ResourceType GetResourceType(ResourceId id); 105 ResourceType GetResourceType(ResourceId id);
105 106
106 // Creates a resource of the default resource type. 107 // Creates a resource of the default resource type.
107 ResourceId CreateResource(const gfx::Size& size, 108 ResourceId CreateResource(const gfx::Size& size,
108 GLint wrap_mode, 109 GLint wrap_mode,
109 TextureUsageHint hint, 110 TextureHint hint,
110 ResourceFormat format); 111 ResourceFormat format);
111 112
112 // Creates a resource which is tagged as being managed for GPU memory 113 // Creates a resource which is tagged as being managed for GPU memory
113 // accounting purposes. 114 // accounting purposes.
114 ResourceId CreateManagedResource(const gfx::Size& size, 115 ResourceId CreateManagedResource(const gfx::Size& size,
115 GLenum target, 116 GLenum target,
116 GLint wrap_mode, 117 GLint wrap_mode,
117 TextureUsageHint hint, 118 TextureHint hint,
118 ResourceFormat format); 119 ResourceFormat format);
119 120
120 // You can also explicitly create a specific resource type. 121 // You can also explicitly create a specific resource type.
121 ResourceId CreateGLTexture(const gfx::Size& size, 122 ResourceId CreateGLTexture(const gfx::Size& size,
122 GLenum target, 123 GLenum target,
123 GLenum texture_pool, 124 GLenum texture_pool,
124 GLint wrap_mode, 125 GLint wrap_mode,
125 TextureUsageHint hint, 126 TextureHint hint,
126 ResourceFormat format); 127 ResourceFormat format);
127 128
128 ResourceId CreateBitmap(const gfx::Size& size, GLint wrap_mode); 129 ResourceId CreateBitmap(const gfx::Size& size, GLint wrap_mode);
129 // Wraps an IOSurface into a GL resource. 130 // Wraps an IOSurface into a GL resource.
130 ResourceId CreateResourceFromIOSurface(const gfx::Size& size, 131 ResourceId CreateResourceFromIOSurface(const gfx::Size& size,
131 unsigned io_surface_id); 132 unsigned io_surface_id);
132 133
133 // Wraps an external texture mailbox into a GL resource. 134 // Wraps an external texture mailbox into a GL resource.
134 ResourceId CreateResourceFromTextureMailbox( 135 ResourceId CreateResourceFromTextureMailbox(
135 const TextureMailbox& mailbox, 136 const TextureMailbox& mailbox,
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 381
381 Resource(); 382 Resource();
382 ~Resource(); 383 ~Resource();
383 Resource(unsigned texture_id, 384 Resource(unsigned texture_id,
384 const gfx::Size& size, 385 const gfx::Size& size,
385 Origin origin, 386 Origin origin,
386 GLenum target, 387 GLenum target,
387 GLenum filter, 388 GLenum filter,
388 GLenum texture_pool, 389 GLenum texture_pool,
389 GLint wrap_mode, 390 GLint wrap_mode,
390 TextureUsageHint hint, 391 TextureHint hint,
391 ResourceFormat format); 392 ResourceFormat format);
392 Resource(uint8_t* pixels, 393 Resource(uint8_t* pixels,
393 SharedBitmap* bitmap, 394 SharedBitmap* bitmap,
394 const gfx::Size& size, 395 const gfx::Size& size,
395 Origin origin, 396 Origin origin,
396 GLenum filter, 397 GLenum filter,
397 GLint wrap_mode); 398 GLint wrap_mode);
398 Resource(const SharedBitmapId& bitmap_id, 399 Resource(const SharedBitmapId& bitmap_id,
399 const gfx::Size& size, 400 const gfx::Size& size,
400 Origin origin, 401 Origin origin,
(...skipping 28 matching lines...) Expand all
429 gfx::Size size; 430 gfx::Size size;
430 Origin origin; 431 Origin origin;
431 GLenum target; 432 GLenum target;
432 // TODO(skyostil): Use a separate sampler object for filter state. 433 // TODO(skyostil): Use a separate sampler object for filter state.
433 GLenum original_filter; 434 GLenum original_filter;
434 GLenum filter; 435 GLenum filter;
435 unsigned image_id; 436 unsigned image_id;
436 unsigned bound_image_id; 437 unsigned bound_image_id;
437 GLenum texture_pool; 438 GLenum texture_pool;
438 GLint wrap_mode; 439 GLint wrap_mode;
439 TextureUsageHint hint; 440 TextureHint hint;
440 ResourceType type; 441 ResourceType type;
441 ResourceFormat format; 442 ResourceFormat format;
442 SharedBitmapId shared_bitmap_id; 443 SharedBitmapId shared_bitmap_id;
443 SharedBitmap* shared_bitmap; 444 SharedBitmap* shared_bitmap;
444 linked_ptr<GpuRasterBuffer> gpu_raster_buffer; 445 linked_ptr<GpuRasterBuffer> gpu_raster_buffer;
445 linked_ptr<ImageRasterBuffer> image_raster_buffer; 446 linked_ptr<ImageRasterBuffer> image_raster_buffer;
446 linked_ptr<PixelRasterBuffer> pixel_raster_buffer; 447 linked_ptr<PixelRasterBuffer> pixel_raster_buffer;
447 }; 448 };
448 typedef base::hash_map<ResourceId, Resource> ResourceMap; 449 typedef base::hash_map<ResourceId, Resource> ResourceMap;
449 450
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 return format_gl_data_format[format]; 702 return format_gl_data_format[format];
702 } 703 }
703 704
704 inline GLenum GLInternalFormat(ResourceFormat format) { 705 inline GLenum GLInternalFormat(ResourceFormat format) {
705 return GLDataFormat(format); 706 return GLDataFormat(format);
706 } 707 }
707 708
708 } // namespace cc 709 } // namespace cc
709 710
710 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 711 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698