diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-18 23:17:52 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-18 23:17:52 +0000 |
commit | 71fe6e32f886f32c8b4ac5660606f04ad5b01903 (patch) | |
tree | b8025e8d81e056cea425d1f62566eb5bfe3cebbb /remoting/base/decoder_vp8.cc | |
parent | 628fa37cbdd3a14b358358b3f364cda81bcee41b (diff) | |
download | chromium_src-71fe6e32f886f32c8b4ac5660606f04ad5b01903.zip chromium_src-71fe6e32f886f32c8b4ac5660606f04ad5b01903.tar.gz chromium_src-71fe6e32f886f32c8b4ac5660606f04ad5b01903.tar.bz2 |
Allow the Chromoting client plugin to support up-scaling, albeit slowly.
BUG=116138
Review URL: https://chromiumcodereview.appspot.com/9568048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/decoder_vp8.cc')
-rw-r--r-- | remoting/base/decoder_vp8.cc | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/remoting/base/decoder_vp8.cc b/remoting/base/decoder_vp8.cc index 03d1d0e..85edb23 100644 --- a/remoting/base/decoder_vp8.cc +++ b/remoting/base/decoder_vp8.cc @@ -133,12 +133,43 @@ void DecoderVp8::RenderFrame(const SkISize& view_size, SkIRect source_clip = SkIRect::MakeWH(last_image_->d_w, last_image_->d_h); - // ScaleYUVToRGB32WithRect doesn't support up-scaling, and our web-app never - // intentionally up-scales, so if we see up-scaling (e.g. during host resize - // or if the user applies page zoom) just don't render anything. - // TODO(wez): Remove this hack when ScaleYUVToRGB32WithRect can up-scale. - if (source_clip.width() < view_size.width() || - source_clip.height() < view_size.height()) { + // ScaleYUVToRGB32WithRect does not currently support up-scaling. We won't + // be asked to up-scale except during resizes or if page zoom is >100%, so + // we work-around the limitation by using the slower ScaleYUVToRGB32. + // TODO(wez): Remove this hack if/when ScaleYUVToRGB32WithRect can up-scale. + if (!updated_region_.isEmpty() && + (source_clip.width() < view_size.width() || + source_clip.height() < view_size.height())) { + // We're scaling only |clip_area| into the |image_buffer|, so we need to + // work out which source rectangle that corresponds to. + SkIRect source_rect = ScaleRect(clip_area, view_size, screen_size_); + source_rect = SkIRect::MakeLTRB(RoundToTwosMultiple(source_rect.left()), + RoundToTwosMultiple(source_rect.top()), + source_rect.right(), + source_rect.bottom()); + int y_offset = CalculateYOffset(source_rect.x(), + source_rect.y(), + last_image_->stride[0]); + int uv_offset = CalculateUVOffset(source_rect.x(), + source_rect.y(), + last_image_->stride[1]); + ScaleYUVToRGB32(last_image_->planes[0] + y_offset, + last_image_->planes[1] + uv_offset, + last_image_->planes[2] + uv_offset, + image_buffer, + source_rect.width(), + source_rect.height(), + clip_area.width(), + clip_area.height(), + last_image_->stride[0], + last_image_->stride[1], + image_stride, + media::YV12, + media::ROTATE_0, + media::FILTER_BILINEAR); + + output_region->op(clip_area, SkRegion::kUnion_Op); + updated_region_.op(source_rect, SkRegion::kDifference_Op); return; } |