From abc0c8216b8e162b8de74de005f883cb84bd254b Mon Sep 17 00:00:00 2001 From: kkinnunen Date: Thu, 14 Jan 2016 05:37:51 -0800 Subject: SampleApp: Cleanup SkOSWindow_SDL Implements: * Event loop event waiting (no busy loop) ** Skia timers * Proper window sizing and resizing * MSAA on X11 (previously it did not use MSAA at all) * Changes requested colorspace from 565 to 8888 to match non-SDL variants * Context creation clearing (color and stencil mask) * Opens the window in 640x480 by default on desktop. Removes dead code. BUG=skia:4733 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1578173002 Review URL: https://codereview.chromium.org/1578173002 --- include/views/SkOSWindow_SDL.h | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'include/views') diff --git a/include/views/SkOSWindow_SDL.h b/include/views/SkOSWindow_SDL.h index c40ec2e301..e08108add4 100644 --- a/include/views/SkOSWindow_SDL.h +++ b/include/views/SkOSWindow_SDL.h @@ -14,16 +14,11 @@ class SkOSWindow : public SkWindow { public: - SkOSWindow(void* screen); + SkOSWindow(void*); virtual ~SkOSWindow(); - static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay) { - SkFAIL("not implemented\n"); - return false; - } - enum SkBackEndTypes { - kNone_BackEndType, + kNone_BackEndType, // TODO: remove this, it's not a real option. kNativeGL_BackEndType, #if SK_ANGLE kANGLE_BackEndType, @@ -39,25 +34,23 @@ public: bool makeFullscreen(); void setVsync(bool); void closeWindow(); - void loop() { - while (!fQuit) { - this->handleEvents(); - this->update(nullptr); - } - } + static void RunEventLoop(); protected: void onSetTitle(const char title[]) override; - void onHandleInval(const SkIRect&) override; - void onPDFSaved(const char title[], const char desc[], const char path[]) override; private: - void handleEvents(); - bool fQuit; - uint32_t fWindowFlags; + void createWindow(int msaaSampleCount); + void destroyWindow(); + void updateWindowTitle(); + static SkOSWindow* GetInstanceForWindowID(Uint32 windowID); + static bool HasDirtyWindows(); + static void UpdateDirtyWindows(); + static void HandleEvent(const SDL_Event&); + SDL_Window* fWindow; SDL_GLContext fGLContext; - + int fWindowMSAASampleCount; typedef SkWindow INHERITED; }; -- cgit v1.2.3