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