Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: native_client_sdk/src/examples/api/graphics_3d/graphics_3d.cc

Issue 398943003: NaCl SDK: Demonstrate use of pp::View::GetDeviceScale for 3D (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/examples/api/graphics_3d/graphics_3d.cc
diff --git a/native_client_sdk/src/examples/api/graphics_3d/graphics_3d.cc b/native_client_sdk/src/examples/api/graphics_3d/graphics_3d.cc
index abe5aec3a13252a8cb29f808703a829fddea56d5..0777cb889f6e8826c498a0ff02b1d07f87f62b5f 100644
--- a/native_client_sdk/src/examples/api/graphics_3d/graphics_3d.cc
+++ b/native_client_sdk/src/examples/api/graphics_3d/graphics_3d.cc
@@ -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)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698