summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorArmin Le Grand (Collabora) <Armin.Le.Grand@me.com>2024-07-15 18:55:56 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2024-07-16 13:10:10 +0200
commita073b6133960734b809c1bc93e39a76fdf1e7c15 (patch)
treed75a5e2dbeea7e35e5d2c8c0d56526656c212028 /basegfx
parentf10d51709d08bdafdbd5c92f73ddb62cb217b6dd (diff)
CairoSDPR: Direct support for RGBA Gradients (I)
Detect where created when a RGBA gradient could be used directly and create a primitive representing that, a PolyPolygonRGBAGradientPrimitive2D. That primitive decomposes to what was created before, so no primitive renderer has to be touched, all will work as before. NOTE: That helper primitive just holds references to what would be created anyways, so one depth step added but not really any additional data. This is the 1st step for direct support, the 2nd is to then detect and use that primitive in SDPR implementations directly. Change-Id: I4f247636ce58a8a1fd1e0df32dabed0d6cc10d0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170527 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/tools/bgradient.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/basegfx/source/tools/bgradient.cxx b/basegfx/source/tools/bgradient.cxx
index e27ab160463b..bac738ad3221 100644
--- a/basegfx/source/tools/bgradient.cxx
+++ b/basegfx/source/tools/bgradient.cxx
@@ -746,6 +746,25 @@ void BColorStops::tryToApplyBColorModifierStack(const BColorModifierStack& rBCol
}
}
+bool BColorStops::sameSizeAndDistances(const BColorStops& rComp) const
+{
+ if (size() != rComp.size())
+ {
+ return false;
+ }
+
+ BColorStops::const_iterator EntryA(begin());
+ BColorStops::const_iterator EntryB(rComp.begin());
+
+ while (EntryA != end() && fTools::equal(EntryA->getStopOffset(), EntryB->getStopOffset()))
+ {
+ EntryA++;
+ EntryB++;
+ }
+
+ return EntryA == end();
+}
+
std::string BGradient::GradientStyleToString(css::awt::GradientStyle eStyle)
{
switch (eStyle)