| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef EMBEDDERS_ANDROID_GRAPHICS_H_ | 5 #ifndef EMBEDDERS_ANDROID_GRAPHICS_H_ |
| 6 #define EMBEDDERS_ANDROID_GRAPHICS_H_ | 6 #define EMBEDDERS_ANDROID_GRAPHICS_H_ |
| 7 | 7 |
| 8 #include <android_native_app_glue.h> | 8 #include <android_native_app_glue.h> |
| 9 #include <EGL/egl.h> | 9 #include <EGL/egl.h> |
| 10 #include <GLES2/gl2.h> |
| 11 #include <GLES2/gl2ext.h> |
| 10 | 12 |
| 11 #include "embedders/android/timer.h" | 13 #include "embedders/android/timer.h" |
| 12 | 14 |
| 13 class Graphics { | 15 class Graphics { |
| 14 public: | 16 public: |
| 15 Graphics(android_app* application, Timer* timer); | 17 Graphics(android_app* application, Timer* timer); |
| 16 | 18 |
| 17 const int32_t& height(); | 19 const int32_t& height(); |
| 18 const int32_t& width(); | 20 const int32_t& width(); |
| 19 int32_t Start(); | 21 int32_t Start(); |
| 20 void Stop(); | 22 void Stop(); |
| 23 void SwapBuffers(); |
| 21 int32_t Update(); | 24 int32_t Update(); |
| 25 void SetViewport(int left, int top, int width, int height); |
| 26 int BuildProgram(const char* vertexShaderSource, |
| 27 const char* fragmentShaderSource) const; |
| 28 int BuildShader(const char* source, GLenum shaderType) const; |
| 22 | 29 |
| 23 private: | 30 private: |
| 24 android_app* application_; | 31 android_app* application_; |
| 25 Timer* timer_; | 32 Timer* timer_; |
| 26 int32_t width_, height_; | 33 int32_t width_, height_; |
| 27 EGLDisplay display_; | 34 EGLDisplay display_; |
| 28 EGLSurface surface_; | 35 EGLSurface surface_; |
| 29 EGLContext context_; | 36 EGLContext context_; |
| 30 }; | 37 }; |
| 31 | 38 |
| 32 #endif // EMBEDDERS_ANDROID_GRAPHICS_H_ | 39 #endif // EMBEDDERS_ANDROID_GRAPHICS_H_ |
| OLD | NEW |