Commit 4aafebd3 authored by hshi@chromium.org's avatar hshi@chromium.org

Prevent upscaling in desktop capture.

The previous CL landed (r238359) is missing a size check to prevent upscaling
in desktop capture. The correct logic should be to use native resolution
if both maxWidth and maxHeight are no smaller than source dimensions, and
to compute letterbox region if otherwise.

BUG=324923
TEST=trybot, Chrome OS feedback screen captures in native resolution
R=sergeyu@chromium.org
TBR=wjia@chromium.org

Review URL: https://codereview.chromium.org/103253003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238514 0039d316-1c4b-4281-b951-d872f2087c98
parent 4b6e4a9e
...@@ -138,10 +138,16 @@ void ThreadSafeCaptureOracle::UpdateCaptureSize(const gfx::Size& source_size) { ...@@ -138,10 +138,16 @@ void ThreadSafeCaptureOracle::UpdateCaptureSize(const gfx::Size& source_size) {
if (!capture_size_updated_ || params_.allow_resolution_change) { if (!capture_size_updated_ || params_.allow_resolution_change) {
// The capture resolution should not exceed the source frame size. // The capture resolution should not exceed the source frame size.
// In other words it should downscale the image but not upscale it. // In other words it should downscale the image but not upscale it.
if (source_size.width() > params_.requested_format.frame_size.width() ||
source_size.height() > params_.requested_format.frame_size.height()) {
gfx::Rect capture_rect = media::ComputeLetterboxRegion( gfx::Rect capture_rect = media::ComputeLetterboxRegion(
gfx::Rect(params_.requested_format.frame_size), source_size); gfx::Rect(params_.requested_format.frame_size), source_size);
capture_size_ = gfx::Size(MakeEven(capture_rect.width()), capture_size_ = gfx::Size(MakeEven(capture_rect.width()),
MakeEven(capture_rect.height())); MakeEven(capture_rect.height()));
} else {
capture_size_ = gfx::Size(MakeEven(source_size.width()),
MakeEven(source_size.height()));
}
capture_size_updated_ = true; capture_size_updated_ = true;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment