| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 DCHECK(texture_mailbox.IsTexture()); | 689 DCHECK(texture_mailbox.IsTexture()); |
| 690 | 690 |
| 691 gfx::Rect result_rect(result->size()); | 691 gfx::Rect result_rect(result->size()); |
| 692 | 692 |
| 693 content::ReadbackYUVInterface* yuv_readback_pipeline = | 693 content::ReadbackYUVInterface* yuv_readback_pipeline = |
| 694 dfh->yuv_readback_pipeline_.get(); | 694 dfh->yuv_readback_pipeline_.get(); |
| 695 if (yuv_readback_pipeline == NULL || | 695 if (yuv_readback_pipeline == NULL || |
| 696 yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() || | 696 yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() || |
| 697 yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect || | 697 yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect || |
| 698 yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) { | 698 yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) { |
| 699 GLHelper::ScalerQuality quality = GLHelper::SCALER_QUALITY_FAST; | 699 dfh->yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV( |
| 700 std::string quality_switch = switches::kTabCaptureDownscaleQuality; | 700 result_rect.size(), result_rect, region_in_frame.size(), true, true)); |
| 701 // If we're scaling up, we can use the "best" quality. | |
| 702 if (result_rect.size().width() < region_in_frame.size().width() && | |
| 703 result_rect.size().height() < region_in_frame.size().height()) | |
| 704 quality_switch = switches::kTabCaptureUpscaleQuality; | |
| 705 | |
| 706 std::string switch_value = | |
| 707 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 708 quality_switch); | |
| 709 if (switch_value == "fast") | |
| 710 quality = GLHelper::SCALER_QUALITY_FAST; | |
| 711 else if (switch_value == "good") | |
| 712 quality = GLHelper::SCALER_QUALITY_GOOD; | |
| 713 else if (switch_value == "best") | |
| 714 quality = GLHelper::SCALER_QUALITY_BEST; | |
| 715 | |
| 716 dfh->yuv_readback_pipeline_.reset( | |
| 717 gl_helper->CreateReadbackPipelineYUV(quality, | |
| 718 result_rect.size(), | |
| 719 result_rect, | |
| 720 region_in_frame.size(), | |
| 721 true, | |
| 722 true)); | |
| 723 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); | 701 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); |
| 724 } | 702 } |
| 725 | 703 |
| 726 ignore_result(scoped_callback_runner.Release()); | 704 ignore_result(scoped_callback_runner.Release()); |
| 727 ignore_result(scoped_return_subscriber_texture.Release()); | 705 ignore_result(scoped_return_subscriber_texture.Release()); |
| 728 | 706 |
| 729 base::Callback<void(bool result)> finished_callback = base::Bind( | 707 base::Callback<void(bool result)> finished_callback = base::Bind( |
| 730 &DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo, | 708 &DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo, |
| 731 dfh->AsWeakPtr(), base::Bind(callback, region_in_frame), | 709 dfh->AsWeakPtr(), base::Bind(callback, region_in_frame), |
| 732 subscriber_texture, base::Passed(&release_callback)); | 710 subscriber_texture, base::Passed(&release_callback)); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 876 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 899 new_layer->SetShowSurface( | 877 new_layer->SetShowSurface( |
| 900 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 878 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 901 base::Bind(&RequireCallback, base::Unretained(manager)), | 879 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 902 current_surface_size_, current_scale_factor_, | 880 current_surface_size_, current_scale_factor_, |
| 903 current_frame_size_in_dip_); | 881 current_frame_size_in_dip_); |
| 904 } | 882 } |
| 905 } | 883 } |
| 906 | 884 |
| 907 } // namespace content | 885 } // namespace content |
| OLD | NEW |