2009-05-22 20:44:12 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2009-05-22 20:44:12 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2009-05-22 20:44:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkOSWindow_SDL_DEFINED
|
|
|
|
#define SkOSWindow_SDL_DEFINED
|
|
|
|
|
|
|
|
#include "SDL.h"
|
2015-11-04 21:41:02 +00:00
|
|
|
#include "SDL_opengl.h"
|
2009-05-22 20:44:12 +00:00
|
|
|
#include "SkWindow.h"
|
|
|
|
|
|
|
|
class SkOSWindow : public SkWindow {
|
|
|
|
public:
|
2016-01-14 13:37:51 +00:00
|
|
|
SkOSWindow(void*);
|
2009-05-26 13:27:48 +00:00
|
|
|
virtual ~SkOSWindow();
|
2009-05-22 20:44:12 +00:00
|
|
|
|
2015-11-04 21:41:02 +00:00
|
|
|
enum SkBackEndTypes {
|
2016-01-14 13:37:51 +00:00
|
|
|
kNone_BackEndType, // TODO: remove this, it's not a real option.
|
2015-11-04 21:41:02 +00:00
|
|
|
kNativeGL_BackEndType,
|
|
|
|
#if SK_ANGLE
|
|
|
|
kANGLE_BackEndType,
|
|
|
|
#endif // SK_ANGLE
|
|
|
|
};
|
|
|
|
|
2016-03-16 20:53:35 +00:00
|
|
|
void release();
|
2016-05-05 19:24:31 +00:00
|
|
|
bool attach(SkBackEndTypes attachType, int msaaSampleCount, bool deepColor, AttachmentInfo*);
|
2015-11-04 21:41:02 +00:00
|
|
|
void present();
|
|
|
|
bool makeFullscreen();
|
|
|
|
void setVsync(bool);
|
|
|
|
void closeWindow();
|
2016-01-14 13:37:51 +00:00
|
|
|
static void RunEventLoop();
|
2009-05-22 20:44:12 +00:00
|
|
|
|
|
|
|
protected:
|
2015-11-04 21:41:02 +00:00
|
|
|
void onSetTitle(const char title[]) override;
|
2009-05-22 20:44:12 +00:00
|
|
|
|
|
|
|
private:
|
2016-01-14 13:37:51 +00:00
|
|
|
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&);
|
|
|
|
|
2015-11-04 21:41:02 +00:00
|
|
|
SDL_Window* fWindow;
|
|
|
|
SDL_GLContext fGLContext;
|
2016-01-14 13:37:51 +00:00
|
|
|
int fWindowMSAASampleCount;
|
2009-05-22 20:44:12 +00:00
|
|
|
typedef SkWindow INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|