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