Commit Graph
256 Commits
Author SHA1 Message Date
Xisco Fauli 8c674c1a14 cid#1695417: silence Division or modulo by float zero
Change-Id: I82d38055cf8ed40afa4d64216fa77193280cabd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207948
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-11 09:11:18 +02:00
Andrea Gelmini d0aa314f2f Fix typo
Change-Id: I611cb79df4eec5f264f1ab0de4130ddf55cc8181
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206159
Reviewed-by: Dan Williams <dcbw@libreoffice.org>
Tested-by: Jenkins
2026-06-05 23:24:23 +02:00
Armin Le Grand (collabora) 52ec9f11d8 CairoSDPR: Improve buffering of huge BitmapData
We already did some improvements, but I wanted to clean
this up somewhat. Reason for the needed corrections was
in principle the sqrt()-based general calculation of
the HoldTime in the default implementation of
calculateCombinedHoldCyclesInSeconds. The original idea
was to hold huge data shorter due to memory constraints.
To solve that we added an adapted version to
CairoPixelProcessor2D.

With lessons learned I decided to remove that and
provide a revised general implementation based on linear
scaling of the HoldTime. Based on assuming the seen
huge Bitmap and estimating 20min for it, just create a
factor and multiply with SizeInBytes.

I checked that and it works as intended. It will spare
us from this problem re-occurring with future SDPRs.

NOTE: This still keeps the CairoSDPR-specific avoiding
of buffering of small Bitmaps when these are available
from Bitmap directly. This stays useful and is
Cairo-specific.

Signed-off-by: Armin Le Grand (collabora) <Armin.LeGrand@collabora.com>
Change-Id: I30c7361c6fbfaf0be90be353091cbaf831db5cd2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2005
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit a3d3ae5e931a04ff5718382ccffe9f16de336a42)
(cherry picked from commit 7550c6ea0bb82f7574e4b974f8d24bd1662a878b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205991
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-05 08:43:16 +02:00
Noel Grandin 6993d54041 std::lround is unnecessary here
because we are then casting to a type <=32 bits

Change-Id: Ief4a93724ccbae8d697edbd40e4085389d74473f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202156
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-03-19 15:27:43 +01:00
ayagamal-tech 9830fe8d39 tdf#146619 Remove unused #include b2dpolypolygontools.hxx from basegfx
Change-Id: I870d5c2964617eb4f615d63a16d9e380721c379f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198229
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
2026-01-30 18:45:15 +01:00
Tomaž Vajngerl d37666e14f basegfx: don't allow in-place changing of BColorStops externally
All the changes should go through BColorStops interface and not
directly.

Change-Id: I4c6dd42f8d6b6c43cdcf9d53557ccb12f8d0507c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195386
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
2025-12-15 04:07:44 +01:00
Tomaž Vajngerl 959decdcda basegfx: BColorStops shouldn't derive from std::vector
Change-Id: I9f246c0d9a5ddc7f8cf428bf7fc8c8957e8584b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158710
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
2025-12-08 13:40:28 +01:00
Noel Grandin 40e5bc6e68 lets have just one getB2DRange function/method
Change-Id: I5081abca177c6fb8bd21d971d93dc115d57de294
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192589
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-10-19 12:13:53 +02:00
Gabor Kelemen 9d371029dd tdf#146619 Run IWYU on basegfx/
Change-Id: If2facc4c6c53d1981fd19bee9be483551471f5bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188481
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2025-08-06 18:41:42 +02:00
Noel Grandin 437303ab97 add translate functions for B2D*Polygon
Change-Id: I1f9091c47f0145d6fa0a8bc2deb4864244aad896
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183309
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-03-26 15:06:24 +01:00
Noel Grandin e4e9d1d800 loplugin:reftotemp in basctl,basegfx
Change-Id: Ifbc294320cd717892544133e976ff776a0fdbd6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176243
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-11-08 08:40:57 +01:00
Caolán McNamara c93eb54c87 cid#1557618 COPY_INSTEAD_OF_MOVE
and

cid#1557535 COPY_INSTEAD_OF_MOVE
cid#1557520 COPY_INSTEAD_OF_MOVE
cid#1557513 COPY_INSTEAD_OF_MOVE
cid#1557503 COPY_INSTEAD_OF_MOVE
cid#1557487 COPY_INSTEAD_OF_MOVE
cid#1557483 COPY_INSTEAD_OF_MOVE
cid#1557479 COPY_INSTEAD_OF_MOVE
cid#1557474 COPY_INSTEAD_OF_MOVE
cid#1557461 COPY_INSTEAD_OF_MOVE
cid#1557446 COPY_INSTEAD_OF_MOVE
cid#1557445 COPY_INSTEAD_OF_MOVE
cid#1557441 COPY_INSTEAD_OF_MOVE
cid#1557435 COPY_INSTEAD_OF_MOVE
cid#1557433 COPY_INSTEAD_OF_MOVE
cid#1557429 COPY_INSTEAD_OF_MOVE
cid#1557375 COPY_INSTEAD_OF_MOVE
cid#1557372 COPY_INSTEAD_OF_MOVE
cid#1557356 COPY_INSTEAD_OF_MOVE
cid#1557350 COPY_INSTEAD_OF_MOVE
cid#1557344 COPY_INSTEAD_OF_MOVE
cid#1557339 COPY_INSTEAD_OF_MOVE
cid#1557332 COPY_INSTEAD_OF_MOVE
cid#1557330 COPY_INSTEAD_OF_MOVE
cid#1557328 COPY_INSTEAD_OF_MOVE
cid#1557323 COPY_INSTEAD_OF_MOVE
cid#1557315 COPY_INSTEAD_OF_MOVE
cid#1557313 COPY_INSTEAD_OF_MOVE
cid#1557304 COPY_INSTEAD_OF_MOVE
cid#1557297 COPY_INSTEAD_OF_MOVE
cid#1557291 COPY_INSTEAD_OF_MOVE
cid#1557290 COPY_INSTEAD_OF_MOVE
cid#1557271 COPY_INSTEAD_OF_MOVE
cid#1557266 COPY_INSTEAD_OF_MOVE
cid#1557262 COPY_INSTEAD_OF_MOVE
cid#1557259 COPY_INSTEAD_OF_MOVE
cid#1557246 COPY_INSTEAD_OF_MOVE
cid#1557242 COPY_INSTEAD_OF_MOVE
cid#1557241 COPY_INSTEAD_OF_MOVE
cid#1557236 COPY_INSTEAD_OF_MOVE
cid#1557228 COPY_INSTEAD_OF_MOVE
cid#1557225 COPY_INSTEAD_OF_MOVE
cid#1557221 COPY_INSTEAD_OF_MOVE
cid#1557217 COPY_INSTEAD_OF_MOVE
cid#1557213 COPY_INSTEAD_OF_MOVE
cid#1557211 COPY_INSTEAD_OF_MOVE
cid#1557209 COPY_INSTEAD_OF_MOVE
cid#1557205 COPY_INSTEAD_OF_MOVE
cid#1557204 COPY_INSTEAD_OF_MOVE
cid#1557193 COPY_INSTEAD_OF_MOVE
cid#1556082 COPY_INSTEAD_OF_MOVE

Change-Id: I07f195a79a69d4bac0d14317854efc88d6fe94d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171927
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-16 09:30:37 +02:00
Caolán McNamara d7056b1456 cid#1558088 COPY_INSTEAD_OF_MOVE
and

cid#1558080 COPY_INSTEAD_OF_MOVE
cid#1558077 COPY_INSTEAD_OF_MOVE
cid#1558055 COPY_INSTEAD_OF_MOVE
cid#1558043 COPY_INSTEAD_OF_MOVE
cid#1558039 COPY_INSTEAD_OF_MOVE
cid#1558015 COPY_INSTEAD_OF_MOVE
cid#1558014 COPY_INSTEAD_OF_MOVE
cid#1558009 COPY_INSTEAD_OF_MOVE
cid#1558002 COPY_INSTEAD_OF_MOVE
cid#1557998 COPY_INSTEAD_OF_MOVE
cid#1557996 COPY_INSTEAD_OF_MOVE
cid#1557990 COPY_INSTEAD_OF_MOVE
cid#1557986 COPY_INSTEAD_OF_MOVE
cid#1557980 COPY_INSTEAD_OF_MOVE
cid#1557971 COPY_INSTEAD_OF_MOVE
cid#1557968 COPY_INSTEAD_OF_MOVE
cid#1557967 COPY_INSTEAD_OF_MOVE
cid#1557961 COPY_INSTEAD_OF_MOVE
cid#1557959 COPY_INSTEAD_OF_MOVE
cid#1557958 COPY_INSTEAD_OF_MOVE
cid#1557956 COPY_INSTEAD_OF_MOVE
cid#1557953 COPY_INSTEAD_OF_MOVE
cid#1557949 COPY_INSTEAD_OF_MOVE
cid#1557947 COPY_INSTEAD_OF_MOVE
cid#1557940 COPY_INSTEAD_OF_MOVE
cid#1557931 COPY_INSTEAD_OF_MOVE
cid#1557930 COPY_INSTEAD_OF_MOVE
cid#1557915 COPY_INSTEAD_OF_MOVE
cid#1557913 COPY_INSTEAD_OF_MOVE
cid#1557910 COPY_INSTEAD_OF_MOVE
cid#1557886 COPY_INSTEAD_OF_MOVE
cid#1557884 COPY_INSTEAD_OF_MOVE
cid#1557880 COPY_INSTEAD_OF_MOVE
cid#1557875 COPY_INSTEAD_OF_MOVE
cid#1557871 COPY_INSTEAD_OF_MOVE
cid#1557862 COPY_INSTEAD_OF_MOVE
cid#1557847 COPY_INSTEAD_OF_MOVE
cid#1557845 COPY_INSTEAD_OF_MOVE
cid#1557844 COPY_INSTEAD_OF_MOVE
cid#1557843 COPY_INSTEAD_OF_MOVE
cid#1557838 COPY_INSTEAD_OF_MOVE
cid#1557835 COPY_INSTEAD_OF_MOVE
cid#1557834 COPY_INSTEAD_OF_MOVE
cid#1557828 COPY_INSTEAD_OF_MOVE
cid#1557823 COPY_INSTEAD_OF_MOVE
cid#1557817 COPY_INSTEAD_OF_MOVE
cid#1557813 COPY_INSTEAD_OF_MOVE
cid#1557812 COPY_INSTEAD_OF_MOVE

Change-Id: I55d4a920daa2d148683419169eb828325fd3c757
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171732
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-11 20:14:54 +02:00
Caolán McNamara 07d3577569 cid#1555417 COPY_INSTEAD_OF_MOVE
and

cid#1555423 COPY_INSTEAD_OF_MOVE
cid#1555430 COPY_INSTEAD_OF_MOVE
cid#1555436 COPY_INSTEAD_OF_MOVE
cid#1555440 COPY_INSTEAD_OF_MOVE
cid#1555443 COPY_INSTEAD_OF_MOVE
cid#1555454 COPY_INSTEAD_OF_MOVE
cid#1555459 COPY_INSTEAD_OF_MOVE
cid#1555461 COPY_INSTEAD_OF_MOVE
cid#1555468 COPY_INSTEAD_OF_MOVE
cid#1555477 COPY_INSTEAD_OF_MOVE
cid#1555484 COPY_INSTEAD_OF_MOVE
cid#1555511 COPY_INSTEAD_OF_MOVE
cid#1555515 COPY_INSTEAD_OF_MOVE
cid#1555519 COPY_INSTEAD_OF_MOVE
cid#1555534 COPY_INSTEAD_OF_MOVE
cid#1555537 COPY_INSTEAD_OF_MOVE
cid#1555544 COPY_INSTEAD_OF_MOVE
cid#1555553 COPY_INSTEAD_OF_MOVE
cid#1555559 COPY_INSTEAD_OF_MOVE
cid#1555561 COPY_INSTEAD_OF_MOVE
cid#1555563 COPY_INSTEAD_OF_MOVE
cid#1555564 COPY_INSTEAD_OF_MOVE
cid#1555568 COPY_INSTEAD_OF_MOVE
cid#1555571 COPY_INSTEAD_OF_MOVE
cid#1555580 COPY_INSTEAD_OF_MOVE

Change-Id: Ia42a78bffddc80d0e82144f4db51dc6e4d2e9a1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171237
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-31 09:33:06 +02:00
Armin Le Grand (Collabora) a073b61339 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>
2024-07-16 13:10:10 +02:00
Armin Le Grand (allotropia) f74bb604ff Make SystemDependentData mechanism type-based
Up to now that genereal buffering mechanism used
typeid.*hash_code to identify the class. As we
have learned this is not safe. Thus I changed it
to use enum'ed SystemDependentDataType definitions

Change-Id: I803912ec419290db1d40bae0bc41364fad64cbfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170385
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-07-12 17:59:50 +02:00
Caolán McNamara aac1adf9c5 cid#1554691 COPY_INSTEAD_OF_MOVE
Change-Id: I49597d2f1dc09e843951d10618aa75f702dc70eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170190
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-09 12:08:41 +02:00
Armin Le Grand (Collabora) 8a6fb1793d SDPRCairo: enhance CairoPixelProcessor2D
Added and corrected quite some stuff to this basic
construct provided by Caolan (thanks again!). No
detailed descriptions here, but it's getting more
complete and faster.

May contain errors and is primitive-complete in the
sense that all gets rendered, but some basic stuff
that should be directly supported is still missing,
e.g. text rendering.

Adding this to allow people to check it out (speed)
also since it's not yet used as default in master,
so it's safe and also safes the changes publically.

To test it, use TEST_SYSTEM_PRIMITIVE_RENDERER as
set EnvVar in linux systems.

Change-Id: I25f795c9ea4ad4f3b99591304f8803dffa499436
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168911
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-07-02 20:34:29 +02:00
Noel Grandin 4ee0461287 loplugin:ostr basegfx
Change-Id: I79212cbfd1c7cae810f8e24dbd73372b9f97f9ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167190
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-07 12:54:20 +02:00
Bogdan Buzea b0f26f460c tdf#160084 Simplify comparison for basegfx::fTools
Change-Id: If1a2d000e7059856280bd1acb959b35c412777df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165184
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-26 17:26:53 +01:00
RMZeroFour 64a55911ea tdf#157664 Drop redundant operator != in basegfx module
As part of the efforts in #157664 to remove redundant definitions of
operator!=, to upgrade the codebase to C++20, this commit removes the
remaining definitions in the basegfx module.

Change-Id: I19f2b9ddf42185435313445c8395a851030e2149
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165199
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-03-23 11:17:06 +01:00
Andrea Gelmini 7ef7bdca3c Fix typo
Change-Id: Ib12a2b2f76f3819a3c0355f45ef56d3e861530a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164545
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-21 08:33:23 +01:00
Arnaud VERSINI be6243144e basegfx : use OUstring literal for XServiceInfo implementation
Change-Id: I18a17e38897c1feda7fbba330c14a79c9b6d6f93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164306
Tested-by: Jenkins
Reviewed-by: Arnaud Versini <arnaud.versini@pm.me>
2024-03-10 17:17:00 +01:00
Noel Grandin 7979508e43 Simplify some basegfx::fTools::*orEqual calls
Comparing with zero is simple - the implementation of basegfx::fTools::moreOrEqual
calls rtl_math_approxEqual eventually, which special-zases zero.

Change-Id: I62f10f63f103d91a201dfeb20e5b3f9010f377c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164526
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-07 12:53:27 +01:00
Tomaž Vajngerl 242bb3fdda move BGradient to awt::Gradient2 UNO conversion into docmodel
This is needed because the module dependencies are an issues if
the conversion is done in basegfx. The bigger issue will come when
the ComplexColor conversion will be done as basegfx can't depend on
docmodel because of circular dependencies.

The BGradient is also more suitable for docmodel anyway as the
previously it was part of the model and is not a basic (gfx)
type - however this doesn't move the whole BGradient into docmodel
yet.

Change-Id: Id91ce52232f89f00e09b451c13da36e2854ae14b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155674
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-21 09:27:12 +02:00
Tomaž Vajngerl f896bbcffe basegfx: replace typedef with a class B2ISize based on Size2D
Change-Id: Iaf7d02bb236f81a38a67a1430a718b6c3c78efae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139708
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-07-13 13:19:00 +02:00
Regina Henschel 2b1b2a758c tdf#155852 same method for StepCount in OOXML as in rendering
Rendering of stepped gradients uses a method that doesn't take the
color from a cut point, but before or after respectively. For example,
for StepCount 4, the colors at relative positions 0, 1/3, 2/3 and 1
are used. So sections are 'start color', '1/3 color', '2/3 color' and
'end color'. The output to OOXML now uses the same method. That way
rendering in a produced pptx-file is the same as in the original
odp-file. Since OOXML has nothing similar to StepCount, it is an export
only problem.

A second problem comes from the cuddle with StepCount in Gradient
struct in API and FillStepCount in shape property set. The
draw:gradient-stop-count attribute in ODF belongs to the graphic style
of the shape. The gradient definition itself in the <draw:gradient>
element has nothing about step count. When a file is opened, it can be
that the StepCount component in the Gradient struct still has the
default value 0, but the FillStepCount property has the correct value
of the shape.

The Gradient struct in the API should not have a component StepCount
to be compatible with ODF. But the API is published and changing that
struct is far-reaching in the code. So the fix here is not a general
solution but solves the problem for export to OOXML by reading the
FillStepCount property while exporting.

Change-Id: Ie1cafe6bdda7c4d74b05f279f0d8212ff67ecc92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153154
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2023-06-16 10:35:23 +02:00
Regina Henschel f3f64c7758 tdf155825 result same size in synchronize gradients
While synchronizing color and transparency gradients two new sequences
are generated. In case the last offsets where different, the remaining
stops where not copied to the new sequence and thus they had different
sizes which triggered an assert in oox/source/export/drawingml.cxx.

Change-Id: I446f8cfafb23735f06ad4e05eee8c922141b864d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153063
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-14 21:29:50 +02:00
Andrea Gelmini cdc015ffd4 Fix typo
Change-Id: Iaebe55927771985a6b574b2cb9410b0eb75441e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152789
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-09 17:57:39 +02:00
Andrea Gelmini e1dcf9464e Fix typo
Change-Id: Ib02cc0e9aaf286d8c39523ea352cfeec17a6336f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152788
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-09 17:57:06 +02:00
Armin Le Grand (allotropia) a6e72e2b31 MCGR: tdf#155479 repair gradient SVG export for MCGR
Unfortunately SVG export is based on metafiles and thus there
is (in principle) no way to get the BGradient/ColorStop/MCGR
data transfered as needed. For that, using UNO API to read the
model or using B2DPrimitives would help - as is better for the
export respectively.

Since there is not the time to re-design SVG export I added
this 'compromize' as a fix. It gets the needed data transported
over the metafile (that part is the compromize). It then
exports the MCGR data to SVG (at least - as was already there -
if it's a linear/axial gradient). This happens now with all
Gradient Stops when there is a MCGR gradient. That part is/will
hopefully be re-usable if SVG export  gets redesigned.

I also added a handling for StepCount feature, so when used (in
LO, others do not have that) 'hard' color stops get generated
to make the gradient look identical for SVG export.

Had to make adding of that extra-information in metafiles
dependent on exporting really to SVG. There are 51 cases which
use 'MetaActionType::COMMENT' which would potentially have
to be adapted.

Also added code to solve the problem for TransparencePrimitive2D
at VclMetafileProcessor2D::processTransparencePrimitive2D. This
will now - also only for SVG export - directly create the needed
MetaFloatTransparentAction and add additional MCGR information.
This will be used on SVG export to write a 'Mask' as was done
before. This is now capable of creating fill MCGR-Masks in
the sense that any number of TransparencyStops will be supported.

Change-Id: Ic6d022714eae96b8fbc09e60652851ac5799b757
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152623
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-06-09 10:17:07 +02:00
Armin Le Grand (allotropia) bda52485d6 MCGR: tdf#155537 correct usage of wrong result in tooling
Change-Id: I8f68ecc7ccaecf84abbcda1bcdd65e2295baaf0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152673
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-06-06 15:44:32 +02:00
Regina Henschel 6c49886ab4 tdf#155549 MCGR: Recreate 'axial' from symmetric 'linear'
When exporting a shape with an axial gradient fill to OOXML, it is
converted to a linear gradient with multiple color stops. Versions
before MCGR had recreated it as axial gradient on import from OOXML.
But now LO is able to handle multiple color stops and so the linear
gradient from OOXML is imported as linear gradient in LO.

When such file is then written as ODF, the multiple color stops are
in elements in extended namespace and versions before MCGR do not
understand them. They show only the first and last color (which are
equal) and the gradient is lost.

With this patch LO converts the linear gradient back to an axial gradient
on export to ODF. The exported axial gradient is rendered in a version
with MCGR same as the linear gradient when opening the OOXML file. The
difference is, that versions without MCGR now render an axial gradient
with two colors.

Change-Id: I2b416b4cdca75d8327107a4f259d63c2e6e97ac3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152574
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2023-06-05 17:34:57 +02:00
Mike Kaganski 44239426ad Use getXWeak in basegfx
Change-Id: I650a8fcefd179937bdcbb6088658aa960008794d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150834
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-28 10:04:12 +02:00
Armin Le Grand (allotropia) c2bea1bedd MCGR: Border restoration support
Due to tdf#155362 I added code to be able in case we
would need it to convert a BGradient using added
tooling from having offsets in the GradientSteps
and no border to adapted GradientSteps and border.

This is preferrable due to our GradientStyle_RECT
(and GradientStyle_ELLIPTICAL too) use that 'non-
linear' paint aka move-two-pixels-inside, someone
else called it 'frame-paint'. This does not bode
well with the border being applied 'linear' at the
same time (argh). Thus - while in principle all is
correct when re-importing a GradientStyle_RECT
with a border after export to pptx, it looks
slightly better ('correcter') wen doing so. That is
because when being able to and restoring a border
at least that border part *is* applied linearly.

I took the chance to further apply tooling, move
it to classes involved and instead of awt::Gradient2
use more basegfx::BGradient since it can and does
host tooling. This is also a preparation to be
able to adapt (restore) border in case of turn-
around in ODF where the importing instance is before
MCGR existance and has to handle Start/EndColor.

Needed to take more care with using BGradient instead
of awt::Gradient2 for initialization, also better
dividing/organization of tooling, already preparation
to use for other purposes.

Change-Id: I2d3a4240a5ac6fff9211b46642ee80366dc09e3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152194
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-05-26 10:08:52 +02:00
Armin Le Grand (allotropia) 428b8a8d23 MCGR: Adaptions to WriteGradientFill and BGradient
Added code to make WriteGradientFill directly use the
available BGradient implementation. The goal is to
never directly work on awt::Gradient2, but use
BGradient & it's tooling methods.

Added constructors and tooling to BGradient and
BColorStops to make that easier (single line
conversions between uno::Any, basesgfx classes
and awt:: incarnations). Directly handle uno::Any
and awt:: classes, changed stuff to make use of
this.

Change-Id: I083a323b9efee8ca4f3becb2966aac0a294b9a60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151842
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-05-19 10:09:11 +02:00
Andrea Gelmini 68655b362f Fix typo
Change-Id: Id590b13237bc148dac955d6f4d56092f86d1dd16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151817
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-16 09:47:25 +02:00
Andrea Gelmini 8c76c0538d Fix typo
Change-Id: I5701a1fdfe9e4f139049ed6c0de1748ec7c06e07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151816
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-16 09:40:44 +02:00
Armin Le Grand (allotropia) 438f0752de MCGR: consolidations/cleanups for changes so far
Change-Id: I85cf40e4803b0485bb40349d8e81adc8123666c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151706
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-05-15 15:19:53 +02:00
Armin Le Grand (allotropia) 4409cd197d MCGR: 2nd corrections/adaptions to MCGR
Adapted handling of 'border' argument from our gradients
for oox export, so that it looks the same.

Also added quite some cases to peserve in-between
GradientStops for current UI implementations to be
able to edit the gradients as usual without losing
the in-between GradientStops.

While we will not be able to modify these, we are
at least able to modify all the other gradient
attributes, including start/endColor.

Done this for TransparencyGradients, too.

Also moved more stuff to the gradient tooling in
basegfx.

Change-Id: I6e94011bbf3715baa1401ab97e5b59811298342f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150577
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-19 20:43:45 +02:00
Andrea Gelmini 3e8a356f5c Fix typos
Change-Id: I7f8fa704199865e67c0543f92f89f63765c8c2ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150406
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-14 14:27:49 +02:00
Andrea Gelmini d1e97808f5 Fix typo
Change-Id: Idb607f8d35163de55e29415efe8a3cfb029eb9e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150403
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-14 14:26:41 +02:00
Andrea Gelmini ac9cdc995b Fix typos
Change-Id: I2b087d0f97c675cfedd4e2e78c7f827df4605fb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150407
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-14 14:24:39 +02:00
Armin Le Grand (allotropia) 70684ab604 MCGR: Adaptions to oox export
This is a 1st version and might need more fine-tuning,
so it is still 'hidden' behind the MCGR_TEST env var
being set (as the import is, too).
Still, when used, it can now import a MCGR with
transparence and export it again. I will now do extended
testing/experimenting, fine-tuning where needed and
prepare final change/drive forward.
The current state in master should not be changed as
long as the mentioned env var is not set, but this
will need to be checked, too, due to changes to the
export api in oox.
Corrected an error in GetAlphaFromTransparenceGradient
method(s), css::rendering::RGBColor is [0.0 .. 1.0]
Corercted an error in WriteSolidFill where transparence
gradient gets checked. This should really check if
TrGr is used, but only checks for 'empty/unused'
color instead (assuming COL_BLACK is 'unused').
All usages of GetAlphaFromTransparenceGradient should
be checked and adapted.
Change-Id: If59d7a06b9207e2efe9e71f3f8ddeca4476408f3

Change-Id: If97f8abdd0e1597aa1fd865b7e884e06a22b71f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150391
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-14 11:56:46 +02:00
Armin Le Grand (allotropia) a6cc4d851f MCGR: Moved color compare in common computation part
The colors of a ColorStopRange can be equal in case of
hit *and* miss, so in both cases. I moved it to the
common computation part. Prev version worked and did
no harm, but unnecessary color interpolations for equal
colors.

Change-Id: I19031f1021ee5955b48da5c0d8e3a03cb9512ebf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150046
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-06 10:40:49 +02:00
Andrea Gelmini 73d0723c46 Fix typo
Change-Id: I4ff8556c954cae844fa35385535cf9b6e9477e08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150033
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-04 21:26:49 +02:00
Andrea Gelmini 7e1138db4e Fix typo
Change-Id: I09163a500caf66c6ac2921dca3128997574d20d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150032
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-04 21:26:10 +02:00
Armin Le Grand (allotropia) 4b5203ebf4 MCGR: Improve performance for texture-mapped MCGR processing
Change-Id: I20b32e7c272112c6c3d9f7ee0ef59c6d4d006d94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150020
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-04 18:55:49 +02:00
Andrea Gelmini c2cc3e696e Fix typo
Change-Id: I49fe9dbdc11291c02be1dd5e41171a987d896008
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149997
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-03 20:32:21 +02:00
Armin Le Grand (allotropia) 64007cb308 MCGR: Unify Gradient intensity handling in tooling
Moved the Gradient intensity handling to tooling since
it is also needed for TransparencyGradients. Added
missing use of GradientStepCount for transparency.

Change-Id: I63ae6683fa0131be7faadc8572e19f5c43bf27e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149957
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-03 17:16:48 +02:00