summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-18 23:59:43 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-18 23:59:43 +0000
commit000e813669b0e71f632e4421d3523623ef13dd82 (patch)
treeb1d54338d13cd076a75f38df20bb5eff4f1bb9e1 /remoting
parent3487c168ab4630641e5ddf19a63e14ace37e3986 (diff)
downloadchromium_src-000e813669b0e71f632e4421d3523623ef13dd82.zip
chromium_src-000e813669b0e71f632e4421d3523623ef13dd82.tar.gz
chromium_src-000e813669b0e71f632e4421d3523623ef13dd82.tar.bz2
Fix PepperView to let PPAPI up-scale on high-DPI devices where possible.
Previously PepperView would always render at device resolution, requiring the Chromoting video decode pipeline to up- or down-scale as necessary. This CL lets PPAPI up-scale for high-DPI if the plugin's logical dimensions match those of the source, both reducing Chromoting's rendering overhead in and improving output quality for this case. BUG=163228 TEST=Connect to a host from a high-DPI client and verify that monochrome, un-anti-aliased text displayed at the host is lovely and crisp and readable. Review URL: https://chromiumcodereview.appspot.com/11570058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173807 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/client/plugin/pepper_view.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc
index ac95e73..764f0a4 100644
--- a/remoting/client/plugin/pepper_view.cc
+++ b/remoting/client/plugin/pepper_view.cc
@@ -82,16 +82,29 @@ void PepperView::SetView(const pp::View& view) {
view_changed = true;
view_scale_ = new_scale;
view_size_dips_ = new_size_dips;
- view_size_ = SkISize::Make(ceilf(view_size_dips_.width() * view_scale_),
- ceilf(view_size_dips_.height() * view_scale_));
+ // If |view_scale_| is > 1.0 then the device is high-DPI, and there are
+ // actually |view_scale_| physical pixels for every one Density Independent
+ // Pixel (DIP). If we specify a scale of 1.0 to Graphics2D then we can
+ // render at DIP resolution and let PPAPI up-scale for high-DPI devices.
+ // Note that |view_scale_| is DIPS->pixels, |scale| is pixels->DIPS.
+ float scale = 1.0f;
+ view_size_ = view_size_dips_;
+
+ // If the view's DIP dimensions don't match the source then let the frame
+ // producer do the scaling, and render at device resolution.
+ if (view_size_dips_ != source_size_) {
+ scale = 1.0f / view_scale_;
+ view_size_ = SkISize::Make(ceilf(view_size_dips_.width() * view_scale_),
+ ceilf(view_size_dips_.height() * view_scale_));
+ }
+
+ // Create a 2D rendering context at the chosen frame dimensions.
pp::Size pp_size = pp::Size(view_size_.width(), view_size_.height());
graphics2d_ = pp::Graphics2D(instance_, pp_size, true);
- // Ideally we would always let Graphics2D scale us, but the output quality
- // is lousy, so we don't.
pp::Graphics2D_Dev graphics2d_dev(graphics2d_);
- graphics2d_dev.SetScale(1.0f / view_scale_);
+ graphics2d_dev.SetScale(scale);
bool result = instance_->BindGraphics(graphics2d_);