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

Unified Diff: runtime/embedders/openglui/emulator/emulator_graphics_handler.cc

Issue 11883013: Refactored OpenGL embedder that works on Android, Mac or Linux. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
Index: runtime/embedders/openglui/emulator/emulator_graphics_handler.cc
===================================================================
--- runtime/embedders/openglui/emulator/emulator_graphics_handler.cc (revision 0)
+++ runtime/embedders/openglui/emulator/emulator_graphics_handler.cc (revision 0)
@@ -0,0 +1,38 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "embedders/openglui/emulator/emulator_graphics_handler.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+EmulatorGraphicsHandler::EmulatorGraphicsHandler(int argc,
+ char** argv)
+ : GLGraphicsHandler() {
+ glutInit(&argc, argv);
+ width_ = 480;
+ height_ = 800;
+ for (int i = 1; i < argc; i++) {
+ if (argv[i][0] == '-') {
+ int next_arg = i + 1;
+ if (next_arg < argc && strcmp(argv[i], "-w") == 0) {
+ width_ = static_cast<size_t>(atoi(argv[i = next_arg]));
+ } else if (next_arg < argc && strcmp(argv[i], "-h") == 0) {
+ height_ = static_cast<size_t>(atoi(argv[i = next_arg]));
+ }
+ }
+ }
+}
+
+int32_t EmulatorGraphicsHandler::Start() {
+ glutInitWindowSize(width_, height_);
+ glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
+ glutCreateWindow("Dart");
+ return 0;
+}
+
+void EmulatorGraphicsHandler::Stop() {
+ exit(0);
+}
+

Powered by Google App Engine
This is Rietveld 408576698