 Chromium Code Reviews
 Chromium Code Reviews Issue 21159007:
  cc: Adding support for RGBA_4444 tile textures  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 21159007:
  cc: Adding support for RGBA_4444 tile textures  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: cc/resources/resource_provider.h | 
| diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h | 
| index e2d7878415d333e2f059e7984cd849337163a2cf..42dd0bbeb406485edb9df95d4cd8e967d8e0f303 100644 | 
| --- a/cc/resources/resource_provider.h | 
| +++ b/cc/resources/resource_provider.h | 
| @@ -52,6 +52,12 @@ class CC_EXPORT ResourceProvider { | 
| GLTexture = 1, | 
| Bitmap, | 
| }; | 
| + enum Format { | 
| + RGBA_8888, | 
| + RGBA_4444, | 
| + BGRA_8888, | 
| + LUMINANCE_8, | 
| + }; | 
| static scoped_ptr<ResourceProvider> Create(OutputSurface* output_surface, | 
| int highp_threshold_min); | 
| @@ -64,7 +70,7 @@ class CC_EXPORT ResourceProvider { | 
| void DidLoseOutputSurface() { lost_output_surface_ = true; } | 
| int max_texture_size() const { return max_texture_size_; } | 
| - GLenum best_texture_format() const { return best_texture_format_; } | 
| + Format best_texture_format() const { return best_texture_format_; } | 
| size_t num_resources() const { return resources_.size(); } | 
| // Checks whether a resource is in use by a consumer. | 
| @@ -78,23 +84,23 @@ class CC_EXPORT ResourceProvider { | 
| // Creates a resource of the default resource type. | 
| ResourceId CreateResource(gfx::Size size, | 
| - GLenum format, | 
| GLint wrap_mode, | 
| - TextureUsageHint hint); | 
| + TextureUsageHint hint, | 
| + Format texture_format); | 
| // Creates a resource which is tagged as being managed for GPU memory | 
| // accounting purposes. | 
| ResourceId CreateManagedResource(gfx::Size size, | 
| - GLenum format, | 
| GLint wrap_mode, | 
| - TextureUsageHint hint); | 
| + TextureUsageHint hint, | 
| + Format texture_format); | 
| // You can also explicitly create a specific resource type. | 
| ResourceId CreateGLTexture(gfx::Size size, | 
| - GLenum format, | 
| GLenum texture_pool, | 
| GLint wrap_mode, | 
| - TextureUsageHint hint); | 
| + TextureUsageHint hint, | 
| + Format texture_format); | 
| ResourceId CreateBitmap(gfx::Size size); | 
| // Wraps an external texture into a GL resource. | 
| @@ -330,6 +336,11 @@ class CC_EXPORT ResourceProvider { | 
| bool CanLockForWrite(ResourceId id); | 
| static GLint GetActiveTextureUnit(WebKit::WebGraphicsContext3D* context); | 
| + static size_t BytesPerPixel(Format type); | 
| + static GLenum GetGLDataType(Format format); | 
| + static GLenum GetGLDataFormat(Format format); | 
| + static GLenum GetGLInternalFormat(Format format); | 
| + static unsigned GetStride(Format format); | 
| 
piman
2013/09/13 01:42:01
What does this represent, and how is it related to
 
kaanb
2013/09/13 03:43:56
It is used by the TextureUploader to decide what v
 
piman
2013/09/13 04:56:51
GetStrideAlignment?
Please add a comment about wha
 
kaanb
2013/09/13 19:57:39
Removed.
 | 
| private: | 
| struct Resource { | 
| @@ -337,14 +348,13 @@ class CC_EXPORT ResourceProvider { | 
| ~Resource(); | 
| Resource(unsigned texture_id, | 
| gfx::Size size, | 
| - GLenum format, | 
| GLenum filter, | 
| GLenum texture_pool, | 
| GLint wrap_mode, | 
| - TextureUsageHint hint); | 
| + TextureUsageHint hint, | 
| + Format texture_format); | 
| Resource(uint8_t* pixels, | 
| gfx::Size size, | 
| - GLenum format, | 
| GLenum filter, | 
| GLint wrap_mode); | 
| @@ -368,7 +378,6 @@ class CC_EXPORT ResourceProvider { | 
| bool enable_read_lock_fences; | 
| scoped_refptr<Fence> read_lock_fence; | 
| gfx::Size size; | 
| - GLenum format; | 
| // TODO(skyostil): Use a separate sampler object for filter state. | 
| GLenum filter; | 
| unsigned image_id; | 
| @@ -376,6 +385,7 @@ class CC_EXPORT ResourceProvider { | 
| GLint wrap_mode; | 
| TextureUsageHint hint; | 
| ResourceType type; | 
| + Format texture_format; | 
| 
reveman
2013/09/13 14:32:49
just "Format format;" as it doesn't just apply to
 
kaanb
2013/09/13 19:57:39
Done.
 | 
| }; | 
| typedef base::hash_map<ResourceId, Resource> ResourceMap; | 
| struct Child { | 
| @@ -392,8 +402,8 @@ class CC_EXPORT ResourceProvider { | 
| resource->read_lock_fence->HasPassed(); | 
| } | 
| - explicit ResourceProvider(OutputSurface* output_surface, | 
| - int highp_threshold_min); | 
| + ResourceProvider(OutputSurface* output_surface, | 
| + int highp_threshold_min); | 
| void CleanUpGLIfNeeded(); | 
| @@ -444,7 +454,7 @@ class CC_EXPORT ResourceProvider { | 
| bool use_shallow_flush_; | 
| scoped_ptr<TextureUploader> texture_uploader_; | 
| int max_texture_size_; | 
| - GLenum best_texture_format_; | 
| + Format best_texture_format_; | 
| base::ThreadChecker thread_checker_; |