[Libreoffice-commits] core.git: vcl/qa vcl/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 11 13:32:53 UTC 2021


 vcl/qa/cppunit/canvasbitmaptest.cxx |   28 ++++++++++++++++++----------
 vcl/source/gdi/print.cxx            |    4 +---
 vcl/source/helper/canvastools.cxx   |   25 +++++++++++++------------
 3 files changed, 32 insertions(+), 25 deletions(-)

New commits:
commit 771c8282aadb45373fc6348cc70f4cd75a43a396
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Fri Jun 11 14:20:45 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri Jun 11 15:32:10 2021 +0200

    Simplify Sequences initializations (vcl)
    
    Change-Id: Id93bde17dbc4c71ad93bc094b94408fc9e39ec98
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117055
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index d77599e7b8a4..9b50282ee8b0 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -216,19 +216,27 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
     if( nOriginalDepth <= 8 )
         return;
 
-    uno::Sequence<rendering::ARGBColor> aARGBColor(1);
-    uno::Sequence<rendering::RGBColor>  aRGBColor(1);
     uno::Sequence<sal_Int8> aPixel3, aPixel4;
 
     const Color aCol(COL_GREEN);
-    aARGBColor[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
-    aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-    aARGBColor[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
-    aARGBColor[0].Alpha = 1.0;
-
-    aRGBColor[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
-    aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-    aRGBColor[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
+    uno::Sequence<rendering::ARGBColor> aARGBColor
+    {
+        {
+            1.0,
+            vcl::unotools::toDoubleColor(aCol.GetRed()),
+            vcl::unotools::toDoubleColor(aCol.GetGreen()),
+            vcl::unotools::toDoubleColor(aCol.GetBlue())
+        }
+    };
+
+    uno::Sequence<rendering::RGBColor>  aRGBColor
+    {
+        {
+            vcl::unotools::toDoubleColor(aCol.GetRed()),
+            vcl::unotools::toDoubleColor(aCol.GetGreen()),
+            vcl::unotools::toDoubleColor(aCol.GetBlue())
+        }
+    };
 
     aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor );
     aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) );
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index d7928956e9bd..652bc00c58be 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -123,17 +123,15 @@ void PrinterOptions::ReadFromConfig( bool i_bFile )
         {
             xConfigProvider = css::configuration::theDefaultProvider::get( xContext );
 
-            css::uno::Sequence< css::uno::Any > aArgs(1);
             css::beans::PropertyValue aVal;
             aVal.Name = "nodepath";
             if( i_bFile )
                 aVal.Value <<= OUString( "/org.openoffice.Office.Common/Print/Option/File" );
             else
                 aVal.Value <<= OUString( "/org.openoffice.Office.Common/Print/Option/Printer" );
-            aArgs.getArray()[0] <<= aVal;
             xConfigAccess.set(
                     xConfigProvider->createInstanceWithArguments(
-                        "com.sun.star.configuration.ConfigurationAccess", aArgs ),
+                        "com.sun.star.configuration.ConfigurationAccess", { css::uno::Any(aVal) } ),
                         css::uno::UNO_QUERY );
             if( xConfigAccess.is() )
             {
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index fef5500a8227..c547dace4a14 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -565,15 +565,13 @@ namespace vcl::unotools
 
         uno::Sequence< double > colorToStdColorSpaceSequence( const Color& rColor )
         {
-            uno::Sequence< double > aRet(4);
-            double* pRet = aRet.getArray();
-
-            pRet[0] = toDoubleColor(rColor.GetRed());
-            pRet[1] = toDoubleColor(rColor.GetGreen());
-            pRet[2] = toDoubleColor(rColor.GetBlue());
-            pRet[3] = toDoubleColor(rColor.GetAlpha());
-
-            return aRet;
+            return
+            {
+                toDoubleColor(rColor.GetRed()),
+                toDoubleColor(rColor.GetGreen()),
+                toDoubleColor(rColor.GetBlue()),
+                toDoubleColor(rColor.GetAlpha())
+            };
         }
 
         Color stdColorSpaceSequenceToColor( const uno::Sequence< double >& rColor        )
@@ -595,12 +593,15 @@ namespace vcl::unotools
             const Color&                                    rColor,
             const uno::Reference< rendering::XColorSpace >& xColorSpace )
         {
-            uno::Sequence<rendering::ARGBColor> aSeq(1);
-            aSeq[0] = rendering::ARGBColor(
+            uno::Sequence<rendering::ARGBColor> aSeq
+            {
+                {
                     toDoubleColor(rColor.GetAlpha()),
                     toDoubleColor(rColor.GetRed()),
                     toDoubleColor(rColor.GetGreen()),
-                    toDoubleColor(rColor.GetBlue()) );
+                    toDoubleColor(rColor.GetBlue())
+                }
+            };
 
             return xColorSpace->convertFromARGB(aSeq);
         }


More information about the Libreoffice-commits mailing list