1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/include/views/SkOSWindow_Win.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,101 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 + 1.13 +#ifndef SkOSWindow_Win_DEFINED 1.14 +#define SkOSWindow_Win_DEFINED 1.15 + 1.16 +#include "SkWindow.h" 1.17 + 1.18 +#if SK_ANGLE 1.19 +#include "EGL/egl.h" 1.20 +#endif 1.21 + 1.22 +class SkOSWindow : public SkWindow { 1.23 +public: 1.24 + SkOSWindow(void* hwnd); 1.25 + virtual ~SkOSWindow(); 1.26 + 1.27 + void* getHWND() const { return fHWND; } 1.28 + void setSize(int width, int height); 1.29 + void updateSize(); 1.30 + 1.31 + static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); 1.32 + 1.33 + enum SkBackEndTypes { 1.34 + kNone_BackEndType, 1.35 +#if SK_SUPPORT_GPU 1.36 + kNativeGL_BackEndType, 1.37 +#if SK_ANGLE 1.38 + kANGLE_BackEndType, 1.39 +#endif // SK_ANGLE 1.40 +#endif // SK_SUPPORT_GPU 1.41 + }; 1.42 + 1.43 + struct AttachmentInfo { 1.44 + int fSampleCount; 1.45 + int fStencilBits; 1.46 + }; 1.47 + 1.48 + bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*); 1.49 + void detach(); 1.50 + void present(); 1.51 + 1.52 + bool wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 1.53 + static bool QuitOnDeactivate(HWND hWnd); 1.54 + 1.55 + enum { 1.56 + SK_WM_SkEvent = WM_APP + 1000, 1.57 + SK_WM_SkTimerID = 0xFFFF // just need a non-zero value 1.58 + }; 1.59 + 1.60 +protected: 1.61 + virtual bool quitOnDeactivate() { return true; } 1.62 + 1.63 + // overrides from SkWindow 1.64 + virtual void onHandleInval(const SkIRect&); 1.65 + // overrides from SkView 1.66 + virtual void onAddMenu(const SkOSMenu*); 1.67 + 1.68 + virtual void onSetTitle(const char title[]); 1.69 + 1.70 +private: 1.71 + void* fHWND; 1.72 + 1.73 + void doPaint(void* ctx); 1.74 + 1.75 +#if SK_SUPPORT_GPU 1.76 + void* fHGLRC; 1.77 +#if SK_ANGLE 1.78 + EGLDisplay fDisplay; 1.79 + EGLContext fContext; 1.80 + EGLSurface fSurface; 1.81 + EGLConfig fConfig; 1.82 +#endif // SK_ANGLE 1.83 +#endif // SK_SUPPORT_GPU 1.84 + 1.85 + HMENU fMBar; 1.86 + 1.87 + SkBackEndTypes fAttached; 1.88 + 1.89 +#if SK_SUPPORT_GPU 1.90 + bool attachGL(int msaaSampleCount, AttachmentInfo* info); 1.91 + void detachGL(); 1.92 + void presentGL(); 1.93 + 1.94 +#if SK_ANGLE 1.95 + bool attachANGLE(int msaaSampleCount, AttachmentInfo* info); 1.96 + void detachANGLE(); 1.97 + void presentANGLE(); 1.98 +#endif // SK_ANGLE 1.99 +#endif // SK_SUPPORT_GPU 1.100 + 1.101 + typedef SkWindow INHERITED; 1.102 +}; 1.103 + 1.104 +#endif