diff options
author | joshualitt <joshualitt@chromium.org> | 2015-11-04 13:41:02 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-04 13:41:02 -0800 |
commit | 65d6fbb576b7f0c86e3124db92f302e09b6eea13 (patch) | |
tree | 075d5b6c0c54414398bfd05256517035a0a7c6f8 /include/views | |
parent | 6f45c1714786a54adec156f2416a14aa142adf05 (diff) |
Create SDL backed SkOSWindow
BUG=skia:
Review URL: https://codereview.chromium.org/1413593007
Diffstat (limited to 'include/views')
-rw-r--r-- | include/views/SkOSWindow_SDL.h | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/include/views/SkOSWindow_SDL.h b/include/views/SkOSWindow_SDL.h index e6b59e6511..532cf74728 100644 --- a/include/views/SkOSWindow_SDL.h +++ b/include/views/SkOSWindow_SDL.h @@ -11,32 +11,51 @@ #define SkOSWindow_SDL_DEFINED #include "SDL.h" +#include "SDL_opengl.h" #include "SkWindow.h" -class SkGLCanvas; class SkOSWindow : public SkWindow { public: SkOSWindow(void* screen); virtual ~SkOSWindow(); - static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); - - void handleSDLEvent(const SDL_Event& event); + static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay) { SkFAIL("not implemented\n"); + return false; + } + + enum SkBackEndTypes { + kNone_BackEndType, + kNativeGL_BackEndType, +#if SK_ANGLE + kANGLE_BackEndType, +#endif // SK_ANGLE +#if SK_COMMAND_BUFFER + kCommandBuffer_BackEndType, +#endif // SK_COMMAND_BUFFER + }; + + void detach(); + bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*); + void present(); + bool makeFullscreen(); + void setVsync(bool); + void closeWindow(); + void loop() { + while (!fQuit) { + this->handleEvents(); + this->update(nullptr); + } + } protected: - // overrides from SkWindow - virtual void onHandleInval(const SkIRect&); - // overrides from SkView - virtual void onAddMenu(const SkOSMenu*); - virtual void onSetTitle(const char[]); + void onSetTitle(const char title[]) override; private: - SDL_Surface* fScreen; - SDL_Surface* fSurface; - SkGLCanvas* fGLCanvas; - - void doDraw(); + void handleEvents(); + bool fQuit; + SDL_Window* fWindow; + SDL_GLContext fGLContext; typedef SkWindow INHERITED; }; |