1 /* 2 * Copyright 2006 The Android Open Source Project 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkOSWindow_SDL_DEFINED 9 #define SkOSWindow_SDL_DEFINED 10 11 #include "SDL.h" 12 #include "SDL_opengl.h" 13 #include "SkWindow.h" 14 15 class SkOSWindow : public SkWindow { 16 public: 17 SkOSWindow(void*); 18 virtual ~SkOSWindow(); 19 20 enum SkBackEndTypes { 21 kNone_BackEndType, // TODO: remove this, it's not a real option. 22 kNativeGL_BackEndType, 23 #if SK_ANGLE 24 kANGLE_BackEndType, 25 #endif // SK_ANGLE 26 #if SK_COMMAND_BUFFER 27 kCommandBufferES2_BackEndType, 28 #endif // SK_COMMAND_BUFFER 29 }; 30 31 void detach(); 32 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*); 33 void present(); 34 bool makeFullscreen(); 35 void setVsync(bool); 36 void closeWindow(); 37 static void RunEventLoop(); 38 39 protected: 40 void onSetTitle(const char title[]) override; 41 42 private: 43 void createWindow(int msaaSampleCount); 44 void destroyWindow(); 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 51 SDL_Window* fWindow; 52 SDL_GLContext fGLContext; 53 int fWindowMSAASampleCount; 54 typedef SkWindow INHERITED; 55 }; 56 57 #endif 58