| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 DCHECK(texture_mailbox.IsTexture()); | 641 DCHECK(texture_mailbox.IsTexture()); |
| 642 | 642 |
| 643 gfx::Rect result_rect(result->size()); | 643 gfx::Rect result_rect(result->size()); |
| 644 | 644 |
| 645 content::ReadbackYUVInterface* yuv_readback_pipeline = | 645 content::ReadbackYUVInterface* yuv_readback_pipeline = |
| 646 dfh->yuv_readback_pipeline_.get(); | 646 dfh->yuv_readback_pipeline_.get(); |
| 647 if (yuv_readback_pipeline == NULL || | 647 if (yuv_readback_pipeline == NULL || |
| 648 yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() || | 648 yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() || |
| 649 yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect || | 649 yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect || |
| 650 yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) { | 650 yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) { |
| 651 GLHelper::ScalerQuality quality = GLHelper::SCALER_QUALITY_FAST; | 651 dfh->yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV( |
| 652 std::string quality_switch = switches::kTabCaptureDownscaleQuality; | 652 result_rect.size(), result_rect, region_in_frame.size(), true, true)); |
| 653 // If we're scaling up, we can use the "best" quality. | |
| 654 if (result_rect.size().width() < region_in_frame.size().width() && | |
| 655 result_rect.size().height() < region_in_frame.size().height()) | |
| 656 quality_switch = switches::kTabCaptureUpscaleQuality; | |
| 657 | |
| 658 std::string switch_value = | |
| 659 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 660 quality_switch); | |
| 661 if (switch_value == "fast") | |
| 662 quality = GLHelper::SCALER_QUALITY_FAST; | |
| 663 else if (switch_value == "good") | |
| 664 quality = GLHelper::SCALER_QUALITY_GOOD; | |
| 665 else if (switch_value == "best") | |
| 666 quality = GLHelper::SCALER_QUALITY_BEST; | |
| 667 | |
| 668 dfh->yuv_readback_pipeline_.reset( | |
| 669 gl_helper->CreateReadbackPipelineYUV(quality, | |
| 670 result_rect.size(), | |
| 671 result_rect, | |
| 672 region_in_frame.size(), | |
| 673 true, | |
| 674 true)); | |
| 675 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); | 653 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); |
| 676 } | 654 } |
| 677 | 655 |
| 678 ignore_result(scoped_callback_runner.Release()); | 656 ignore_result(scoped_callback_runner.Release()); |
| 679 ignore_result(scoped_return_subscriber_texture.Release()); | 657 ignore_result(scoped_return_subscriber_texture.Release()); |
| 680 | 658 |
| 681 base::Callback<void(bool result)> finished_callback = base::Bind( | 659 base::Callback<void(bool result)> finished_callback = base::Bind( |
| 682 &DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo, | 660 &DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo, |
| 683 dfh->AsWeakPtr(), base::Bind(callback, region_in_frame), | 661 dfh->AsWeakPtr(), base::Bind(callback, region_in_frame), |
| 684 subscriber_texture, base::Passed(&release_callback)); | 662 subscriber_texture, base::Passed(&release_callback)); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 834 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 857 new_layer->SetShowSurface( | 835 new_layer->SetShowSurface( |
| 858 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 836 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 859 base::Bind(&RequireCallback, base::Unretained(manager)), | 837 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 860 current_surface_size_, current_scale_factor_, | 838 current_surface_size_, current_scale_factor_, |
| 861 current_frame_size_in_dip_); | 839 current_frame_size_in_dip_); |
| 862 } | 840 } |
| 863 } | 841 } |
| 864 | 842 |
| 865 } // namespace content | 843 } // namespace content |
| OLD | NEW |