[Libreoffice-commits] core.git: drawinglayer/source
Armin Le Grand (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 12 13:50:15 UTC 2020
drawinglayer/source/primitive2d/svggradientprimitive2d.cxx | 30 +++++++++----
1 file changed, 21 insertions(+), 9 deletions(-)
New commits:
commit c20e70d28df21429bba92b6d8a7d7061c2aa5d8b
Author: Armin Le Grand <Armin.Le.Grand at me.com>
AuthorDate: Thu Mar 12 13:31:44 2020 +0100
Commit: Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Thu Mar 12 14:49:39 2020 +0100
tdf#124424 Corrections at SvgGradientHelper for EMF+
Change-Id: Ibda3568887de5df2bc45a9bc8cb424ba7658a768
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90382
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand at me.com>
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 4367d8e3eb1a..20d3182e5ba8 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -240,29 +240,32 @@ namespace drawinglayer::primitive2d
double fStart,
double fEnd) const
{
+ double fInt(0.0);
+ double fFrac(0.0);
+ double fEnd2(0.0);
+
if(SpreadMethod::Pad == getSpreadMethod())
{
if(fStart < 0.0)
{
+ fFrac = std::modf(fStart, &fInt);
const SvgGradientEntry& rFront(getGradientEntries().front());
- const SvgGradientEntry aTemp(fStart, rFront.getColor(), rFront.getOpacity());
- createAtom(rTargetColor, rTargetOpacity, aTemp, rFront, 0, 0);
+ const SvgGradientEntry aTemp(1.0 + fFrac, rFront.getColor(), rFront.getOpacity());
+ createAtom(rTargetColor, rTargetOpacity, aTemp, rFront, static_cast<sal_Int32>(fInt - 1), 0);
fStart = rFront.getOffset();
}
- if(fEnd < 1.0)
+ if(fEnd > 1.0)
{
- const SvgGradientEntry& rBack(getGradientEntries().back());
- const SvgGradientEntry aTemp(fEnd, rBack.getColor(), rBack.getOpacity());
- createAtom(rTargetColor, rTargetOpacity, rBack, aTemp, 0, 0);
- fEnd = rBack.getOffset();
+ // change fEnd early, but create geometry later (after range below)
+ fEnd2 = fEnd;
+ fEnd = getGradientEntries().back().getOffset();
}
}
while(fStart < fEnd)
{
- double fInt(0.0);
- double fFrac(std::modf(fStart, &fInt));
+ fFrac = std::modf(fStart, &fInt);
if(fFrac < 0.0)
{
@@ -289,6 +292,15 @@ namespace drawinglayer::primitive2d
fStart += 1.0;
}
}
+
+ if(fEnd2 > 1.0)
+ {
+ // create end run for SpreadMethod::Pad late to keep correct creation order
+ fFrac = std::modf(fEnd2, &fInt);
+ const SvgGradientEntry& rBack(getGradientEntries().back());
+ const SvgGradientEntry aTemp(fFrac, rBack.getColor(), rBack.getOpacity());
+ createAtom(rTargetColor, rTargetOpacity, rBack, aTemp, 0, static_cast<sal_Int32>(fInt));
+ }
}
void SvgGradientHelper::createResult(
More information about the Libreoffice-commits
mailing list