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

Unified Diff: cc/resources/resource_provider.cc

Issue 17859002: Allow WebExternalTextureLayers to receive a bitmap along with a mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index da90a4432b5aa099a9dabee688fe846cc0ad4e2f..ba196bffbe71e84ab76b795bbdb75585bc7ed743 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -275,7 +275,13 @@ ResourceProvider::ResourceId ResourceProvider::CreateResourceFromTextureMailbox(
ResourceId id = next_id_++;
DCHECK(mailbox.IsValid());
Resource& resource = resources_[id];
- if (mailbox.IsTexture()) {
+ if (mailbox.IsBitmap()) {
+ SkBitmap bitmap = mailbox.bitmap();
+ SkAutoLockPixels bitmapLock(bitmap);
tfarina 2013/06/26 16:27:38 minornit: bitmap_lock
+ uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap.getPixels());
+ resource = Resource(pixels, mailbox.shared_memory_size(),
+ GL_RGBA, GL_LINEAR);
+ } else if (mailbox.IsTexture()) {
resource = Resource(0, gfx::Size(), 0, GL_LINEAR, 0, TextureUsageAny);
} else {
DCHECK(mailbox.IsSharedMemory());
@@ -354,10 +360,11 @@ void ResourceProvider::DeleteResourceInternal(ResourceMap::iterator it,
if (!lost_resource && resource->gl_id)
sync_point = context3d->insertSyncPoint();
} else {
- DCHECK(resource->mailbox.IsSharedMemory());
+ DCHECK(resource->mailbox.IsSharedMemory() ||
+ resource->mailbox.IsBitmap());
base::SharedMemory* shared_memory = resource->mailbox.shared_memory();
- if (resource->pixels && shared_memory) {
- DCHECK(shared_memory->memory() == resource->pixels);
+ if (resource->pixels) {
+ DCHECK(!shared_memory || shared_memory->memory() == resource->pixels);
resource->pixels = NULL;
}
}

Powered by Google App Engine
This is Rietveld 408576698