| 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_GRAPHICS_HANDLER_H_ | 5 #ifndef EMBEDDERS_OPENGLUI_COMMON_GRAPHICS_HANDLER_H_ |
| 6 #define EMBEDDERS_OPENGLUI_COMMON_GRAPHICS_HANDLER_H_ | 6 #define EMBEDDERS_OPENGLUI_COMMON_GRAPHICS_HANDLER_H_ |
| 7 | 7 |
| 8 #include "embedders/openglui/common/isized.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/support.h" |
| 11 #include "embedders/openglui/common/timer.h" | 11 #include "embedders/openglui/common/timer.h" |
| 12 | 12 |
| 13 class GraphicsHandler : public ISized { | 13 class GraphicsHandler : public ISized { |
| 14 private: |
| 15 void DecoderHack(int x, SkStream* s); |
| 16 |
| 14 public: | 17 public: |
| 15 GraphicsHandler(); | 18 explicit GraphicsHandler(const char* resource_path); |
| 16 | 19 |
| 17 const int32_t& height() { | 20 const int32_t& height() { |
| 18 return height_; | 21 return height_; |
| 19 } | 22 } |
| 20 | 23 |
| 21 const int32_t& width() { | 24 const int32_t& width() { |
| 22 return width_; | 25 return width_; |
| 23 } | 26 } |
| 24 | 27 |
| 25 void ApplyOrtho(float maxX, float maxY) const; | 28 void ApplyOrtho(float maxX, float maxY) const; |
| 26 void ApplyRotation(float degrees) const; | 29 void ApplyRotation(float degrees) const; |
| 27 | 30 |
| 28 virtual int32_t Start(); | 31 virtual int32_t Start(); |
| 29 virtual void Stop(); | 32 virtual void Stop(); |
| 30 | 33 |
| 31 void SwapBuffers() { | 34 void SwapBuffers() { |
| 32 GLSwapBuffers(); | 35 GLSwapBuffers(); |
| 33 } | 36 } |
| 34 | 37 |
| 35 virtual int32_t Update(); | 38 virtual int32_t Update(); |
| 36 | 39 |
| 37 void SetViewport(int left, int top, int width, int height); | 40 void SetViewport(int left, int top, int width, int height); |
| 38 | 41 |
| 39 SkCanvas* CreateDisplayCanvas(); | 42 SkCanvas* CreateDisplayCanvas(); |
| 40 SkCanvas* CreateBitmapCanvas(int width, int height); | 43 SkCanvas* CreateBitmapCanvas(int width, int height); |
| 41 | 44 |
| 45 inline const char* resource_path() { |
| 46 return resource_path_; |
| 47 } |
| 48 |
| 42 virtual ~GraphicsHandler() { | 49 virtual ~GraphicsHandler() { |
| 43 } | 50 } |
| 44 | 51 |
| 45 protected: | 52 protected: |
| 53 const char* resource_path_; |
| 46 SkAutoGraphics ag; | 54 SkAutoGraphics ag; |
| 47 GrContext* grcontext; | 55 GrContext* grcontext; |
| 48 int32_t width_, height_; | 56 int32_t width_, height_; |
| 49 }; | 57 }; |
| 50 | 58 |
| 51 extern GraphicsHandler* graphics; | 59 extern GraphicsHandler* graphics; |
| 52 | 60 |
| 53 #endif // EMBEDDERS_OPENGLUI_COMMON_GRAPHICS_HANDLER_H_ | 61 #endif // EMBEDDERS_OPENGLUI_COMMON_GRAPHICS_HANDLER_H_ |
| 54 | 62 |
| OLD | NEW |