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..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()); |