| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 4 * | 3 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 | |
| 10 #ifndef SkOSWindow_SDL_DEFINED | 8 #ifndef SkOSWindow_SDL_DEFINED |
| 11 #define SkOSWindow_SDL_DEFINED | 9 #define SkOSWindow_SDL_DEFINED |
| 12 | 10 |
| 13 #include "SDL.h" | 11 #include "SDL.h" |
| 14 #include "SDL_opengl.h" | 12 #include "SDL_opengl.h" |
| 15 #include "SkWindow.h" | 13 #include "SkWindow.h" |
| 16 | 14 |
| 17 | |
| 18 class SkOSWindow : public SkWindow { | 15 class SkOSWindow : public SkWindow { |
| 19 public: | 16 public: |
| 20 SkOSWindow(void* screen); | 17 SkOSWindow(void* screen); |
| 21 virtual ~SkOSWindow(); | 18 virtual ~SkOSWindow(); |
| 22 | 19 |
| 23 static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay) { SkFAIL("n
ot implemented\n"); | 20 static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay) { |
| 24 return false; | 21 SkFAIL("not implemented\n"); |
| 22 return false; |
| 25 } | 23 } |
| 26 | 24 |
| 27 enum SkBackEndTypes { | 25 enum SkBackEndTypes { |
| 28 kNone_BackEndType, | 26 kNone_BackEndType, |
| 29 kNativeGL_BackEndType, | 27 kNativeGL_BackEndType, |
| 30 #if SK_ANGLE | 28 #if SK_ANGLE |
| 31 kANGLE_BackEndType, | 29 kANGLE_BackEndType, |
| 32 #endif // SK_ANGLE | 30 #endif // SK_ANGLE |
| 33 #if SK_COMMAND_BUFFER | 31 #if SK_COMMAND_BUFFER |
| 34 kCommandBuffer_BackEndType, | 32 kCommandBuffer_BackEndType, |
| 35 #endif // SK_COMMAND_BUFFER | 33 #endif // SK_COMMAND_BUFFER |
| 36 }; | 34 }; |
| 37 | 35 |
| 38 void detach(); | 36 void detach(); |
| 39 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*)
; | 37 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*)
; |
| 40 void present(); | 38 void present(); |
| 41 bool makeFullscreen(); | 39 bool makeFullscreen(); |
| 42 void setVsync(bool); | 40 void setVsync(bool); |
| 43 void closeWindow(); | 41 void closeWindow(); |
| 44 void loop() { | 42 void loop() { |
| 45 while (!fQuit) { | 43 while (!fQuit) { |
| 46 this->handleEvents(); | 44 this->handleEvents(); |
| 47 this->update(nullptr); | 45 this->update(nullptr); |
| 48 } | 46 } |
| 49 } | 47 } |
| 50 | 48 |
| 51 protected: | 49 protected: |
| 52 void onSetTitle(const char title[]) override; | 50 void onSetTitle(const char title[]) override; |
| 51 void onHandleInval(const SkIRect&) override; |
| 52 void onPDFSaved(const char title[], const char desc[], const char path[]) ov
erride; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 void handleEvents(); | 55 void handleEvents(); |
| 56 bool fQuit; | 56 bool fQuit; |
| 57 uint32_t fWindowFlags; |
| 57 SDL_Window* fWindow; | 58 SDL_Window* fWindow; |
| 58 SDL_GLContext fGLContext; | 59 SDL_GLContext fGLContext; |
| 59 | 60 |
| 60 typedef SkWindow INHERITED; | 61 typedef SkWindow INHERITED; |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 #endif | 64 #endif |
| OLD | NEW |