Chromium Code Reviews| 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(), |