2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +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.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SkOSWindow_Win_DEFINED
|
|
|
|
#define SkOSWindow_Win_DEFINED
|
|
|
|
|
|
|
|
#include "SkWindow.h"
|
|
|
|
|
2012-03-28 16:19:11 +00:00
|
|
|
#if SK_ANGLE
|
|
|
|
#include "EGL/egl.h"
|
|
|
|
#endif
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
class SkOSWindow : public SkWindow {
|
|
|
|
public:
|
|
|
|
SkOSWindow(void* hwnd);
|
2010-12-20 18:26:13 +00:00
|
|
|
virtual ~SkOSWindow();
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
void* getHWND() const { return fHWND; }
|
|
|
|
void setSize(int width, int height);
|
|
|
|
void updateSize();
|
|
|
|
|
|
|
|
static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
|
2010-12-20 18:26:13 +00:00
|
|
|
|
2012-04-02 19:24:21 +00:00
|
|
|
enum SkBackEndTypes {
|
|
|
|
kNone_BackEndType,
|
2012-08-02 14:03:32 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
2012-04-02 19:24:21 +00:00
|
|
|
kNativeGL_BackEndType,
|
2012-03-28 16:19:11 +00:00
|
|
|
#if SK_ANGLE
|
2012-04-02 19:24:21 +00:00
|
|
|
kANGLE_BackEndType,
|
2012-08-02 14:03:32 +00:00
|
|
|
#endif // SK_ANGLE
|
|
|
|
#endif // SK_SUPPORT_GPU
|
2012-04-02 19:24:21 +00:00
|
|
|
};
|
2012-03-28 16:19:11 +00:00
|
|
|
|
2013-03-05 20:06:05 +00:00
|
|
|
struct AttachmentInfo {
|
|
|
|
int fSampleCount;
|
|
|
|
int fStencilBits;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*);
|
2012-04-02 19:24:21 +00:00
|
|
|
void detach();
|
|
|
|
void present();
|
2010-12-20 18:26:13 +00:00
|
|
|
|
2009-12-18 21:33:39 +00:00
|
|
|
bool wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
|
|
|
static bool QuitOnDeactivate(HWND hWnd);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
SK_WM_SkEvent = WM_APP + 1000,
|
|
|
|
SK_WM_SkTimerID = 0xFFFF // just need a non-zero value
|
|
|
|
};
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool quitOnDeactivate() { return true; }
|
|
|
|
|
|
|
|
// overrides from SkWindow
|
|
|
|
virtual void onHandleInval(const SkIRect&);
|
|
|
|
// overrides from SkView
|
|
|
|
virtual void onAddMenu(const SkOSMenu*);
|
|
|
|
|
2010-12-20 18:26:13 +00:00
|
|
|
virtual void onSetTitle(const char title[]);
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
private:
|
2010-12-20 18:26:13 +00:00
|
|
|
void* fHWND;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2010-12-20 18:26:13 +00:00
|
|
|
void doPaint(void* ctx);
|
|
|
|
|
2012-08-02 14:03:32 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
2010-12-20 18:26:13 +00:00
|
|
|
void* fHGLRC;
|
2012-03-28 16:19:11 +00:00
|
|
|
#if SK_ANGLE
|
2012-04-02 15:04:16 +00:00
|
|
|
EGLDisplay fDisplay;
|
|
|
|
EGLContext fContext;
|
|
|
|
EGLSurface fSurface;
|
2013-03-05 20:06:05 +00:00
|
|
|
EGLConfig fConfig;
|
2012-08-02 14:03:32 +00:00
|
|
|
#endif // SK_ANGLE
|
|
|
|
#endif // SK_SUPPORT_GPU
|
2010-12-20 18:26:13 +00:00
|
|
|
|
|
|
|
HMENU fMBar;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2012-04-02 19:24:21 +00:00
|
|
|
SkBackEndTypes fAttached;
|
|
|
|
|
2012-08-02 14:03:32 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
2013-03-05 20:06:05 +00:00
|
|
|
bool attachGL(int msaaSampleCount, AttachmentInfo* info);
|
2012-04-02 19:24:21 +00:00
|
|
|
void detachGL();
|
|
|
|
void presentGL();
|
|
|
|
|
|
|
|
#if SK_ANGLE
|
2013-03-05 20:06:05 +00:00
|
|
|
bool attachANGLE(int msaaSampleCount, AttachmentInfo* info);
|
2012-04-03 18:04:51 +00:00
|
|
|
void detachANGLE();
|
2012-04-02 19:24:21 +00:00
|
|
|
void presentANGLE();
|
2012-08-02 14:03:32 +00:00
|
|
|
#endif // SK_ANGLE
|
|
|
|
#endif // SK_SUPPORT_GPU
|
2012-04-02 19:24:21 +00:00
|
|
|
|
2012-08-23 18:09:54 +00:00
|
|
|
typedef SkWindow INHERITED;
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|