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

Unified Diff: content/browser/compositor/delegated_frame_host.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: Use single glhelper call. Created 5 years, 11 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 | « no previous file | content/common/gpu/client/gl_helper_readback_support.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/delegated_frame_host.cc
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
index e09c38ebc6589ccc1ec5a9ef82e6bc7703ce974a..91a2d07acf3bc4c7a2dbce62bbb1046b1afd812f 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -618,12 +618,20 @@ void DelegatedFrameHost::PrepareTextureCopyOutputResult(
ReadbackRequestCallback& callback,
scoped_ptr<cc::CopyOutputResult> result) {
DCHECK(result->HasTexture());
danakj 2015/01/08 05:56:31 Nit: blank line between dcheck and code
sivag 2015/01/08 11:03:31 Done.
+ ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
+ GLHelper* gl_helper = factory->GetGLHelper();
+ if (!gl_helper) {
+ callback.Run(SkBitmap(), content::READBACK_FAILED);
+ return;
+ }
+ if (!gl_helper->IsReadbackConfigSupported(color_type)) {
+ callback.Run(SkBitmap(), content::READBACK_FORMAT_NOT_SUPPORTED);
+ return;
+ }
+
base::ScopedClosureRunner scoped_callback_runner(
danakj 2015/01/08 05:56:31 Maybe move this to the top of the function, and ju
sivag 2015/01/08 11:03:31 Done.
base::Bind(callback, SkBitmap(), content::READBACK_FAILED));
- // TODO(sikugu): We should be able to validate the format here using
- // GLHelper::IsReadbackConfigSupported before we processs the result.
- // See crbug.com/415682.
scoped_ptr<SkBitmap> bitmap(new SkBitmap);
if (!bitmap->tryAllocPixels(SkImageInfo::Make(dst_size_in_pixel.width(),
dst_size_in_pixel.height(),
@@ -631,11 +639,6 @@ void DelegatedFrameHost::PrepareTextureCopyOutputResult(
kOpaque_SkAlphaType)))
return;
- ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
- GLHelper* gl_helper = factory->GetGLHelper();
- if (!gl_helper)
- return;
-
scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock(
new SkAutoLockPixels(*bitmap));
uint8* pixels = static_cast<uint8*>(bitmap->getPixels());
« no previous file with comments | « no previous file | content/common/gpu/client/gl_helper_readback_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698