emf+: read path gradient boundary points without point types

This is the variant of an array with no point-type bytes, but by default
EMFPPath::Read consumed trailing bytes as point types.

EMFPPath already has a way to set that the points are a plain
EmfPlusPointF array with no point-type bytes. So use that.

Then the GetRawPointsPolygon workaround is no longer needed.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0cfb9730efd2e9b638da9b2dc5118e4f05293fed
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9133
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 14c378ac439cdc0525d3f76509ca59090aa3b253)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209311
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Caolán McNamara
2026-08-19 12:29:51 +02:00
committed by Xisco Fauli
parent ea81d3165e
commit 1f486a45b1
4 changed files with 3 additions and 26 deletions
+1 -1
View File
@@ -193,7 +193,7 @@ namespace emfplushelper
return;
}
path.reset( new EMFPPath(boundaryPointCount) );
path.reset( new EMFPPath(boundaryPointCount, false/*bHasPointTypes*/) );
path->Read(s, 0x0);
s.Seek(pos + nBytesPerPoint * boundaryPointCount);
+2 -11
View File
@@ -978,9 +978,7 @@ namespace emfplushelper
return;
basegfx::B2DRange aBrushBounds(
(brush->additionalFlags & 0x01)
? brush->path->GetPolygon(*this, false).getB2DRange()
: brush->path->GetRawPointsPolygon().getB2DRange());
brush->path->GetPolygon(*this, false).getB2DRange());
if (aBrushBounds.getWidth() <= 0 || aBrushBounds.getHeight() <= 0)
return;
@@ -1011,15 +1009,8 @@ namespace emfplushelper
// segment rendering that GDI+ produces (red/green/blue
// points on a star with multiple surround colours, and
// smooth radial gradient on a uniform-surround brush).
// For boundary-only brushes (no BrushDataPath flag) the
// brush data stores raw EmfPlusPointF arrays without
// point types - GetPolygon() misinterprets the trailing
// bytes as Bezier point types and returns a degenerate
// polygon. Use the raw-points accessor instead.
basegfx::B2DPolygon aSweepPolygon
= (brush->additionalFlags & 0x01)
? brush->path->GetPolygon(*this, false).getB2DPolygon(0)
: brush->path->GetRawPointsPolygon();
= brush->path->GetPolygon(*this, false).getB2DPolygon(0);
// Flatten Bezier control points into straight-line
// segments so the triangulation has a fine-enough
// boundary. Without this, a 4-cardinal-vertex Bezier
-10
View File
@@ -146,16 +146,6 @@ namespace emfplushelper
aPolygon.clear();
}
::basegfx::B2DPolygon EMFPPath::GetRawPointsPolygon() const
{
::basegfx::B2DPolygon aOut;
for (sal_uInt32 i = 0; i < nPoints; ++i)
aOut.append(::basegfx::B2DPoint(xPoints[i], yPoints[i]));
if (nPoints >= 1)
aOut.setClosed(true);
return aOut;
}
::basegfx::B2DPolyPolygon& EMFPPath::GetPolygon (EmfPlusHelperData const & rR, bool bMapIt, bool bAddLineToCloseShape)
{
::basegfx::B2DPolygon polygon;
-4
View File
@@ -43,10 +43,6 @@ namespace emfplushelper
::basegfx::B2DPolyPolygon& GetCardinalSpline(EmfPlusHelperData const& rR, float fTension,
sal_uInt32 aOffset, sal_uInt32 aNumSegments);
::basegfx::B2DPolyPolygon& GetClosedCardinalSpline(EmfPlusHelperData const& rR, float fTension);
// Plain-vertex polygon (no Bezier-control / point-type
// interpretation). Useful for path-gradient boundary data which
// is stored as raw EmfPlusPointF arrays without point types.
::basegfx::B2DPolygon GetRawPointsPolygon() const;
};
}