OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/compositor/delegated_frame_host.h" | 5 #include "content/browser/compositor/delegated_frame_host.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 // static | 567 // static |
568 void DelegatedFrameHost::PrepareTextureCopyOutputResult( | 568 void DelegatedFrameHost::PrepareTextureCopyOutputResult( |
569 const gfx::Size& dst_size_in_pixel, | 569 const gfx::Size& dst_size_in_pixel, |
570 const SkColorType color_type, | 570 const SkColorType color_type, |
571 const base::Callback<void(bool, const SkBitmap&)>& callback, | 571 const base::Callback<void(bool, const SkBitmap&)>& callback, |
572 scoped_ptr<cc::CopyOutputResult> result) { | 572 scoped_ptr<cc::CopyOutputResult> result) { |
573 DCHECK(result->HasTexture()); | 573 DCHECK(result->HasTexture()); |
574 base::ScopedClosureRunner scoped_callback_runner( | 574 base::ScopedClosureRunner scoped_callback_runner( |
575 base::Bind(callback, false, SkBitmap())); | 575 base::Bind(callback, false, SkBitmap())); |
576 | 576 |
| 577 // TODO(sikugu): We should be able to validate the format here using |
| 578 // GLHelper::IsReadbackConfigSupported before we processs the result. |
| 579 // See crbug.com/415682. |
577 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 580 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
578 if (!bitmap->tryAllocPixels(SkImageInfo::Make(dst_size_in_pixel.width(), | 581 if (!bitmap->tryAllocPixels(SkImageInfo::Make(dst_size_in_pixel.width(), |
579 dst_size_in_pixel.height(), | 582 dst_size_in_pixel.height(), |
580 color_type, | 583 color_type, |
581 kOpaque_SkAlphaType))) | 584 kOpaque_SkAlphaType))) |
582 return; | 585 return; |
583 | 586 |
584 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 587 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
585 GLHelper* gl_helper = factory->GetGLHelper(); | 588 GLHelper* gl_helper = factory->GetGLHelper(); |
586 if (!gl_helper) | 589 if (!gl_helper) |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 if (frame_provider_.get()) { | 979 if (frame_provider_.get()) { |
977 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 980 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
978 current_frame_size_in_dip_); | 981 current_frame_size_in_dip_); |
979 } | 982 } |
980 if (!surface_id_.is_null()) { | 983 if (!surface_id_.is_null()) { |
981 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); | 984 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); |
982 } | 985 } |
983 } | 986 } |
984 | 987 |
985 } // namespace content | 988 } // namespace content |
OLD | NEW |