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

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: Created 6 years 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: 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..bc48b335cf334752287000460af88f7ed7dd4f46 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -611,6 +611,17 @@ static void CopyFromCompositingSurfaceFinished(
result ? content::READBACK_SUCCESS : content::READBACK_FAILED);
}
+//// static
danakj 2015/01/06 16:16:19 just one // is enough
sivag 2015/01/07 09:33:32 Done.
+bool DelegatedFrameHost::IsReadbackConfigSupported(SkColorType color_type) {
+ ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
+ GLHelper* gl_helper = factory->GetGLHelper();
+ if (!gl_helper)
+ return false;
+ if (!gl_helper->IsReadbackConfigSupported(color_type))
+ return false;
+ return true;
+}
+
// static
void DelegatedFrameHost::PrepareTextureCopyOutputResult(
const gfx::Size& dst_size_in_pixel,
@@ -618,12 +629,13 @@ void DelegatedFrameHost::PrepareTextureCopyOutputResult(
ReadbackRequestCallback& callback,
scoped_ptr<cc::CopyOutputResult> result) {
DCHECK(result->HasTexture());
+
+ if (!IsReadbackConfigSupported(color_type))
danakj 2015/01/06 16:16:19 This makes us GetGLHelper() twice, IWBN to only ca
sivag 2015/01/07 09:33:32 Done.
+ callback.Run(SkBitmap(), content::READBACK_FORMAT_NOT_SUPPORTED);
+
base::ScopedClosureRunner scoped_callback_runner(
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(),
« no previous file with comments | « content/browser/compositor/delegated_frame_host.h ('k') | content/common/gpu/client/gl_helper_readback_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698