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)) { |