canvas/source/directx/dx_canvasbitmap.cxx       |   12 ++-------
 canvas/source/directx/dx_config.cxx             |   10 ++------
 canvas/source/factory/cf_service.cxx            |    6 +---
 canvas/source/simplecanvas/simplecanvasimpl.cxx |   30 ++++++++++--------------
 canvas/source/tools/canvastools.cxx             |    6 +---
 canvas/source/tools/parametricpolypolygon.cxx   |   14 ++++-------
 canvas/source/vcl/textlayout.cxx                |    3 +-
 canvas/workben/canvasdemo.cxx                   |   17 ++++++++-----
 8 files changed, 40 insertions(+), 58 deletions(-)

New commits:
commit 1a58461bfa3e980f3113a8a16c09cddda0606e7b
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Oct 28 16:12:28 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Oct 29 06:50:51 2021 +0200

    Prepare for removal of non-const operator[] from Sequence in canvas
    
    Change-Id: Ifb96e496b0994b5fc66975b7aea0a60bcb4a3a03
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124345
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/canvas/source/directx/dx_canvasbitmap.cxx 
b/canvas/source/directx/dx_canvasbitmap.cxx
index adc4b741a4c3..217d3edd2b7b 100644
--- a/canvas/source/directx/dx_canvasbitmap.cxx
+++ b/canvas/source/directx/dx_canvasbitmap.cxx
@@ -97,9 +97,7 @@ namespace dxcanvas
                     HBITMAP aHBmp;
                     mpBitmap->getBitmap()->GetHBITMAP(Gdiplus::Color(), &aHBmp 
);
 
-                    uno::Sequence< uno::Any > args(1);
-                    args[0] <<= reinterpret_cast<sal_Int64>(aHBmp);
-
+                    uno::Sequence< uno::Any > args{ 
uno::Any(reinterpret_cast<sal_Int64>(aHBmp)) };
                     aRes <<= args;
                 }
                 else
@@ -153,9 +151,7 @@ namespace dxcanvas
 
                     pGDIPlusBitmap->UnlockBits( &aBmpData );
 
-                    uno::Sequence< uno::Any > args(1);
-                    args[0] <<= reinterpret_cast<sal_Int64>(hBmpBitmap);
-
+                    uno::Sequence< uno::Any > args{ 
uno::Any(reinterpret_cast<sal_Int64>(hBmpBitmap)) };
                     aRes <<= args;
                 }
             }
@@ -230,9 +226,7 @@ namespace dxcanvas
                                aSize.getY(), pAlphaBits.get(),
                                reinterpret_cast<PBITMAPINFO>(&aDIB), 
DIB_RGB_COLORS );
 
-                    uno::Sequence< uno::Any > args(1);
-                    args[0] <<= reinterpret_cast<sal_Int64>(hBmpBitmap);
-
+                    uno::Sequence< uno::Any > args{ 
uno::Any(reinterpret_cast<sal_Int64>(hBmpBitmap)) };
                     aRes <<= args;
                 }
             }
diff --git a/canvas/source/directx/dx_config.cxx 
b/canvas/source/directx/dx_config.cxx
index 48609d8c500e..afb52de30f03 100644
--- a/canvas/source/directx/dx_config.cxx
+++ b/canvas/source/directx/dx_config.cxx
@@ -45,9 +45,7 @@ namespace dxcanvas
     {
         try
         {
-            uno::Sequence< OUString > aName { "DeviceDenylist" };
-
-            uno::Sequence< uno::Any > aProps( GetProperties( aName ));
+            uno::Sequence< uno::Any > aProps( GetProperties( { 
"DeviceDenylist" } ));
             uno::Sequence< sal_Int32 > aValues;
 
             if( aProps.getLength() > 0 &&
@@ -70,13 +68,11 @@ namespace dxcanvas
                 }
             }
 
-            aName[0] = "DenylistCurrentDevice";
-            aProps = GetProperties( aName );
+            aProps = GetProperties( { "DenylistCurrentDevice" } );
             if( aProps.getLength() > 0 )
                 aProps[0] >>= mbDenylistCurrentDevice;
 
-            aName[0] = "MaxTextureSize";
-            aProps = GetProperties( aName );
+            aProps = GetProperties( { "MaxTextureSize" } );
             if( aProps.getLength() > 0 )
                 maMaxTextureSize = aProps[0].get<sal_Int32>();
             else
diff --git a/canvas/source/factory/cf_service.cxx 
b/canvas/source/factory/cf_service.cxx
index d7e612cb6ca9..6cb27699864c 100644
--- a/canvas/source/factory/cf_service.cxx
+++ b/canvas/source/factory/cf_service.cxx
@@ -185,13 +185,11 @@ CanvasFactory::CanvasFactory( 
Reference<XComponentContext> const & xContext ) :
     {
         // Ugh. Looks like configuration is borked. Fake minimal
         // setup.
-        Sequence<OUString> aServices { 
"com.sun.star.comp.rendering.Canvas.VCL" };
         
m_aAvailableImplementations.emplace_back(OUString("com.sun.star.rendering.Canvas"),
-                                                              aServices );
+            Sequence<OUString>{ "com.sun.star.comp.rendering.Canvas.VCL" } );
 
-        aServices[0] = "com.sun.star.comp.rendering.SpriteCanvas.VCL";
         
m_aAvailableImplementations.emplace_back(OUString("com.sun.star.rendering.SpriteCanvas"),
-                                                              aServices );
+            Sequence<OUString>{ "com.sun.star.comp.rendering.SpriteCanvas.VCL" 
} );
     }
 }
 
diff --git a/canvas/source/simplecanvas/simplecanvasimpl.cxx 
b/canvas/source/simplecanvas/simplecanvasimpl.cxx
index 6182d4e2142b..18d2c0e9815d 100644
--- a/canvas/source/simplecanvas/simplecanvasimpl.cxx
+++ b/canvas/source/simplecanvas/simplecanvasimpl.cxx
@@ -45,29 +45,25 @@ namespace
     uno::Sequence< double > color2Sequence( sal_Int32 nColor )
     {
         // TODO(F3): Color management
-        uno::Sequence< double > aRes( 4 );
-
-        aRes[0] = static_cast<sal_uInt8>( (nColor&0xFF000000U) >> 24U ) / 
255.0;
-        aRes[1] = static_cast<sal_uInt8>( (nColor&0x00FF0000U) >> 16U ) / 
255.0;
-        aRes[2] = static_cast<sal_uInt8>( (nColor&0x0000FF00U) >>  8U ) / 
255.0;
-        aRes[3] = static_cast<sal_uInt8>( (nColor&0x000000FFU) )        / 
255.0;
-
+        uno::Sequence< double > aRes{
+            static_cast<sal_uInt8>( (nColor&0xFF000000U) >> 24U ) / 255.0,
+            static_cast<sal_uInt8>( (nColor&0x00FF0000U) >> 16U ) / 255.0,
+            static_cast<sal_uInt8>( (nColor&0x0000FF00U) >>  8U ) / 255.0,
+            static_cast<sal_uInt8>( (nColor&0x000000FFU) )        / 255.0
+        };
         return aRes;
     }
 
     uno::Reference< rendering::XPolyPolygon2D > rect2Poly( 
uno::Reference<rendering::XGraphicDevice> const& xDevice,
                                                                   
geometry::RealRectangle2D const&                 rRect )
     {
-        uno::Sequence< geometry::RealPoint2D > rectSequence( 4 );
-        geometry::RealPoint2D* pOutput = rectSequence.getArray();
-        pOutput[0] = geometry::RealPoint2D( rRect.X1, rRect.Y1 );
-        pOutput[1] = geometry::RealPoint2D( rRect.X2, rRect.Y1 );
-        pOutput[2] = geometry::RealPoint2D( rRect.X2, rRect.Y2 );
-        pOutput[3] = geometry::RealPoint2D( rRect.X1, rRect.Y2 );
-
-        uno::Sequence< uno::Sequence< geometry::RealPoint2D > > 
sequenceSequence( 1 );
-        sequenceSequence[0] = rectSequence;
-
+        uno::Sequence< geometry::RealPoint2D > rectSequence{
+            geometry::RealPoint2D( rRect.X1, rRect.Y1 ),
+            geometry::RealPoint2D( rRect.X2, rRect.Y1 ),
+            geometry::RealPoint2D( rRect.X2, rRect.Y2 ),
+            geometry::RealPoint2D( rRect.X1, rRect.Y2 )
+        };
+        uno::Sequence< uno::Sequence< geometry::RealPoint2D > > 
sequenceSequence{ rectSequence };
         uno::Reference< rendering::XPolyPolygon2D > xRes =
             xDevice->createCompatibleLinePolyPolygon( sequenceSequence );
         if( xRes.is() )
diff --git a/canvas/source/tools/canvastools.cxx 
b/canvas/source/tools/canvastools.cxx
index b9b6190df18d..f6182ae9b7b3 100644
--- a/canvas/source/tools/canvastools.cxx
+++ b/canvas/source/tools/canvastools.cxx
@@ -1092,10 +1092,8 @@ namespace canvas::tools
                     uno::Reference< beans::XPropertySet > xPropSet( xDevice,
                                                                     
uno::UNO_QUERY_THROW );
 
-                    o_rxParams.realloc( 2 );
-
-                    o_rxParams[ 0 ] <<= xServiceInfo->getImplementationName();
-                    o_rxParams[ 1 ] = xPropSet->getPropertyValue( 
"DeviceHandle" );
+                    o_rxParams = { 
uno::Any(xServiceInfo->getImplementationName()),
+                                   xPropSet->getPropertyValue( "DeviceHandle" 
) };
                 }
                 catch( const uno::Exception& )
                 {
diff --git a/canvas/source/tools/parametricpolypolygon.cxx 
b/canvas/source/tools/parametricpolypolygon.cxx
index c75d84348690..331b4e47535b 100644
--- a/canvas/source/tools/parametricpolypolygon.cxx
+++ b/canvas/source/tools/parametricpolypolygon.cxx
@@ -44,18 +44,14 @@ namespace canvas
         std::u16string_view rServiceName,
         const uno::Sequence< uno::Any >& rArgs )
     {
-        uno::Sequence< uno::Sequence< double > > colorSequence(2);
-        uno::Sequence< double > colorStops(2);
         double fAspectRatio=1.0;
 
         // defaults
-        uno::Sequence< rendering::RGBColor > rgbColors(1);
-        rgbColors[0] = rendering::RGBColor(0,0,0);
-        colorSequence[0] = 
rDevice->getDeviceColorSpace()->convertFromRGB(rgbColors);
-        rgbColors[0] = rendering::RGBColor(1,1,1);
-        colorSequence[1] = 
rDevice->getDeviceColorSpace()->convertFromRGB(rgbColors);
-        colorStops[0] = 0;
-        colorStops[1] = 1;
+        uno::Sequence< uno::Sequence< double > > colorSequence{
+            rDevice->getDeviceColorSpace()->convertFromRGB({ 
rendering::RGBColor(0,0,0) }),
+            rDevice->getDeviceColorSpace()->convertFromRGB({ 
rendering::RGBColor(1,1,1) })
+        };
+        uno::Sequence< double > colorStops{ 0, 1 };
 
         // extract args
         for( const uno::Any& rArg : rArgs )
diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx
index cb5fb09d2d83..42e96e420233 100644
--- a/canvas/source/vcl/textlayout.cxx
+++ b/canvas/source/vcl/textlayout.cxx
@@ -178,10 +178,11 @@ namespace vclcanvas
             aMetricVector))
         {
             aBoundingBoxes.realloc(aMetricVector.size());
+            auto pBoundingBoxes = aBoundingBoxes.getArray();
             sal_Int32 nIndex (0);
             for (auto const& metric : aMetricVector)
             {
-                aBoundingBoxes[nIndex++] = geometry::RealRectangle2D(
+                pBoundingBoxes[nIndex++] = geometry::RealRectangle2D(
                     metric.Left(),
                     metric.Top(),
                     metric.Right(),
diff --git a/canvas/workben/canvasdemo.cxx b/canvas/workben/canvasdemo.cxx
index 8efdee81f36a..031068adf9e9 100644
--- a/canvas/workben/canvasdemo.cxx
+++ b/canvas/workben/canvasdemo.cxx
@@ -211,27 +211,28 @@ class DemoRenderer
             int nLength = SAL_N_ELEMENTS( hilbert );
 
             uno::Sequence< geometry::RealPoint2D > aPoints( nLength );
+            auto pPoints = aPoints.getArray();
             uno::Reference< rendering::XLinePolyPolygon2D > xPoly;
 
-            aPoints[0] = geometry::RealPoint2D( anchor_x, anchor_y );
+            pPoints[0] = geometry::RealPoint2D( anchor_x, anchor_y );
             for (int i = 0; i < nLength; i++ )
             {
                 switch( hilbert[i] )
                 {
                     case 'u':
-                        aPoints[i+1] = geometry::RealPoint2D( aPoints[i].X,
+                        pPoints[i+1] = geometry::RealPoint2D( aPoints[i].X,
                                                             aPoints[i].Y - 
SCALE );
                         break;
                     case 'd':
-                        aPoints[i+1] = geometry::RealPoint2D( aPoints[i].X,
+                        pPoints[i+1] = geometry::RealPoint2D( aPoints[i].X,
                                                             aPoints[i].Y + 
SCALE );
                         break;
                     case 'l':
-                        aPoints[i+1] = geometry::RealPoint2D( aPoints[i].X - 
SCALE,
+                        pPoints[i+1] = geometry::RealPoint2D( aPoints[i].X - 
SCALE,
                                                             aPoints[i].Y );
                         break;
                     case 'r':
-                        aPoints[i+1] = geometry::RealPoint2D( aPoints[i].X + 
SCALE,
+                        pPoints[i+1] = geometry::RealPoint2D( aPoints[i].X + 
SCALE,
                                                             aPoints[i].Y );
                         break;
                 }
@@ -385,10 +386,11 @@ class DemoRenderer
 
             //hacky hack hack
             uno::Sequence< geometry::RealBezierSegment2D > aBeziers 
(num_curves);
+            auto pBeziers = aBeziers.getArray();
             uno::Reference< rendering::XBezierPolyPolygon2D > xPoly;
 
             for (int i= 0; i < num_curves; i++)
-                aBeziers[i]= geometry::RealBezierSegment2D( r * 
cos(i*2*M_PI/num_curves), //Px
+                pBeziers[i]= geometry::RealBezierSegment2D( r * 
cos(i*2*M_PI/num_curves), //Px
                                                             r * 
sin(i*2*M_PI/num_curves), //py
                                                             r * 2 * 
cos((i*2*M_PI + 2*M_PI)/num_curves),  //C1x
                                                             r * 2 * 
sin((i*2*M_PI + 2*M_PI)/num_curves),  //C1y
@@ -477,11 +479,12 @@ class DemoRenderer
         {
             //hacky hack hack
             uno::Sequence< geometry::RealPoint2D > aPoints (sides);
+            auto pPoints = aPoints.getArray();
             uno::Reference< rendering::XLinePolyPolygon2D > xPoly;
 
             for (int i= 0; i < sides; i++)
             {
-                aPoints[i]= geometry::RealPoint2D( centerx + r * cos(i*2 * 
M_PI/sides),
+                pPoints[i]= geometry::RealPoint2D( centerx + r * cos(i*2 * 
M_PI/sides),
                                                    centery + r * sin(i*2 * 
M_PI/sides));
             }
             uno::Sequence< uno::Sequence< geometry::RealPoint2D > > aPolys { 
aPoints };

Reply via email to