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);
|
2012-03-30 15:18:14 +00:00
|
|
|
|
|
|
|
bool attachGL();
|
|
|
|
void detachGL();
|
|
|
|
void presentGL();
|
2010-12-20 18:26:13 +00:00
|
|
|
|
2012-03-28 16:19:11 +00:00
|
|
|
#if SK_ANGLE
|
2012-03-30 15:18:14 +00:00
|
|
|
bool attachANGLE();
|
|
|
|
void detachANGLE();
|
|
|
|
void presentANGLE();
|
2012-03-28 16:19:11 +00:00
|
|
|
#endif
|
|
|
|
|
2012-03-30 15:18:14 +00:00
|
|
|
bool attachD3D9();
|
|
|
|
void detachD3D9();
|
|
|
|
void presentD3D9();
|
2010-12-20 18:26:13 +00:00
|
|
|
|
|
|
|
void* d3d9Device() { return fD3D9Device; }
|
2008-12-17 15:59:43 +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;
|
|
|
|
|
|
|
|
void doPaint(void* ctx);
|
|
|
|
|
|
|
|
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;
|
2012-03-28 16:19:11 +00:00
|
|
|
#endif
|
2010-12-20 18:26:13 +00:00
|
|
|
|
2012-03-30 15:18:14 +00:00
|
|
|
bool fGLAttached;
|
|
|
|
|
2010-12-20 18:26:13 +00:00
|
|
|
void* fD3D9Device;
|
2012-03-30 15:18:14 +00:00
|
|
|
bool fD3D9Attached;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2010-12-20 18:26:13 +00:00
|
|
|
HMENU fMBar;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2010-12-20 18:26:13 +00:00
|
|
|
typedef SkWindow INHERITED;
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|