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
diff --git a/include/views/SkOSWindow_SDL.h b/include/views/SkOSWindow_SDL.h
index c40ec2e..e08108a 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 @@
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;
};