From 3f94c9e9ddfd807b449f3bb9b232cf2041fa12d2 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Thu, 20 Nov 2014 14:14:30 +0100 Subject: windows opengl: Introduce OpenGLCompatibleDC. This is to abstract the compatible DC creation and usage, to be reused in the native theme rendering. Change-Id: Id34bba4aeea7f46fc2aa42f292f0a525d753b8d7 --- vcl/inc/win/salgdi.h | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'vcl/inc/win/salgdi.h') diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 74e8fe00e61d..831a7032fa8e 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -41,6 +41,7 @@ class ImplWinFontEntry; class ImplFontAttrCache; class PhysicalFontCollection; class SalGraphicsImpl; +class WinOpenGLSalGraphicsImpl; #define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000) #define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff) @@ -139,11 +140,43 @@ public: bool IsGSUBstituted( sal_UCS4 ) const; }; +/** Class that creates (and destroys) a compatible Device Context. + +This is to be used for GDI drawing into a DIB that we later use as a texture for OpenGL drawing. +*/ +class OpenGLCompatibleDC +{ +private: + /// The compatible DC that we create for our purposes. + HDC mhCompatibleDC; + + /// DIBSection that we use for the GDI drawing, and later obtain. + HBITMAP mhBitmap; + + /// DIBSection data. + sal_uInt8 *mpData; + + /// Mapping between the GDI position and OpenGL, to use for OpenGL drawing. + SalTwoRect maRects; + + /// The OpenGL-based SalGraphicsImpl where we will draw. If null, we ignora the drawing, it means it happened directly to the DC.. + WinOpenGLSalGraphicsImpl *mpImpl; + +public: + OpenGLCompatibleDC(SalGraphics &rGraphics, int x, int y, int width, int height); + ~OpenGLCompatibleDC(); + + HDC getCompatibleHDC() { return mhCompatibleDC; } + + /// Call the WinOpenGLSalGraphicsImpl's DrawMask(). + void DrawMask(SalColor color); +}; + class WinSalGraphics : public SalGraphics { friend class WinSalGraphicsImpl; friend class ScopedFont; - friend class WinLayout; + friend class OpenGLCompatibleDC; private: boost::scoped_ptr mpImpl; -- cgit v1.2.3