vcl/headless/CairoCommon.cxx | 101 ++++++++++++++ vcl/headless/SvpGraphicsBackend.cxx | 89 +----------- vcl/inc/headless/CairoCommon.hxx | 9 + vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx | 99 ++----------- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx | 4 vcl/unx/generic/gdi/gdiimpl.cxx | 172 ------------------------ vcl/unx/generic/gdi/gdiimpl.hxx | 9 - 7 files changed, 141 insertions(+), 342 deletions(-)
New commits: commit 1bac4efd7c468179e7530546e1e4ee2ae1e4de54 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Jan 5 11:45:05 2023 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Jan 6 08:48:33 2023 +0000 move drawPolyPolygon into CairoCommon and reuse from X11CairoSalGraphicsImpl Change-Id: I8eee16f10f4241ced467e2bf73e518d066f9508d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145111 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx index f50705b91584..291bc7e36380 100644 --- a/vcl/headless/CairoCommon.cxx +++ b/vcl/headless/CairoCommon.cxx @@ -687,6 +687,107 @@ void CairoCommon::drawLine(cairo_t* cr, basegfx::B2DRange* pExtents, const Color cairo_stroke(cr); } +void CairoCommon::drawPolyPolygon(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor, + const Color& rFillColor, bool bAntiAlias, sal_uInt32 nPoly, + const sal_uInt32* pPointCounts, const Point** pPtAry) +{ + basegfx::B2DPolyPolygon aPolyPoly; + for (sal_uInt32 nPolygon = 0; nPolygon < nPoly; ++nPolygon) + { + sal_uInt32 nPoints = pPointCounts[nPolygon]; + if (nPoints) + { + const Point* pPoints = pPtAry[nPolygon]; + basegfx::B2DPolygon aPoly; + aPoly.append(basegfx::B2DPoint(pPoints->getX(), pPoints->getY()), nPoints); + for (sal_uInt32 i = 1; i < nPoints; ++i) + aPoly.setB2DPoint(i, basegfx::B2DPoint(pPoints[i].getX(), pPoints[i].getY())); + + aPolyPoly.append(aPoly); + } + } + + drawPolyPolygon(cr, pExtents, rLineColor, rFillColor, bAntiAlias, basegfx::B2DHomMatrix(), + aPolyPoly, 0.0); +} + +bool CairoCommon::drawPolyPolygon(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor, + const Color& rFillColor, bool bAntiAlias, + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency) +{ + const bool bHasFill(rFillColor != SALCOLOR_NONE); + const bool bHasLine(rLineColor != SALCOLOR_NONE); + + if (0 == rPolyPolygon.count() || !(bHasFill || bHasLine) || fTransparency < 0.0 + || fTransparency >= 1.0) + { + return true; + } + + // don't bother trying to draw stuff which is effectively invisible + basegfx::B2DRange aPolygonRange = rPolyPolygon.getB2DRange(); + aPolygonRange.transform(rObjectToDevice); + if (aPolygonRange.getWidth() < 0.1 || aPolygonRange.getHeight() < 0.1) + return true; + + // Set full (Object-to-Device) transformation - if used + if (!rObjectToDevice.isIdentity()) + { + cairo_matrix_t aMatrix; + + cairo_matrix_init(&aMatrix, rObjectToDevice.get(0, 0), rObjectToDevice.get(1, 0), + rObjectToDevice.get(0, 1), rObjectToDevice.get(1, 1), + rObjectToDevice.get(0, 2), rObjectToDevice.get(1, 2)); + cairo_set_matrix(cr, &aMatrix); + } + + if (bHasFill) + { + add_polygon_path(cr, rPolyPolygon, rObjectToDevice, !bAntiAlias); + + CairoCommon::applyColor(cr, rFillColor, fTransparency); + if (pExtents) + { + // Get FillDamage (will be extended for LineDamage below) + *pExtents = getClippedFillDamage(cr); + } + + cairo_fill(cr); + } + + if (bHasLine) + { + // PixelOffset used: Set PixelOffset as linear transformation + cairo_matrix_t aMatrix; + cairo_matrix_init_translate(&aMatrix, 0.5, 0.5); + cairo_set_matrix(cr, &aMatrix); + + add_polygon_path(cr, rPolyPolygon, rObjectToDevice, !bAntiAlias); + + CairoCommon::applyColor(cr, rLineColor, fTransparency); + + if (pExtents) + { + // expand with possible StrokeDamage + basegfx::B2DRange stroke_extents = getClippedStrokeDamage(cr); + stroke_extents.transform(basegfx::utils::createTranslateB2DHomMatrix(0.5, 0.5)); + pExtents->expand(stroke_extents); + } + + cairo_stroke(cr); + } + + if (pExtents) + { + // if transformation has been applied, transform also extents (ranges) + // of damage so they can be correctly redrawn + pExtents->transform(rObjectToDevice); + } + + return true; +} + bool CairoCommon::drawPolyLine(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor, bool bAntiAlias, const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolygon& rPolyLine, double fTransparency, diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index efff52387575..0878930373e4 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -234,97 +234,32 @@ void SvpGraphicsBackend::drawPolygon(sal_uInt32 nPoints, const Point* pPtAry) void SvpGraphicsBackend::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPointCounts, const Point** pPtAry) { - basegfx::B2DPolyPolygon aPolyPoly; - for (sal_uInt32 nPolygon = 0; nPolygon < nPoly; ++nPolygon) - { - sal_uInt32 nPoints = pPointCounts[nPolygon]; - if (nPoints) - { - const Point* pPoints = pPtAry[nPolygon]; - basegfx::B2DPolygon aPoly; - aPoly.append(basegfx::B2DPoint(pPoints->getX(), pPoints->getY()), nPoints); - for (sal_uInt32 i = 1; i < nPoints; ++i) - aPoly.setB2DPoint(i, basegfx::B2DPoint(pPoints[i].getX(), pPoints[i].getY())); + cairo_t* cr = m_rCairoCommon.getCairoContext(true, getAntiAlias()); + basegfx::B2DRange extents; + m_rCairoCommon.clipRegion(cr); - aPolyPoly.append(aPoly); - } - } + CairoCommon::drawPolyPolygon(cr, &extents, m_rCairoCommon.m_aLineColor, + m_rCairoCommon.m_aFillColor, getAntiAlias(), nPoly, pPointCounts, + pPtAry); - drawPolyPolygon(basegfx::B2DHomMatrix(), aPolyPoly, 0.0); + m_rCairoCommon.releaseCairoContext(cr, true, extents); } bool SvpGraphicsBackend::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency) { - const bool bHasFill(m_rCairoCommon.m_aFillColor != SALCOLOR_NONE); - const bool bHasLine(m_rCairoCommon.m_aLineColor != SALCOLOR_NONE); - - if (0 == rPolyPolygon.count() || !(bHasFill || bHasLine) || fTransparency < 0.0 - || fTransparency >= 1.0) - { - return true; - } - - // don't bother trying to draw stuff which is effectively invisible - basegfx::B2DRange aPolygonRange = rPolyPolygon.getB2DRange(); - aPolygonRange.transform(rObjectToDevice); - if (aPolygonRange.getWidth() < 0.1 || aPolygonRange.getHeight() < 0.1) - return true; - cairo_t* cr = m_rCairoCommon.getCairoContext(true, getAntiAlias()); - m_rCairoCommon.clipRegion(cr); - - // Set full (Object-to-Device) transformation - if used - if (!rObjectToDevice.isIdentity()) - { - cairo_matrix_t aMatrix; - - cairo_matrix_init(&aMatrix, rObjectToDevice.get(0, 0), rObjectToDevice.get(1, 0), - rObjectToDevice.get(0, 1), rObjectToDevice.get(1, 1), - rObjectToDevice.get(0, 2), rObjectToDevice.get(1, 2)); - cairo_set_matrix(cr, &aMatrix); - } - - // To make releaseCairoContext work, use empty extents basegfx::B2DRange extents; + m_rCairoCommon.clipRegion(cr); - if (bHasFill) - { - add_polygon_path(cr, rPolyPolygon, rObjectToDevice, !getAntiAlias()); - - CairoCommon::applyColor(cr, m_rCairoCommon.m_aFillColor, fTransparency); - // Get FillDamage (will be extended for LineDamage below) - extents = getClippedFillDamage(cr); - - cairo_fill(cr); - } - - if (bHasLine) - { - // PixelOffset used: Set PixelOffset as linear transformation - cairo_matrix_t aMatrix; - cairo_matrix_init_translate(&aMatrix, 0.5, 0.5); - cairo_set_matrix(cr, &aMatrix); - - add_polygon_path(cr, rPolyPolygon, rObjectToDevice, !getAntiAlias()); - - CairoCommon::applyColor(cr, m_rCairoCommon.m_aLineColor, fTransparency); - - // expand with possible StrokeDamage - basegfx::B2DRange stroke_extents = getClippedStrokeDamage(cr); - stroke_extents.transform(basegfx::utils::createTranslateB2DHomMatrix(0.5, 0.5)); - extents.expand(stroke_extents); - - cairo_stroke(cr); - } + bool bRetVal(CairoCommon::drawPolyPolygon(cr, &extents, m_rCairoCommon.m_aLineColor, + m_rCairoCommon.m_aFillColor, getAntiAlias(), + rObjectToDevice, rPolyPolygon, fTransparency)); - // if transformation has been applied, transform also extents (ranges) - // of damage so they can be correctly redrawn - extents.transform(rObjectToDevice); m_rCairoCommon.releaseCairoContext(cr, true, extents); - return true; + return bRetVal; } bool SvpGraphicsBackend::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice, diff --git a/vcl/inc/headless/CairoCommon.hxx b/vcl/inc/headless/CairoCommon.hxx index 3e78b435dbc5..d9a4d8c60a72 100644 --- a/vcl/inc/headless/CairoCommon.hxx +++ b/vcl/inc/headless/CairoCommon.hxx @@ -161,6 +161,15 @@ struct VCL_DLLPUBLIC CairoCommon bool bAntiAlias, tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2); + static void drawPolyPolygon(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor, + const Color& rFillColor, bool bAntiAlias, sal_uInt32 nPoly, + const sal_uInt32* pPoints, const Point** pPtAry); + + static bool drawPolyPolygon(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor, + const Color& rFillColor, bool bAntiAlias, + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, double fTransparency); + // need this static version of ::drawPolyLine for usage from // vcl/unx/generic/gdi/salgdi.cxx. It gets wrapped by // ::drawPolyLine with some added parameters (see there) diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx index 2c85f690698d..d655b1d8fb16 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx @@ -30,99 +30,30 @@ X11CairoSalGraphicsImpl::X11CairoSalGraphicsImpl(X11SalGraphics& rParent, X11Com { } -bool X11CairoSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, - const basegfx::B2DPolyPolygon& rPolyPolygon, - double fTransparency) +void X11CairoSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point** pPtAry) { - if (fTransparency >= 1.0) - { - return true; - } - - if (rPolyPolygon.count() == 0) - { - return true; - } - - // Fallback: Transform to DeviceCoordinates - basegfx::B2DPolyPolygon aPolyPolygon(rPolyPolygon); - aPolyPolygon.transform(rObjectToDevice); - - if (SALCOLOR_NONE == mnFillColor && SALCOLOR_NONE == mnPenColor) - { - return true; - } + cairo_t* cr = mrX11Common.getCairoContext(mrParent.GetGeometryProvider()); + clipRegion(cr); - // snap to raster if requested - const bool bSnapPoints(!getAntiAlias()); + CairoCommon::drawPolyPolygon(cr, nullptr, mnPenColor, mnFillColor, getAntiAlias(), nPoly, + pPoints, pPtAry); - if (bSnapPoints) - { - aPolyPolygon = basegfx::utils::snapPointsOfHorizontalOrVerticalEdges(aPolyPolygon); - } + X11Common::releaseCairoContext(cr); +} +bool X11CairoSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon& rPolyPolygon, + double fTransparency) +{ cairo_t* cr = mrX11Common.getCairoContext(mrParent.GetGeometryProvider()); clipRegion(cr); - for (auto const& rPolygon : std::as_const(aPolyPolygon)) - { - const sal_uInt32 nPointCount(rPolygon.count()); - - if (nPointCount) - { - const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nPointCount : nPointCount - 1); - - if (nEdgeCount) - { - basegfx::B2DCubicBezier aEdge; - - for (sal_uInt32 b = 0; b < nEdgeCount; ++b) - { - rPolygon.getBezierSegment(b, aEdge); - - if (!b) - { - const basegfx::B2DPoint aStart(aEdge.getStartPoint()); - cairo_move_to(cr, aStart.getX(), aStart.getY()); - } - - const basegfx::B2DPoint aEnd(aEdge.getEndPoint()); - - if (aEdge.isBezier()) - { - const basegfx::B2DPoint aCP1(aEdge.getControlPointA()); - const basegfx::B2DPoint aCP2(aEdge.getControlPointB()); - cairo_curve_to(cr, aCP1.getX(), aCP1.getY(), aCP2.getX(), aCP2.getY(), - aEnd.getX(), aEnd.getY()); - } - else - { - cairo_line_to(cr, aEnd.getX(), aEnd.getY()); - } - } - - cairo_close_path(cr); - } - } - } - - if (SALCOLOR_NONE != mnFillColor) - { - cairo_set_source_rgba(cr, mnFillColor.GetRed() / 255.0, mnFillColor.GetGreen() / 255.0, - mnFillColor.GetBlue() / 255.0, 1.0 - fTransparency); - cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD); - cairo_fill_preserve(cr); - } - - if (SALCOLOR_NONE != mnPenColor) - { - cairo_set_source_rgba(cr, mnPenColor.GetRed() / 255.0, mnPenColor.GetGreen() / 255.0, - mnPenColor.GetBlue() / 255.0, 1.0 - fTransparency); - cairo_stroke_preserve(cr); - } + bool bRetVal(CairoCommon::drawPolyPolygon(cr, nullptr, mnPenColor, mnFillColor, getAntiAlias(), + rObjectToDevice, rPolyPolygon, fTransparency)); X11Common::releaseCairoContext(cr); - return true; + return bRetVal; } void X11CairoSalGraphicsImpl::drawPixel(tools::Long nX, tools::Long nY) diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index 314e441aaac6..8e8cf4c68b0f 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -32,7 +32,6 @@ private: Color mnPenColor; Color mnFillColor; - using X11SalGraphicsImpl::drawPolyPolygon; using X11SalGraphicsImpl::drawPolyLine; public: @@ -82,6 +81,9 @@ public: void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) override; + void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point** pPtAry) override; + bool drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency) override; diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 9f9f45afb4ad..fc24b6b9969a 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -1120,17 +1120,12 @@ void X11SalGraphicsImpl::drawRect( tools::Long nX, tools::Long nY, tools::Long n } void X11SalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const Point *pPtAry ) -{ - internalDrawPolyLine( nPoints, pPtAry, false ); -} - -void X11SalGraphicsImpl::internalDrawPolyLine( sal_uInt32 nPoints, const Point *pPtAry, bool bClose ) { if( mnPenColor != SALCOLOR_NONE ) { SalPolyLine Points( nPoints, pPtAry ); - DrawLines( nPoints, Points, SelectPen(), bClose ); + DrawLines( nPoints, Points, SelectPen(), false ); } } @@ -1200,53 +1195,6 @@ void X11SalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) DrawLines( nPoints, Points, SelectPen(), true ); } -void X11SalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, - const sal_uInt32 *pPoints, - const Point* *pPtAry ) -{ - if( mnBrushColor != SALCOLOR_NONE ) - { - sal_uInt32 i, n; - Region pXRegA = nullptr; - - for( i = 0; i < nPoly; i++ ) { - n = pPoints[i]; - SalPolyLine Points( n, pPtAry[i] ); - if( n > 2 ) - { - Region pXRegB = XPolygonRegion( &Points[0], n+1, WindingRule ); - if( !pXRegA ) - pXRegA = pXRegB; - else - { - XXorRegion( pXRegA, pXRegB, pXRegA ); - XDestroyRegion( pXRegB ); - } - } - } - - if( pXRegA ) - { - XRectangle aXRect; - XClipBox( pXRegA, &aXRect ); - - GC pGC = SelectBrush(); - mrParent.SetClipRegion( pGC, pXRegA ); // ??? twice - XDestroyRegion( pXRegA ); - mbBrushGC = false; - - XFillRectangle( mrParent.GetXDisplay(), - mrParent.GetDrawable(), - pGC, - aXRect.x, aXRect.y, aXRect.width, aXRect.height ); - } - } - - if( mnPenColor != SALCOLOR_NONE ) - for( sal_uInt32 i = 0; i < nPoly; i++ ) - internalDrawPolyLine( pPoints[i], pPtAry[i], true ); -} - bool X11SalGraphicsImpl::drawPolyLineBezier( sal_uInt32, const Point*, const PolyFlags* ) { return false; @@ -1320,57 +1268,6 @@ bool X11SalGraphicsImpl::drawEPS( tools::Long,tools::Long,tools::Long,tools::Lon return false; } -// draw a poly-polygon -bool X11SalGraphicsImpl::drawPolyPolygon( - const basegfx::B2DHomMatrix& rObjectToDevice, - const basegfx::B2DPolyPolygon& rPolyPolygon, - double fTransparency) -{ - // nothing to do for empty polypolygons - const int nOrigPolyCount = rPolyPolygon.count(); - if( nOrigPolyCount <= 0 ) - return true; - - // nothing to do if everything is transparent - if( (mnBrushColor == SALCOLOR_NONE) - && (mnPenColor == SALCOLOR_NONE) ) - return true; - - // cannot handle pencolor!=brushcolor yet - if( (mnPenColor != SALCOLOR_NONE) - && (mnPenColor != mnBrushColor) ) - return false; - - // TODO: remove the env-variable when no longer needed - static const char* pRenderEnv = getenv( "SAL_DISABLE_RENDER_POLY" ); - if( pRenderEnv ) - return false; - - // Fallback: Transform to DeviceCoordinates - basegfx::B2DPolyPolygon aPolyPolygon(rPolyPolygon); - aPolyPolygon.transform(rObjectToDevice); - - // snap to raster if requested - const bool bSnapToRaster = !mrParent.getAntiAlias(); - if( bSnapToRaster ) - aPolyPolygon = basegfx::utils::snapPointsOfHorizontalOrVerticalEdges( aPolyPolygon ); - - // don't bother with polygons outside of visible area - const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() ); - aPolyPolygon = basegfx::utils::clipPolyPolygonOnRange( aPolyPolygon, aViewRange, true, false ); - if( !aPolyPolygon.count() ) - return true; - - // tessellate the polypolygon into trapezoids - basegfx::B2DTrapezoidVector aB2DTrapVector; - basegfx::utils::trapezoidSubdivide( aB2DTrapVector, aPolyPolygon ); - const int nTrapCount = aB2DTrapVector.size(); - if( !nTrapCount ) - return true; - const bool bDrawn = drawFilledTrapezoids( aB2DTrapVector.data(), nTrapCount, fTransparency ); - return bDrawn; -} - tools::Long X11SalGraphicsImpl::GetGraphicsHeight() const { if( mrParent.m_pFrame ) @@ -1381,73 +1278,6 @@ tools::Long X11SalGraphicsImpl::GetGraphicsHeight() const return 0; } -bool X11SalGraphicsImpl::drawFilledTrapezoids( const basegfx::B2DTrapezoid* pB2DTraps, int nTrapCount, double fTransparency ) -{ - if( nTrapCount <= 0 ) - return true; - - Picture aDstPic = GetXRenderPicture(); - // check xrender support for this drawable - if( !aDstPic ) - return false; - - // convert the B2DTrapezoids into XRender-Trapezoids - std::vector<XTrapezoid> aTrapVector( nTrapCount ); - const basegfx::B2DTrapezoid* pB2DTrap = pB2DTraps; - for( int i = 0; i < nTrapCount; ++pB2DTrap, ++i ) - { - XTrapezoid& rTrap = aTrapVector[ i ] ; - - // set y-coordinates - const double fY1 = pB2DTrap->getTopY(); - rTrap.left.p1.y = rTrap.right.p1.y = rTrap.top = XDoubleToFixed( fY1 ); - const double fY2 = pB2DTrap->getBottomY(); - rTrap.left.p2.y = rTrap.right.p2.y = rTrap.bottom = XDoubleToFixed( fY2 ); - - // set x-coordinates - const double fXL1 = pB2DTrap->getTopXLeft(); - rTrap.left.p1.x = XDoubleToFixed( fXL1 ); - const double fXR1 = pB2DTrap->getTopXRight(); - rTrap.right.p1.x = XDoubleToFixed( fXR1 ); - const double fXL2 = pB2DTrap->getBottomXLeft(); - rTrap.left.p2.x = XDoubleToFixed( fXL2 ); - const double fXR2 = pB2DTrap->getBottomXRight(); - rTrap.right.p2.x = XDoubleToFixed( fXR2 ); - } - - // get xrender Picture for polygon foreground - // TODO: cache it like the target picture which uses GetXRenderPicture() - XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); - SalDisplay::RenderEntry& rEntry = mrParent.GetDisplay()->GetRenderEntries( mrParent.m_nXScreen )[ 32 ]; - if( !rEntry.m_aPicture ) - { - Display* pXDisplay = mrParent.GetXDisplay(); - - rEntry.m_aPixmap = limitXCreatePixmap( pXDisplay, mrParent.GetDrawable(), 1, 1, 32 ); - XRenderPictureAttributes aAttr; - aAttr.repeat = int(true); - - XRenderPictFormat* pXRPF = rRenderPeer.FindStandardFormat( PictStandardARGB32 ); - rEntry.m_aPicture = rRenderPeer.CreatePicture( rEntry.m_aPixmap, pXRPF, CPRepeat, &aAttr ); - } - - // set polygon foreground color and opacity - XRenderColor aRenderColor = GetXRenderColor( mnBrushColor , fTransparency ); - rRenderPeer.FillRectangle( PictOpSrc, rEntry.m_aPicture, &aRenderColor, 0, 0, 1, 1 ); - - // set clipping - // TODO: move into GetXRenderPicture? - if( mrParent.mpClipRegion && !XEmptyRegion( mrParent.mpClipRegion ) ) - rRenderPeer.SetPictureClipRegion( aDstPic, mrParent.mpClipRegion ); - - // render the trapezoids - const XRenderPictFormat* pMaskFormat = rRenderPeer.GetStandardFormatA8(); - rRenderPeer.CompositeTrapezoids( PictOpOver, - rEntry.m_aPicture, aDstPic, pMaskFormat, 0, 0, aTrapVector.data(), aTrapVector.size() ); - - return true; -} - bool X11SalGraphicsImpl::drawFilledTriangles( const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::triangulator::B2DTriangleVector& rTriangles, diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index 14220f2e0e78..7b8dca9f5009 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -90,7 +90,6 @@ private: ); XID GetXRenderPicture(); - bool drawFilledTrapezoids( const basegfx::B2DTrapezoid*, int nTrapCount, double fTransparency ); bool drawFilledTriangles( const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::triangulator::B2DTriangleVector& rTriangles, @@ -102,7 +101,6 @@ private: const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap ); - void internalDrawPolyLine( sal_uInt32 nPoints, const Point* pPtAry, bool bClose ); void internalDrawPixel( tools::Long nX, tools::Long nY ); void internalDrawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ); @@ -156,13 +154,6 @@ public: 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 bool drawPolyPolygon( - const basegfx::B2DHomMatrix& rObjectToDevice, - const basegfx::B2DPolyPolygon&, - double fTransparency) override; - virtual bool drawPolyLine( const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolygon&,