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

Unified Diff: content/browser/compositor/surface_utils.cc

Issue 807853003: Use GLHelper support to validate format before processing texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « components/display_compositor/gl_helper_readback_support.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/surface_utils.cc
diff --git a/content/browser/compositor/surface_utils.cc b/content/browser/compositor/surface_utils.cc
index 9f79cb74b55a776b0de5a845d1932e3f4659a6f7..9a2e66239338e94267963ad00957360a251a25fa 100644
--- a/content/browser/compositor/surface_utils.cc
+++ b/content/browser/compositor/surface_utils.cc
@@ -68,10 +68,14 @@ void PrepareTextureCopyOutputResult(
DCHECK(result->HasTexture());
base::ScopedClosureRunner scoped_callback_runner(
base::Bind(callback, SkBitmap(), content::READBACK_FAILED));
+ content::ImageTransportFactory* factory =
+ content::ImageTransportFactory::GetInstance();
+ display_compositor::GLHelper* gl_helper = factory->GetGLHelper();
+ if (!gl_helper)
+ return;
+ if(!gl_helper->IsReadbackConfigSupported(color_type))
+ return;
- // TODO(siva.gunturi): We should be able to validate the format here using
- // GLHelper::IsReadbackConfigSupported before we processs the result.
- // See crbug.com/415682 and crbug.com/415131.
std::unique_ptr<SkBitmap> bitmap(new SkBitmap);
if (!bitmap->tryAllocPixels(SkImageInfo::Make(
dst_size_in_pixel.width(), dst_size_in_pixel.height(), color_type,
@@ -81,12 +85,6 @@ void PrepareTextureCopyOutputResult(
return;
}
- content::ImageTransportFactory* factory =
- content::ImageTransportFactory::GetInstance();
- display_compositor::GLHelper* gl_helper = factory->GetGLHelper();
- if (!gl_helper)
- return;
-
std::unique_ptr<SkAutoLockPixels> bitmap_pixels_lock(
new SkAutoLockPixels(*bitmap));
uint8_t* pixels = static_cast<uint8_t*>(bitmap->getPixels());
« no previous file with comments | « components/display_compositor/gl_helper_readback_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698