EMF+ tdf#103859 Optimize EmfPlusFillRects and EmfPlusDrawRects

Change-Id: Iac96cf2d4291646fb69cc87c471d2f68ed905d69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151102
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
This commit is contained in:
Bartosz Kosiorek
2023-04-27 15:05:03 +02:00
parent bcccaf2322
commit b79a5cdcf0

View File

@@ -1255,7 +1255,9 @@ namespace emfplushelper
{
// Silent MSVC warning C4701: potentially uninitialized local variable 'brushIndexOrColor' used
sal_uInt32 brushIndexOrColor = 999;
sal_Int32 rectangles;
::basegfx::B2DPolyPolygon polyPolygon;
sal_uInt32 rectangles;
float x, y, width, height;
const bool isColor = (flags & 0x8000);
::basegfx::B2DPolygon polygon;
@@ -1270,11 +1272,9 @@ namespace emfplushelper
SAL_INFO("drawinglayer.emf", "EMF+\t DrawRects");
}
rMS.ReadInt32(rectangles);
for (int i = 0; i < rectangles; i++)
rMS.ReadUInt32(rectangles);
for (sal_uInt32 i = 0; i < rectangles; i++)
{
float x, y, width, height;
ReadRectangle(rMS, x, y, width, height, bool(flags & 0x4000));
polygon.clear();
polygon.append(Map(x, y));
@@ -1284,13 +1284,12 @@ namespace emfplushelper
polygon.setClosed(true);
SAL_INFO("drawinglayer.emf", "EMF+\t\t rectangle: " << x << ", "<< y << " " << width << "x" << height);
::basegfx::B2DPolyPolygon polyPolygon(polygon);
if (type == EmfPlusRecordTypeFillRects)
EMFPPlusFillPolygon(polyPolygon, isColor, brushIndexOrColor);
else
EMFPPlusDrawPolygon(polyPolygon, flags & 0xff);
polyPolygon.append(polygon);
}
if (type == EmfPlusRecordTypeFillRects)
EMFPPlusFillPolygon(polyPolygon, isColor, brushIndexOrColor);
else
EMFPPlusDrawPolygon(polyPolygon, flags & 0xff);
break;
}
case EmfPlusRecordTypeFillPolygon: