summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-29 08:11:39 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-29 13:15:06 +0200
commita9d314b57b8eb897f977e4c2062f72d85d0a7964 (patch)
treea4a7a6d66480774b52b5ba865ee10fbf83f1bb3e
parent894b4911ffb96ff667fdeb3aec7922316ab7230a (diff)
Prepare for removal of non-const operator[] from Sequence in cppcanvas
Change-Id: I2a16a8ea7776447592e51a23ce21aac0a156735f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124354 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--cppcanvas/qa/unit/test.cxx9
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx29
-rw-r--r--cppcanvas/source/mtfrenderer/polypolyaction.cxx4
-rw-r--r--cppcanvas/source/tools/tools.cxx13
4 files changed, 21 insertions, 34 deletions
diff --git a/cppcanvas/qa/unit/test.cxx b/cppcanvas/qa/unit/test.cxx
index 7c5ca6b9d2c6..303eecd86a16 100644
--- a/cppcanvas/qa/unit/test.cxx
+++ b/cppcanvas/qa/unit/test.cxx
@@ -62,11 +62,10 @@ void CanvasTest::testComposite()
{
// render something
rendering::RenderState aDefaultState;
- uno::Sequence< double > aRedTransparent( 4 );
- aRedTransparent[0] = 1.0; // R
- aRedTransparent[1] = 0.0; // G
- aRedTransparent[2] = 0.0; // B
- aRedTransparent[3] = 0.5; // A
+ uno::Sequence< double > aRedTransparent{ 1.0, // R
+ 0.0, // G
+ 0.0, // B
+ 0.5 }; // A
aDefaultState.DeviceColor = aRedTransparent;
#if 0
// words fail me to describe the sheer beauty of allocating a UNO
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 8c530c193cb4..3ea609e2530e 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -21,6 +21,7 @@
#include <tools/debug.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <cppcanvas/canvas.hxx>
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#include <com/sun/star/rendering/TexturingMode.hpp>
@@ -545,29 +546,18 @@ namespace cppcanvas::internal
vcl::unotools::colorToDoubleSequence( aVCLEndColor,
xColorSpace ));
- uno::Sequence< uno::Sequence < double > > aColors(2);
- uno::Sequence< double > aStops(2);
+ uno::Sequence< uno::Sequence < double > > aColors;
+ uno::Sequence< double > aStops;
if( rGradient.GetStyle() == GradientStyle::Axial )
{
- aStops.realloc(3);
- aColors.realloc(3);
-
- aStops[0] = 0.0;
- aStops[1] = 0.5;
- aStops[2] = 1.0;
-
- aColors[0] = aEndColor;
- aColors[1] = aStartColor;
- aColors[2] = aEndColor;
+ aStops = { 0.0, 0.5, 1.0 };
+ aColors = { aEndColor, aStartColor, aEndColor };
}
else
{
- aStops[0] = 0.0;
- aStops[1] = 1.0;
-
- aColors[0] = aStartColor;
- aColors[1] = aEndColor;
+ aStops = { 0.0, 1.0 };
+ aColors = { aStartColor, aEndColor };
}
const ::basegfx::B2DRectangle aBounds(
@@ -840,9 +830,8 @@ namespace cppcanvas::internal
if (rFont.GetEmphasisMark() != FontEmphasisMark::NONE)
{
- uno::Sequence< beans::PropertyValue > aProperties(1);
- aProperties[0].Name = "EmphasisMark";
- aProperties[0].Value <<= sal_uInt32(rFont.GetEmphasisMark());
+ uno::Sequence< beans::PropertyValue > aProperties{ comphelper::makePropertyValue(
+ "EmphasisMark", sal_uInt32(rFont.GetEmphasisMark())) };
return rParms.mrCanvas->getUNOCanvas()->createFont(aFontRequest,
aProperties,
aFontMatrix);
diff --git a/cppcanvas/source/mtfrenderer/polypolyaction.cxx b/cppcanvas/source/mtfrenderer/polypolyaction.cxx
index b69f14de774b..e191e512ec61 100644
--- a/cppcanvas/source/mtfrenderer/polypolyaction.cxx
+++ b/cppcanvas/source/mtfrenderer/polypolyaction.cxx
@@ -122,7 +122,7 @@ namespace cppcanvas::internal
// TODO(F1): Color management
// adapt fill color transparency
- maFillColor[3] = 1.0 - nTransparency / 100.0;
+ maFillColor.getArray()[3] = 1.0 - nTransparency / 100.0;
}
if( bStroke )
@@ -134,7 +134,7 @@ namespace cppcanvas::internal
// TODO(F1): Color management
// adapt fill color transparency
- maState.DeviceColor[3] = 1.0 - nTransparency / 100.0;
+ maState.DeviceColor.getArray()[3] = 1.0 - nTransparency / 100.0;
}
}
diff --git a/cppcanvas/source/tools/tools.cxx b/cppcanvas/source/tools/tools.cxx
index a41f40b145c3..d6775ba947d3 100644
--- a/cppcanvas/source/tools/tools.cxx
+++ b/cppcanvas/source/tools/tools.cxx
@@ -27,13 +27,12 @@ namespace cppcanvas::tools
{
uno::Sequence< double > intSRGBAToDoubleSequence( IntSRGBA aColor )
{
- uno::Sequence< double > aRes( 4 );
-
- aRes[0] = getRed(aColor) / 255.0;
- aRes[1] = getGreen(aColor) / 255.0;
- aRes[2] = getBlue(aColor) / 255.0;
- aRes[3] = getAlpha(aColor) / 255.0;
-
+ uno::Sequence< double > aRes{
+ getRed(aColor) / 255.0,
+ getGreen(aColor) / 255.0,
+ getBlue(aColor) / 255.0,
+ getAlpha(aColor) / 255.0
+ };
return aRes;
}