| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "embedders/openglui/emulator/emulator_graphics_handler.h" | 5 #include "embedders/openglui/emulator/emulator_graphics_handler.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 EmulatorGraphicsHandler::EmulatorGraphicsHandler(int argc, | 10 EmulatorGraphicsHandler::EmulatorGraphicsHandler(int argc, |
| 11 char** argv) | 11 char** argv) |
| 12 : GraphicsHandler(".") { | 12 : GraphicsHandler(".") { |
| 13 glutInit(&argc, argv); | 13 glutInit(&argc, argv); |
| 14 SetViewport(0, 0, 480, 800); | 14 width_ = 800; |
| 15 height_ = 480; |
| 15 for (int i = 1; i < argc; i++) { | 16 for (int i = 1; i < argc; i++) { |
| 16 if (argv[i][0] == '-') { | 17 if (argv[i][0] == '-') { |
| 17 int next_arg = i + 1; | 18 int next_arg = i + 1; |
| 18 if (next_arg < argc && strcmp(argv[i], "-w") == 0) { | 19 if (next_arg < argc && strcmp(argv[i], "-w") == 0) { |
| 19 width_ = static_cast<size_t>(atoi(argv[i = next_arg])); | 20 width_ = static_cast<size_t>(atoi(argv[i = next_arg])); |
| 20 } else if (next_arg < argc && strcmp(argv[i], "-h") == 0) { | 21 } else if (next_arg < argc && strcmp(argv[i], "-h") == 0) { |
| 21 height_ = static_cast<size_t>(atoi(argv[i = next_arg])); | 22 height_ = static_cast<size_t>(atoi(argv[i = next_arg])); |
| 22 } | 23 } |
| 23 } | 24 } |
| 24 } | 25 } |
| 26 SetViewport(0, 0, width_, height_); |
| 25 glutInitWindowSize(width_, height_); | 27 glutInitWindowSize(width_, height_); |
| 26 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); | 28 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); |
| 27 glutCreateWindow("Dart"); | 29 glutCreateWindow("Dart"); |
| 28 } | 30 } |
| 29 | 31 |
| 30 int32_t EmulatorGraphicsHandler::Start() { | 32 int32_t EmulatorGraphicsHandler::Start() { |
| 31 return GraphicsHandler::Start(); | 33 return GraphicsHandler::Start(); |
| 32 } | 34 } |
| 33 | 35 |
| 34 void EmulatorGraphicsHandler::Stop() { | 36 void EmulatorGraphicsHandler::Stop() { |
| 35 GraphicsHandler::Stop(); | 37 GraphicsHandler::Stop(); |
| 36 } | 38 } |
| 37 | 39 |
| OLD | NEW |