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

Unified Diff: cc/resources/resource_provider.cc

Issue 2748903002: cc: Add gfx::BufferFormat to cc::ResourceProvider::Resource. (Closed)
Patch Set: Always initialize buffer_format. Created 3 years, 9 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
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/transferable_resource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 18e9bbd607ddbd66c86a3edd7e0abb0995c937f2..39017b45ed29d493a0bf96da19debfc909b59319 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -256,6 +256,7 @@ ResourceProvider::Resource::Resource(GLuint texture_id,
hint(hint),
type(type),
usage(gfx::BufferUsage::GPU_READ_CPU_READ_WRITE),
+ buffer_format(gfx::BufferFormat::RGBA_8888),
format(format),
shared_bitmap(nullptr) {
}
@@ -296,6 +297,7 @@ ResourceProvider::Resource::Resource(uint8_t* pixels,
bound_image_id(0),
hint(TEXTURE_HINT_IMMUTABLE),
type(RESOURCE_TYPE_BITMAP),
+ buffer_format(gfx::BufferFormat::RGBA_8888),
format(RGBA_8888),
shared_bitmap(bitmap) {
DCHECK(origin == DELEGATED || pixels);
@@ -338,6 +340,7 @@ ResourceProvider::Resource::Resource(const SharedBitmapId& bitmap_id,
bound_image_id(0),
hint(TEXTURE_HINT_IMMUTABLE),
type(RESOURCE_TYPE_BITMAP),
+ buffer_format(gfx::BufferFormat::RGBA_8888),
format(RGBA_8888),
shared_bitmap_id(bitmap_id),
shared_bitmap(nullptr) {
@@ -1103,6 +1106,11 @@ bool ResourceProvider::IsOverlayCandidate(ResourceId id) {
return resource->is_overlay_candidate;
}
+gfx::BufferFormat ResourceProvider::GetBufferFormat(ResourceId id) {
+ Resource* resource = GetResource(id);
+ return resource->buffer_format;
+}
+
#if defined(OS_ANDROID)
bool ResourceProvider::IsBackedBySurfaceTexture(ResourceId id) {
Resource* resource = GetResource(id);
@@ -1600,6 +1608,7 @@ void ResourceProvider::ReceiveFromChild(
it->mailbox_holder.texture_target, it->filter,
TEXTURE_HINT_IMMUTABLE, RESOURCE_TYPE_GL_TEXTURE,
it->format));
+ resource->buffer_format = it->buffer_format;
resource->set_mailbox(TextureMailbox(it->mailbox_holder.mailbox,
it->mailbox_holder.sync_token,
it->mailbox_holder.texture_target));
@@ -1765,6 +1774,7 @@ void ResourceProvider::TransferResource(Resource* source,
DCHECK(source->allocated);
resource->id = id;
resource->format = source->format;
+ resource->buffer_format = source->buffer_format;
resource->mailbox_holder.texture_target = source->target;
resource->filter = source->filter;
resource->size = source->size;
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/transferable_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698