diff options
Diffstat (limited to 'vcl/inc/win/salgdi.h')
-rw-r--r-- | vcl/inc/win/salgdi.h | 248 |
1 files changed, 119 insertions, 129 deletions
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index d210dd22bb68..bd82cb387319 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -142,52 +142,7 @@ class WinSalGraphics : public SalGraphics friend class WinSalGraphicsImpl; friend class ScopedFont; -protected: - std::unique_ptr<SalGraphicsImpl> mpImpl; - WinSalGraphicsImplBase * mWinSalGraphicsImplBase; - -private: - HDC mhLocalDC; // HDC - bool mbPrinter : 1; // is Printer - bool mbVirDev : 1; // is VirDev - bool mbWindow : 1; // is Window - bool mbScreen : 1; // is Screen compatible - HWND mhWnd; // Window-Handle, when Window-Graphics - - rtl::Reference<WinFontInstance> - mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance - HRGN mhRegion; // vcl::Region Handle - HPEN mhDefPen; // DefaultPen - HBRUSH mhDefBrush; // DefaultBrush - HFONT mhDefFont; // DefaultFont - HPALETTE mhDefPal; // DefaultPalette - COLORREF mnTextColor; // TextColor - RGNDATA* mpClipRgnData; // ClipRegion-Data - RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data - int mnPenWidth; // line width - - // just call both from setHDC! - void InitGraphics(); - void DeInitGraphics(); - public: - // Returns base HFONT, an optional HFONT for non-rotated CJK glyphs, - // and tmDescent value for adjusting offset in vertical writing mode. - std::tuple<HFONT, HFONT, sal_Int32> - ImplDoSetFont(HDC hDC, vcl::font::FontSelectPattern const& i_rFont, - const vcl::font::PhysicalFontFace* i_pFontFace, HFONT& o_rOldFont); - - HDC getHDC() const { return mhLocalDC; } - // NOTE: this doesn't transfer ownership! See class comment. - void setHDC(HDC aNew); - - HPALETTE getDefPal() const; - // returns the result from RealizePalette, otherwise 0 on success or GDI_ERROR - UINT setPalette(HPALETTE, BOOL bForceBkgd = TRUE); - - HRGN getRegion() const; - - enum Type { PRINTER, @@ -196,15 +151,6 @@ public: SCREEN }; - static IDWriteFactory* getDWriteFactory(); - static IDWriteGdiInterop* getDWriteGdiInterop(); - -public: - - HWND gethWnd(); - - -public: explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd, SalGeometryProvider *pProvider); virtual ~WinSalGraphics() override; @@ -219,73 +165,6 @@ public: void setHWND(HWND hWnd); void Flush(); -protected: - virtual void setClipRegion( const vcl::Region& ) override; - // draw --> LineColor and FillColor and RasterOp and ClipRegion - virtual void drawPixel( tools::Long nX, tools::Long nY ) override; - virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override; - virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override; - virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; - virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) override; - virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) override; - virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) override; - virtual void drawPolyPolygon( - const basegfx::B2DHomMatrix& rObjectToDevice, - const basegfx::B2DPolyPolygon&, - double fTransparency) override; - virtual bool drawPolyLine( - const basegfx::B2DHomMatrix& rObjectToDevice, - const basegfx::B2DPolygon&, - double fTransparency, - double fLineWidth, - const std::vector< double >* pStroke, // MM01 - basegfx::B2DLineJoin, - css::drawing::LineCap, - double fMiterMinimumAngle, - bool bPixelSnapHairline) override; - virtual bool drawPolyLineBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override; - virtual bool drawPolygonBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override; - virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point* const* pPtAry, const PolyFlags* const* pFlgAry ) override; - virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) override; - virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, SalGradient const & rGradient) override; - - // CopyArea --> No RasterOp, but ClipRegion - virtual void copyArea( tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, - tools::Long nSrcHeight, bool bWindowInvalidate ) override; - - // CopyBits and DrawBitmap --> RasterOp and ClipRegion - // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics - virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override; - virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override; - virtual void drawBitmap( const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap ) override; - virtual void drawMask( const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - Color nMaskColor ) override; - - virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; - virtual Color getPixel( tools::Long nX, tools::Long nY ) override; - - // invert --> ClipRegion (only Windows or VirDevs) - virtual void invert( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags) override; - virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) override; - - virtual bool drawEPS( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void* pPtr, sal_uInt32 nSize ) override; - - // native widget rendering methods that require mirroring -protected: - virtual bool isNativeControlSupported( ControlType nType, ControlPart nPart ) override; - virtual bool hitTestNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, - const Point& aPos, bool& rIsInside ) override; - virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, - ControlState nState, const ImplControlValue& aValue, - const OUString& aCaption, const Color& rBackgroundColor ) override; - virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, - const ImplControlValue& aValue, const OUString& aCaption, - tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override; - -public: virtual bool blendBitmap( const SalTwoRect&, const SalBitmap& rBitmap ) override; @@ -309,12 +188,6 @@ public: virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) override; -private: - // local helpers - - void DrawTextLayout(const GenericSalLayout&, HDC, bool bUseDWrite, bool bRenderingModeNatural); - -public: // public SalGraphics methods, the interface to the independent vcl part // get device resolution @@ -368,6 +241,125 @@ public: /// Update settings based on the platform values static void updateSettingsNative( AllSettings& rSettings ); + + // Returns base HFONT, an optional HFONT for non-rotated CJK glyphs, + // and tmDescent value for adjusting offset in vertical writing mode. + std::tuple<HFONT, HFONT, sal_Int32> + ImplDoSetFont(HDC hDC, vcl::font::FontSelectPattern const& i_rFont, + const vcl::font::PhysicalFontFace* i_pFontFace, HFONT& o_rOldFont); + + HDC getHDC() const { return mhLocalDC; } + // NOTE: this doesn't transfer ownership! See class comment. + void setHDC(HDC aNew); + + HPALETTE getDefPal() const; + // returns the result from RealizePalette, otherwise 0 on success or GDI_ERROR + UINT setPalette(HPALETTE, BOOL bForceBkgd = TRUE); + + HRGN getRegion() const; + + static IDWriteFactory* getDWriteFactory(); + static IDWriteGdiInterop* getDWriteGdiInterop(); + + HWND gethWnd(); + +protected: + + virtual void setClipRegion( const vcl::Region& ) override; + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( tools::Long nX, tools::Long nY ) override; + virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override; + virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override; + virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) override; + virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) override; + virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) override; + virtual void drawPolyPolygon( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, + double fTransparency) override; + virtual bool drawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin, + css::drawing::LineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) override; + virtual bool drawPolyLineBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override; + virtual bool drawPolygonBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override; + virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point* const* pPtAry, const PolyFlags* const* pFlgAry ) override; + virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) override; + virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, SalGradient const & rGradient) override; + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, + tools::Long nSrcHeight, bool bWindowInvalidate ) override; + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override; + virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override; + virtual void drawBitmap( const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rTransparentBitmap ) override; + virtual void drawMask( const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + Color nMaskColor ) override; + + virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual Color getPixel( tools::Long nX, tools::Long nY ) override; + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags) override; + virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) override; + + virtual bool drawEPS( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void* pPtr, sal_uInt32 nSize ) override; + + // native widget rendering methods that require mirroring + virtual bool isNativeControlSupported( ControlType nType, ControlPart nPart ) override; + virtual bool hitTestNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, + const Point& aPos, bool& rIsInside ) override; + virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + const OUString& aCaption, const Color& rBackgroundColor ) override; + virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, const OUString& aCaption, + tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override; + +private: + // just call both from setHDC! + void InitGraphics(); + void DeInitGraphics(); + + // local helpers + void DrawTextLayout(const GenericSalLayout&, HDC, bool bUseDWrite, bool bRenderingModeNatural); + +protected: + std::unique_ptr<SalGraphicsImpl> mpImpl; + WinSalGraphicsImplBase * mWinSalGraphicsImplBase; + +private: + HDC mhLocalDC; // HDC + bool mbPrinter : 1; // is Printer + bool mbVirDev : 1; // is VirDev + bool mbWindow : 1; // is Window + bool mbScreen : 1; // is Screen compatible + HWND mhWnd; // Window-Handle, when Window-Graphics + + rtl::Reference<WinFontInstance> + mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance + HRGN mhRegion; // vcl::Region Handle + HPEN mhDefPen; // DefaultPen + HBRUSH mhDefBrush; // DefaultBrush + HFONT mhDefFont; // DefaultFont + HPALETTE mhDefPal; // DefaultPalette + COLORREF mnTextColor; // TextColor + RGNDATA* mpClipRgnData; // ClipRegion-Data + RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data + int mnPenWidth; // line width }; // Init/Deinit Graphics @@ -376,6 +368,4 @@ int ImplIsSysColorEntry( Color nColor ); void ImplGetLogFontFromFontSelect( const vcl::font::FontSelectPattern&, const vcl::font::PhysicalFontFace*, LOGFONTW&, bool bAntiAliased); -#define MAX_64KSALPOINTS ((((sal_uInt16)0xFFFF)-8)/sizeof(POINTS)) - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |