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>
This commit is contained in:
Mike Kaganski
2021-10-29 08:11:39 +03:00
parent 894b4911ff
commit a9d314b57b
4 changed files with 21 additions and 34 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -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;
}