| 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 #ifndef EMBEDDERS_OPENGLUI_COMMON_GL_GRAPHICS_HANDLER_H_ | 5 #ifndef EMBEDDERS_OPENGLUI_COMMON_GRAPHICS_HANDLER_H_ |
| 6 #define EMBEDDERS_OPENGLUI_COMMON_GL_GRAPHICS_HANDLER_H_ | 6 #define EMBEDDERS_OPENGLUI_COMMON_GRAPHICS_HANDLER_H_ |
| 7 | 7 |
| 8 #include "embedders/openglui/common/graphics_handler.h" | 8 #include "embedders/openglui/common/isized.h" |
| 9 #include "embedders/openglui/common/opengl.h" | 9 #include "embedders/openglui/common/opengl.h" |
| 10 #include "embedders/openglui/common/support.h" |
| 10 #include "embedders/openglui/common/timer.h" | 11 #include "embedders/openglui/common/timer.h" |
| 11 | 12 |
| 12 class GLGraphicsHandler : public GraphicsHandler { | 13 class GraphicsHandler : public ISized { |
| 13 public: | 14 public: |
| 14 GLGraphicsHandler() | 15 GraphicsHandler(); |
| 15 : GraphicsHandler() { | 16 |
| 17 const int32_t& height() { |
| 18 return height_; |
| 16 } | 19 } |
| 17 | 20 |
| 18 virtual int32_t Start() = 0; | 21 const int32_t& width() { |
| 19 virtual void Stop() = 0; | 22 return width_; |
| 23 } |
| 24 |
| 25 void ApplyOrtho(float maxX, float maxY) const; |
| 26 void ApplyRotation(float degrees) const; |
| 27 |
| 28 virtual int32_t Start(); |
| 29 virtual void Stop(); |
| 20 | 30 |
| 21 void SwapBuffers() { | 31 void SwapBuffers() { |
| 22 GLSwapBuffers(); | 32 GLSwapBuffers(); |
| 23 } | 33 } |
| 24 | 34 |
| 25 virtual int32_t Update() { | 35 virtual int32_t Update(); |
| 26 SwapBuffers(); | 36 |
| 27 return 0; | 37 void SetViewport(int left, int top, int width, int height); |
| 38 |
| 39 SkCanvas* CreateCanvas(); |
| 40 |
| 41 void Flush() { |
| 42 // TODO(gram): see if we really need this. |
| 43 grcontext->flush(); |
| 28 } | 44 } |
| 29 | 45 |
| 30 void SetViewport(int left, int top, int width, int height); | 46 virtual ~GraphicsHandler() { |
| 31 int BuildProgram(const char* vertexShaderSource, | 47 } |
| 32 const char* fragmentShaderSource) const; | |
| 33 int BuildShader(const char* source, GLenum shaderType) const; | |
| 34 | 48 |
| 35 virtual ~GLGraphicsHandler() { | 49 protected: |
| 36 } | 50 SkAutoGraphics ag; |
| 51 GrContext* grcontext; |
| 52 int32_t width_, height_; |
| 37 }; | 53 }; |
| 38 | 54 |
| 39 #endif // EMBEDDERS_OPENGLUI_COMMON_GL_GRAPHICS_HANDLER_H_ | 55 extern GraphicsHandler* graphics; |
| 40 | 56 |
| 57 #endif // EMBEDDERS_OPENGLUI_COMMON_GRAPHICS_HANDLER_H_ |
| 58 |
| OLD | NEW |