| 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/renderer_host/delegated_frame_host.h" | 5 #include "content/browser/renderer_host/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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 DCHECK(texture_mailbox.IsTexture()); | 677 DCHECK(texture_mailbox.IsTexture()); |
| 678 | 678 |
| 679 gfx::Rect result_rect(result->size()); | 679 gfx::Rect result_rect(result->size()); |
| 680 | 680 |
| 681 content::ReadbackYUVInterface* yuv_readback_pipeline = | 681 content::ReadbackYUVInterface* yuv_readback_pipeline = |
| 682 dfh->yuv_readback_pipeline_.get(); | 682 dfh->yuv_readback_pipeline_.get(); |
| 683 if (yuv_readback_pipeline == NULL || | 683 if (yuv_readback_pipeline == NULL || |
| 684 yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() || | 684 yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() || |
| 685 yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect || | 685 yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect || |
| 686 yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) { | 686 yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) { |
| 687 GLHelper::ScalerQuality quality = GLHelper::SCALER_QUALITY_FAST; | |
| 688 std::string quality_switch = switches::kTabCaptureDownscaleQuality; | |
| 689 // If we're scaling up, we can use the "best" quality. | |
| 690 if (result_rect.size().width() < region_in_frame.size().width() && | |
| 691 result_rect.size().height() < region_in_frame.size().height()) | |
| 692 quality_switch = switches::kTabCaptureUpscaleQuality; | |
| 693 | |
| 694 std::string switch_value = | |
| 695 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 696 quality_switch); | |
| 697 if (switch_value == "fast") | |
| 698 quality = GLHelper::SCALER_QUALITY_FAST; | |
| 699 else if (switch_value == "good") | |
| 700 quality = GLHelper::SCALER_QUALITY_GOOD; | |
| 701 else if (switch_value == "best") | |
| 702 quality = GLHelper::SCALER_QUALITY_BEST; | |
| 703 | |
| 704 dfh->yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV( | 687 dfh->yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV( |
| 705 quality, result_rect.size(), result_rect, region_in_frame.size(), true, | 688 result_rect.size(), result_rect, region_in_frame.size(), true, true)); |
| 706 true)); | |
| 707 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); | 689 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); |
| 708 } | 690 } |
| 709 | 691 |
| 710 ignore_result(scoped_callback_runner.Release()); | 692 ignore_result(scoped_callback_runner.Release()); |
| 711 ignore_result(scoped_return_subscriber_texture.Release()); | 693 ignore_result(scoped_return_subscriber_texture.Release()); |
| 712 | 694 |
| 713 base::Callback<void(bool result)> finished_callback = base::Bind( | 695 base::Callback<void(bool result)> finished_callback = base::Bind( |
| 714 &DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo, | 696 &DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo, |
| 715 dfh->AsWeakPtr(), base::Bind(callback, region_in_frame), | 697 dfh->AsWeakPtr(), base::Bind(callback, region_in_frame), |
| 716 subscriber_texture, base::Passed(&release_callback)); | 698 subscriber_texture, base::Passed(&release_callback)); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 857 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 876 new_layer->SetShowSurface( | 858 new_layer->SetShowSurface( |
| 877 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 859 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 878 base::Bind(&RequireCallback, base::Unretained(manager)), | 860 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 879 current_surface_size_, current_scale_factor_, | 861 current_surface_size_, current_scale_factor_, |
| 880 current_frame_size_in_dip_); | 862 current_frame_size_in_dip_); |
| 881 } | 863 } |
| 882 } | 864 } |
| 883 | 865 |
| 884 } // namespace content | 866 } // namespace content |
| OLD | NEW |