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

Unified Diff: cc/resources/resource_provider.h

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and feedback Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: cc/resources/resource_provider.h
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index e2d7878415d333e2f059e7984cd849337163a2cf..bfee0490ebb9b68e543ff049e5c89f6b0d4e3631 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 TextureType {
+ INVALID_TYPE,
reveman 2013/09/11 20:19:13 Do we need INVALID_TYPE? It's easier to maintain a
kaanb 2013/09/12 07:53:44 There were cases where 0 was being used as the GL
+ RGBA_8888,
+ RGBA_4444,
+ BGRA_8888,
+ };
static scoped_ptr<ResourceProvider> Create(OutputSurface* output_surface,
int highp_threshold_min);
@@ -80,21 +86,24 @@ class CC_EXPORT ResourceProvider {
ResourceId CreateResource(gfx::Size size,
GLenum format,
GLint wrap_mode,
- TextureUsageHint hint);
+ TextureUsageHint hint,
+ TextureType texture_type);
epennerAtGoogle 2013/09/11 19:21:04 This is nice, IMO :)
reveman 2013/09/11 20:19:13 Could the enum type be TextureFormat instead and r
kaanb 2013/09/12 07:53:44 Done.
// 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,
+ TextureType texture_type);
// 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,
+ TextureType texture_type);
ResourceId CreateBitmap(gfx::Size size);
// Wraps an external texture into a GL resource.
@@ -330,6 +339,8 @@ class CC_EXPORT ResourceProvider {
bool CanLockForWrite(ResourceId id);
static GLint GetActiveTextureUnit(WebKit::WebGraphicsContext3D* context);
+ static size_t BytesPerPixel(GLenum format, TextureType type);
+ static GLenum GetTextureDataType(GLenum texture_type);
epennerAtGoogle 2013/09/11 19:21:04 Could we call this GetGLTextureType, and also add
reveman 2013/09/11 20:19:13 Yes, something like the following set of helper fu
kaanb 2013/09/12 07:53:44 Done.
private:
struct Resource {
@@ -341,7 +352,8 @@ class CC_EXPORT ResourceProvider {
GLenum filter,
GLenum texture_pool,
GLint wrap_mode,
- TextureUsageHint hint);
+ TextureUsageHint hint,
+ TextureType texture_type);
Resource(uint8_t* pixels,
gfx::Size size,
GLenum format,
@@ -376,6 +388,7 @@ class CC_EXPORT ResourceProvider {
GLint wrap_mode;
TextureUsageHint hint;
ResourceType type;
+ TextureType texture_type;
};
typedef base::hash_map<ResourceId, Resource> ResourceMap;
struct Child {
@@ -392,8 +405,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();

Powered by Google App Engine
This is Rietveld 408576698