OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <math.h> | 6 #include <math.h> |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 mvp_loc_(0), | 240 mvp_loc_(0), |
241 x_angle_(0), | 241 x_angle_(0), |
242 y_angle_(0), | 242 y_angle_(0), |
243 animating_(true) {} | 243 animating_(true) {} |
244 | 244 |
245 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) { | 245 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) { |
246 return true; | 246 return true; |
247 } | 247 } |
248 | 248 |
249 virtual void DidChangeView(const pp::View& view) { | 249 virtual void DidChangeView(const pp::View& view) { |
250 int32_t new_width = view.GetRect().width(); | 250 int32_t new_width = view.GetRect().width() * view.GetDeviceScale(); |
binji
2014/07/17 00:05:36
maybe a quick comment here?
Josh Horwich
2014/07/17 00:46:13
Done. WDYT?
| |
251 int32_t new_height = view.GetRect().height(); | 251 int32_t new_height = view.GetRect().height() * view.GetDeviceScale(); |
252 | 252 |
253 if (context_.is_null()) { | 253 if (context_.is_null()) { |
254 if (!InitGL(new_width, new_height)) { | 254 if (!InitGL(new_width, new_height)) { |
255 // failed. | 255 // failed. |
256 return; | 256 return; |
257 } | 257 } |
258 | 258 |
259 InitShaders(); | 259 InitShaders(); |
260 InitBuffers(); | 260 InitBuffers(); |
261 InitTexture(); | 261 InitTexture(); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 virtual ~Graphics3DModule() {} | 497 virtual ~Graphics3DModule() {} |
498 | 498 |
499 virtual pp::Instance* CreateInstance(PP_Instance instance) { | 499 virtual pp::Instance* CreateInstance(PP_Instance instance) { |
500 return new Graphics3DInstance(instance); | 500 return new Graphics3DInstance(instance); |
501 } | 501 } |
502 }; | 502 }; |
503 | 503 |
504 namespace pp { | 504 namespace pp { |
505 Module* CreateModule() { return new Graphics3DModule(); } | 505 Module* CreateModule() { return new Graphics3DModule(); } |
506 } // namespace pp | 506 } // namespace pp |
OLD | NEW |