| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * 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 |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkOSWindow_SDL_DEFINED | 8 #ifndef SkOSWindow_SDL_DEFINED |
| 9 #define SkOSWindow_SDL_DEFINED | 9 #define SkOSWindow_SDL_DEFINED |
| 10 | 10 |
| 11 #include "SDL.h" | 11 #include "SDL.h" |
| 12 #include "SDL_opengl.h" | 12 #include "SDL_opengl.h" |
| 13 #include "SkWindow.h" | 13 #include "SkWindow.h" |
| 14 | 14 |
| 15 class SkOSWindow : public SkWindow { | 15 class SkOSWindow : public SkWindow { |
| 16 public: | 16 public: |
| 17 SkOSWindow(void* screen); | 17 SkOSWindow(void*); |
| 18 virtual ~SkOSWindow(); | 18 virtual ~SkOSWindow(); |
| 19 | 19 |
| 20 static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay) { | |
| 21 SkFAIL("not implemented\n"); | |
| 22 return false; | |
| 23 } | |
| 24 | |
| 25 enum SkBackEndTypes { | 20 enum SkBackEndTypes { |
| 26 kNone_BackEndType, | 21 kNone_BackEndType, // TODO: remove this, it's not a real option. |
| 27 kNativeGL_BackEndType, | 22 kNativeGL_BackEndType, |
| 28 #if SK_ANGLE | 23 #if SK_ANGLE |
| 29 kANGLE_BackEndType, | 24 kANGLE_BackEndType, |
| 30 #endif // SK_ANGLE | 25 #endif // SK_ANGLE |
| 31 #if SK_COMMAND_BUFFER | 26 #if SK_COMMAND_BUFFER |
| 32 kCommandBuffer_BackEndType, | 27 kCommandBuffer_BackEndType, |
| 33 #endif // SK_COMMAND_BUFFER | 28 #endif // SK_COMMAND_BUFFER |
| 34 }; | 29 }; |
| 35 | 30 |
| 36 void detach(); | 31 void detach(); |
| 37 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*)
; | 32 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*)
; |
| 38 void present(); | 33 void present(); |
| 39 bool makeFullscreen(); | 34 bool makeFullscreen(); |
| 40 void setVsync(bool); | 35 void setVsync(bool); |
| 41 void closeWindow(); | 36 void closeWindow(); |
| 42 void loop() { | 37 static void RunEventLoop(); |
| 43 while (!fQuit) { | |
| 44 this->handleEvents(); | |
| 45 this->update(nullptr); | |
| 46 } | |
| 47 } | |
| 48 | 38 |
| 49 protected: | 39 protected: |
| 50 void onSetTitle(const char title[]) override; | 40 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 | 41 |
| 54 private: | 42 private: |
| 55 void handleEvents(); | 43 void createWindow(int msaaSampleCount); |
| 56 bool fQuit; | 44 void destroyWindow(); |
| 57 uint32_t fWindowFlags; | 45 void updateWindowTitle(); |
| 46 static SkOSWindow* GetInstanceForWindowID(Uint32 windowID); |
| 47 static bool HasDirtyWindows(); |
| 48 static void UpdateDirtyWindows(); |
| 49 static void HandleEvent(const SDL_Event&); |
| 50 |
| 58 SDL_Window* fWindow; | 51 SDL_Window* fWindow; |
| 59 SDL_GLContext fGLContext; | 52 SDL_GLContext fGLContext; |
| 60 | 53 int fWindowMSAASampleCount; |
| 61 typedef SkWindow INHERITED; | 54 typedef SkWindow INHERITED; |
| 62 }; | 55 }; |
| 63 | 56 |
| 64 #endif | 57 #endif |
| OLD | NEW |