vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx | 28 --- vcl/unx/generic/gdi/gdiimpl.cxx | 192 ------------------------ vcl/unx/generic/gdi/gdiimpl.hxx | 38 ---- 3 files changed, 7 insertions(+), 251 deletions(-)
New commits: commit b8c66c7f9b25ff88994aef92f56f61f176dc8a6f Author: Caolán McNamara <[email protected]> AuthorDate: Tue Jan 10 14:35:52 2023 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Jan 11 08:49:02 2023 +0000 move getRenderBackendName to X11CairoSalGraphicsImpl Change-Id: I8f1ff3891623cc8759a9a6146c627c3f14b87a70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145273 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index 1b5867afe505..a70abab552c3 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -32,6 +32,8 @@ private: public: X11CairoSalGraphicsImpl(X11SalGraphics& rParent, CairoCommon& rCairoCommon); + virtual OUString getRenderBackendName() const override { return "gen"; } + void ResetClipRegion() override { mrCairoCommon.m_aClipRegion.SetNull(); diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index dfa55ae73c22..6832ddf61d09 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -77,8 +77,6 @@ public: virtual ~X11SalGraphicsImpl() override; - virtual OUString getRenderBackendName() const override { return "gen"; } - virtual void setClipRegion( const vcl::Region& ) override; // // get the depth of the device commit 1293656284893209ca174f42d19b2fa72a40117a Author: Caolán McNamara <[email protected]> AuthorDate: Tue Jan 10 14:34:06 2023 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Jan 11 08:48:52 2023 +0000 drop recently unused code Change-Id: I93e8afc026bf0b12027d70bb0daf81385fb7d99d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145271 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index b0a8a85e4f90..1b5867afe505 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -44,29 +44,13 @@ public: X11SalGraphicsImpl::setClipRegion(i_rClip); } - void SetLineColor() override - { - mrCairoCommon.m_oLineColor = std::nullopt; - X11SalGraphicsImpl::SetLineColor(); - } + void SetLineColor() override { mrCairoCommon.m_oLineColor = std::nullopt; } - void SetLineColor(Color nColor) override - { - mrCairoCommon.m_oLineColor = nColor; - X11SalGraphicsImpl::SetLineColor(nColor); - } + void SetLineColor(Color nColor) override { mrCairoCommon.m_oLineColor = nColor; } - void SetFillColor() override - { - mrCairoCommon.m_oFillColor = std::nullopt; - X11SalGraphicsImpl::SetFillColor(); - } + void SetFillColor() override { mrCairoCommon.m_oFillColor = std::nullopt; } - void SetFillColor(Color nColor) override - { - mrCairoCommon.m_oFillColor = nColor; - X11SalGraphicsImpl::SetFillColor(nColor); - } + void SetFillColor(Color nColor) override { mrCairoCommon.m_oFillColor = nColor; } void SetXORMode(bool bSet, bool bInvertOnly) override { @@ -77,13 +61,11 @@ public: void SetROPLineColor(SalROPColor nROPColor) override { mrCairoCommon.SetROPLineColor(nROPColor); - X11SalGraphicsImpl::SetROPLineColor(nROPColor); } void SetROPFillColor(SalROPColor nROPColor) override { mrCairoCommon.SetROPFillColor(nROPColor); - X11SalGraphicsImpl::SetROPFillColor(nROPColor); } void clipRegion(cairo_t* cr) { CairoCommon::clipRegion(cr, mrCairoCommon.m_aClipRegion); } diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index a54977874eef..e84ea8e1266e 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -95,21 +95,10 @@ namespace X11SalGraphicsImpl::X11SalGraphicsImpl(X11SalGraphics& rParent): mrParent(rParent), - moBrushColor( std::in_place, 0xFF, 0xFF, 0XFF ), - mpBrushGC(nullptr), - mnBrushPixel(0), - mbPenGC(false), - mbBrushGC(false), mbCopyGC(false), mbInvertGC(false), - mbInvert50GC(false), mbStippleGC(false), - mbTrackingGC(false), - mbDitherBrush(false), mbXORMode(false), - mpPenGC(nullptr), - moPenColor( std::in_place, 0x00, 0x00, 0x00 ), - mnPenPixel(0), mpCopyGC(nullptr), mpInvertGC(nullptr), mpStippleGC(nullptr) @@ -122,8 +111,6 @@ X11SalGraphicsImpl::~X11SalGraphicsImpl() void X11SalGraphicsImpl::Init() { - mnPenPixel = moPenColor ? mrParent.GetPixel(*moPenColor) : 0; - mnBrushPixel = moBrushColor ? mrParent.GetPixel(*moBrushColor) : 0; } XID X11SalGraphicsImpl::GetXRenderPicture() @@ -164,12 +151,10 @@ void X11SalGraphicsImpl::freeResources() { Display *pDisplay = mrParent.GetXDisplay(); - freeGC( pDisplay, mpPenGC ); - freeGC( pDisplay, mpBrushGC ); freeGC( pDisplay, mpCopyGC ); freeGC( pDisplay, mpInvertGC ); freeGC( pDisplay, mpStippleGC ); - mbTrackingGC = mbPenGC = mbBrushGC = mbCopyGC = mbInvertGC = mbInvert50GC = mbStippleGC = false; + mbCopyGC = mbInvertGC = mbStippleGC = false; } GC X11SalGraphicsImpl::CreateGC( Drawable hDrawable, unsigned long nMask ) @@ -238,73 +223,6 @@ inline GC X11SalGraphicsImpl::GetStippleGC() return mpStippleGC; } -GC X11SalGraphicsImpl::SelectBrush() -{ - Display *pDisplay = mrParent.GetXDisplay(); - - SAL_WARN_IF( !moBrushColor, "vcl", "Brush Transparent" ); - - if( !mpBrushGC ) - { - XGCValues values; - values.subwindow_mode = ClipByChildren; - values.fill_rule = EvenOddRule; // Pict import/ Gradient - values.graphics_exposures = False; - - mpBrushGC = XCreateGC( pDisplay, mrParent.GetDrawable(), - GCSubwindowMode | GCFillRule | GCGraphicsExposures, - &values ); - } - - if( !mbBrushGC ) - { - if( !mbDitherBrush ) - { - XSetFillStyle ( pDisplay, mpBrushGC, FillSolid ); - XSetForeground( pDisplay, mpBrushGC, mnBrushPixel ); - } - else - { - XSetFillStyle ( pDisplay, mpBrushGC, FillTiled ); - XSetTile ( pDisplay, mpBrushGC, mrParent.hBrush_ ); - } - XSetFunction ( pDisplay, mpBrushGC, mbXORMode ? GXxor : GXcopy ); - mrParent.SetClipRegion( mpBrushGC ); - - mbBrushGC = true; - } - - return mpBrushGC; -} - -GC X11SalGraphicsImpl::SelectPen() -{ - Display *pDisplay = mrParent.GetXDisplay(); - - if( !mpPenGC ) - { - XGCValues values; - values.subwindow_mode = ClipByChildren; - values.fill_rule = EvenOddRule; // Pict import/ Gradient - values.graphics_exposures = False; - - mpPenGC = XCreateGC( pDisplay, mrParent.GetDrawable(), - GCSubwindowMode | GCFillRule | GCGraphicsExposures, - &values ); - } - - if( !mbPenGC ) - { - if( moPenColor ) - XSetForeground( pDisplay, mpPenGC, mnPenPixel ); - XSetFunction ( pDisplay, mpPenGC, mbXORMode ? GXxor : GXcopy ); - mrParent.SetClipRegion( mpPenGC ); - mbPenGC = true; - } - - return mpPenGC; -} - void X11SalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) { const SalDisplay* pSalDisp = mrParent.GetDisplay(); @@ -653,13 +571,9 @@ void X11SalGraphicsImpl::ResetClipRegion() if( !mrParent.mpClipRegion ) return; - mbPenGC = false; - mbBrushGC = false; mbCopyGC = false; mbInvertGC = false; - mbInvert50GC = false; mbStippleGC = false; - mbTrackingGC = false; XDestroyRegion( mrParent.mpClipRegion ); mrParent.mpClipRegion = nullptr; @@ -714,13 +628,9 @@ void X11SalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip ) //} // done, invalidate GCs - mbPenGC = false; - mbBrushGC = false; mbCopyGC = false; mbInvertGC = false; - mbInvert50GC = false; mbStippleGC = false; - mbTrackingGC = false; if( XEmptyRegion( mrParent.mpClipRegion ) ) { @@ -729,114 +639,14 @@ void X11SalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip ) } } -void X11SalGraphicsImpl::SetLineColor() -{ - if( moPenColor ) - { - moPenColor = std::nullopt; - mbPenGC = false; - } -} - -void X11SalGraphicsImpl::SetLineColor( Color nColor ) -{ - if( moPenColor != nColor ) - { - moPenColor = nColor; - mnPenPixel = mrParent.GetPixel( nColor ); - mbPenGC = false; - } -} - -void X11SalGraphicsImpl::SetFillColor() -{ - if( moBrushColor ) - { - mbDitherBrush = false; - moBrushColor = std::nullopt; - mbBrushGC = false; - } -} - -void X11SalGraphicsImpl::SetFillColor( Color nColor ) -{ - if( moBrushColor == nColor ) - return; - - mbDitherBrush = false; - moBrushColor = nColor; - mnBrushPixel = mrParent.GetPixel( nColor ); - if( TrueColor != mrParent.GetColormap().GetVisual().GetClass() - && mrParent.GetColormap().GetColor( mnBrushPixel ) != moBrushColor - && nColor != Color( 0x00, 0x00, 0x00 ) // black - && nColor != Color( 0x00, 0x00, 0x80 ) // blue - && nColor != Color( 0x00, 0x80, 0x00 ) // green - && nColor != Color( 0x00, 0x80, 0x80 ) // cyan - && nColor != Color( 0x80, 0x00, 0x00 ) // red - && nColor != Color( 0x80, 0x00, 0x80 ) // magenta - && nColor != Color( 0x80, 0x80, 0x00 ) // brown - && nColor != Color( 0x80, 0x80, 0x80 ) // gray - && nColor != Color( 0xC0, 0xC0, 0xC0 ) // light gray - && nColor != Color( 0x00, 0x00, 0xFF ) // light blue - && nColor != Color( 0x00, 0xFF, 0x00 ) // light green - && nColor != Color( 0x00, 0xFF, 0xFF ) // light cyan - && nColor != Color( 0xFF, 0x00, 0x00 ) // light red - && nColor != Color( 0xFF, 0x00, 0xFF ) // light magenta - && nColor != Color( 0xFF, 0xFF, 0x00 ) // light brown - && nColor != Color( 0xFF, 0xFF, 0xFF ) ) - mbDitherBrush = mrParent.GetDitherPixmap(nColor); - mbBrushGC = false; -} - -void X11SalGraphicsImpl::SetROPLineColor( SalROPColor nROPColor ) -{ - switch( nROPColor ) - { - case SalROPColor::N0 : // 0 - mnPenPixel = Pixel(0); - break; - case SalROPColor::N1 : // 1 - mnPenPixel = static_cast<Pixel>(1 << mrParent.GetVisual().GetDepth()) - 1; - break; - case SalROPColor::Invert : // 2 - mnPenPixel = static_cast<Pixel>(1 << mrParent.GetVisual().GetDepth()) - 1; - break; - } - moPenColor = mrParent.GetColormap().GetColor( mnPenPixel ); - mbPenGC = false; -} - -void X11SalGraphicsImpl::SetROPFillColor( SalROPColor nROPColor ) -{ - switch( nROPColor ) - { - case SalROPColor::N0 : // 0 - mnBrushPixel = Pixel(0); - break; - case SalROPColor::N1 : // 1 - mnBrushPixel = static_cast<Pixel>(1 << mrParent.GetVisual().GetDepth()) - 1; - break; - case SalROPColor::Invert : // 2 - mnBrushPixel = static_cast<Pixel>(1 << mrParent.GetVisual().GetDepth()) - 1; - break; - } - mbDitherBrush = false; - moBrushColor = mrParent.GetColormap().GetColor( mnBrushPixel ); - mbBrushGC = false; -} - void X11SalGraphicsImpl::SetXORMode( bool bSet, bool ) { if (mbXORMode != bSet) { mbXORMode = bSet; - mbPenGC = false; - mbBrushGC = false; mbCopyGC = false; mbInvertGC = false; - mbInvert50GC = false; mbStippleGC = false; - mbTrackingGC = false; } } diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index af5f8b029849..dfa55ae73c22 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -44,26 +44,12 @@ class X11SalGraphicsImpl : public SalGraphicsImpl, public X11GraphicsImpl private: X11SalGraphics& mrParent; - std::optional<Color> moBrushColor; - GC mpBrushGC; // Brush attributes - Pixel mnBrushPixel; - - bool mbPenGC : 1; // is Pen GC valid - bool mbBrushGC : 1; // is Brush GC valid bool mbCopyGC : 1; // is Copy GC valid bool mbInvertGC : 1; // is Invert GC valid - bool mbInvert50GC : 1; // is Invert50 GC valid bool mbStippleGC : 1; // is Stipple GC valid - bool mbTrackingGC : 1; // is Tracking GC valid - bool mbDitherBrush : 1; // is solid or tile bool mbXORMode : 1; // is ROP XOR Mode set - GC mpPenGC; // Pen attributes - std::optional<Color> moPenColor; - Pixel mnPenPixel; - - GC mpCopyGC; GC mpInvertGC; GC mpStippleGC; @@ -71,8 +57,6 @@ private: GC CreateGC( Drawable hDrawable, unsigned long nMask = GCGraphicsExposures ); - GC SelectBrush(); - GC SelectPen(); inline GC GetCopyGC(); inline GC GetStippleGC(); GC GetInvertGC(); @@ -106,29 +90,9 @@ public: // set the clip region to empty virtual void ResetClipRegion() override; - // set the line color to transparent (= don't draw lines) - - virtual void SetLineColor() override; - - // set the line color to a specific color - virtual void SetLineColor( Color nColor ) override; - - // set the fill color to transparent (= don't fill) - virtual void SetFillColor() override; - - // set the fill color to a specific color, shapes will be - // filled accordingly - virtual void SetFillColor( Color nColor ) override; - // enable/disable XOR drawing virtual void SetXORMode( bool bSet, bool bInvertOnly ) override; - // set line color for raster operations - virtual void SetROPLineColor( SalROPColor nROPColor ) override; - - // set fill color for raster operations - virtual void SetROPFillColor( SalROPColor nROPColor ) override; - virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override; virtual void drawBitmap(
