Commit 58c9998e authored by jhorwich@chromium.org's avatar jhorwich@chromium.org

NaCl SDK: Demonstrate use of pp::View::GetDeviceScale for 3D

Demonstrate in the NaCl SDK API demo for pp::Graphics3D how to
use full device resolution on HiDPI displays. For Graphics3D it
is simply a matter of sizing the texture in device pixels, by
multiplying the width/height by view.GetDeviceScale().

BUG=196253
TEST=Build NaCl SDK, run with --force-device-scale-factor=2

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283952 0039d316-1c4b-4281-b951-d872f2087c98
parent ec927b35
......@@ -247,8 +247,11 @@ class Graphics3DInstance : public pp::Instance {
}
virtual void DidChangeView(const pp::View& view) {
int32_t new_width = view.GetRect().width();
int32_t new_height = view.GetRect().height();
// Pepper specifies dimensions in DIPs (device-independent pixels). To
// generate a context that is at device-pixel resolution on HiDPI devices,
// scale the dimensions by view.GetDeviceScale().
int32_t new_width = view.GetRect().width() * view.GetDeviceScale();
int32_t new_height = view.GetRect().height() * view.GetDeviceScale();
if (context_.is_null()) {
if (!InitGL(new_width, new_height)) {
......
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