From da44de883f205736fffeacc148c32dcfd638ad66 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Wed, 9 Jun 2021 19:02:52 +0200 Subject: Simplify Sequences initializations (sdext) Change-Id: Ide9a3ddd4f6915f45b02353293236988bff51eba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116935 Tested-by: Jenkins Reviewed-by: Julien Nabet --- sdext/source/presenter/PresenterGeometryHelper.cxx | 44 +++++++++++++--------- sdext/source/presenter/PresenterSlideShowView.cxx | 27 ++++++------- sdext/source/presenter/PresenterWindowManager.cxx | 27 ++++++------- 3 files changed, 55 insertions(+), 43 deletions(-) (limited to 'sdext') diff --git a/sdext/source/presenter/PresenterGeometryHelper.cxx b/sdext/source/presenter/PresenterGeometryHelper.cxx index 3d59f259ea7b..67a81d63c766 100644 --- a/sdext/source/presenter/PresenterGeometryHelper.cxx +++ b/sdext/source/presenter/PresenterGeometryHelper.cxx @@ -21,6 +21,8 @@ #include #include +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -183,12 +185,15 @@ Reference PresenterGeometryHelper::CreatePolygon( if ( ! rxDevice.is()) return nullptr; - Sequence > aPoints(1); - aPoints[0] = Sequence(4); - aPoints[0][0] = geometry::RealPoint2D(rBox.X, rBox.Y); - aPoints[0][1] = geometry::RealPoint2D(rBox.X, rBox.Y+rBox.Height); - aPoints[0][2] = geometry::RealPoint2D(rBox.X+rBox.Width, rBox.Y+rBox.Height); - aPoints[0][3] = geometry::RealPoint2D(rBox.X+rBox.Width, rBox.Y); + Sequence > aPoints + { + { + { o3tl::narrowing(rBox.X), o3tl::narrowing(rBox.Y) }, + { o3tl::narrowing(rBox.X), o3tl::narrowing(rBox.Y+rBox.Height) }, + { o3tl::narrowing(rBox.X+rBox.Width), o3tl::narrowing(rBox.Y+rBox.Height) }, + { o3tl::narrowing(rBox.X+rBox.Width), o3tl::narrowing(rBox.Y) } + } + }; Reference xPolygon ( rxDevice->createCompatibleLinePolyPolygon(aPoints)); if (xPolygon.is()) @@ -204,12 +209,15 @@ Reference PresenterGeometryHelper::CreatePolygon( if ( ! rxDevice.is()) return nullptr; - Sequence > aPoints(1); - aPoints[0] = Sequence(4); - aPoints[0][0] = geometry::RealPoint2D(rBox.X1, rBox.Y1); - aPoints[0][1] = geometry::RealPoint2D(rBox.X1, rBox.Y2); - aPoints[0][2] = geometry::RealPoint2D(rBox.X2, rBox.Y2); - aPoints[0][3] = geometry::RealPoint2D(rBox.X2, rBox.Y1); + Sequence > aPoints + { + { + { rBox.X1, rBox.Y1 }, + { rBox.X1, rBox.Y2 }, + { rBox.X2, rBox.Y2 }, + { rBox.X2, rBox.Y1 } + } + }; Reference xPolygon ( rxDevice->createCompatibleLinePolyPolygon(aPoints)); if (xPolygon.is()) @@ -230,11 +238,13 @@ Reference PresenterGeometryHelper::CreatePolygon( for (sal_Int32 nIndex=0; nIndex(4); - aPoints[nIndex][0] = geometry::RealPoint2D(rBox.X, rBox.Y); - aPoints[nIndex][1] = geometry::RealPoint2D(rBox.X, rBox.Y+rBox.Height); - aPoints[nIndex][2] = geometry::RealPoint2D(rBox.X+rBox.Width, rBox.Y+rBox.Height); - aPoints[nIndex][3] = geometry::RealPoint2D(rBox.X+rBox.Width, rBox.Y); + aPoints[nIndex] = Sequence + { + { o3tl::narrowing(rBox.X), o3tl::narrowing(rBox.Y) }, + { o3tl::narrowing(rBox.X), o3tl::narrowing(rBox.Y+rBox.Height) }, + { o3tl::narrowing(rBox.X+rBox.Width), o3tl::narrowing(rBox.Y+rBox.Height) }, + { o3tl::narrowing(rBox.X+rBox.Width), o3tl::narrowing(rBox.Y) } + }; } Reference xPolygon ( diff --git a/sdext/source/presenter/PresenterSlideShowView.cxx b/sdext/source/presenter/PresenterSlideShowView.cxx index 7ad4bc207645..26239c0b2642 100644 --- a/sdext/source/presenter/PresenterSlideShowView.cxx +++ b/sdext/source/presenter/PresenterSlideShowView.cxx @@ -666,20 +666,21 @@ void PresenterSlideShowView::PaintOuterWindow (const awt::Rectangle& rRepaintBox Reference xBackgroundBitmap (mpBackground->GetNormalBitmap()); if (xBackgroundBitmap.is()) { - Sequence aTextures (1); const geometry::IntegerSize2D aBitmapSize(xBackgroundBitmap->getSize()); - aTextures[0] = rendering::Texture ( - geometry::AffineMatrix2D( - aBitmapSize.Width,0,0, - 0,aBitmapSize.Height,0), - 1, - 0, - xBackgroundBitmap, - nullptr, - nullptr, - rendering::StrokeAttributes(), - rendering::TexturingMode::REPEAT, - rendering::TexturingMode::REPEAT); + Sequence aTextures + { + { + geometry::AffineMatrix2D( aBitmapSize.Width,0,0, 0,aBitmapSize.Height,0), + 1, + 0, + xBackgroundBitmap, + nullptr, + nullptr, + rendering::StrokeAttributes(), + rendering::TexturingMode::REPEAT, + rendering::TexturingMode::REPEAT + } + }; if (mxBackgroundPolygon1.is()) mxCanvas->fillTexturedPolyPolygon( diff --git a/sdext/source/presenter/PresenterWindowManager.cxx b/sdext/source/presenter/PresenterWindowManager.cxx index 5f89cdfccc29..f6ff53852ea6 100644 --- a/sdext/source/presenter/PresenterWindowManager.cxx +++ b/sdext/source/presenter/PresenterWindowManager.cxx @@ -925,20 +925,21 @@ void PresenterWindowManager::PaintBackground (const awt::Rectangle& rUpdateBox) if (mxScaledBackgroundBitmap.is()) { - Sequence aTextures (1); const geometry::IntegerSize2D aBitmapSize(mxScaledBackgroundBitmap->getSize()); - aTextures[0] = rendering::Texture ( - geometry::AffineMatrix2D( - aBitmapSize.Width,0,0, - 0,aBitmapSize.Height,0), - 1, - 0, - mxScaledBackgroundBitmap, - nullptr, - nullptr, - rendering::StrokeAttributes(), - rendering::TexturingMode::REPEAT, - rendering::TexturingMode::REPEAT); + Sequence aTextures + { + { + geometry::AffineMatrix2D( aBitmapSize.Width,0,0, 0,aBitmapSize.Height,0), + 1, + 0, + mxScaledBackgroundBitmap, + nullptr, + nullptr, + rendering::StrokeAttributes(), + rendering::TexturingMode::REPEAT, + rendering::TexturingMode::REPEAT + } + }; mxParentCanvas->fillTexturedPolyPolygon( xBackgroundPolygon, -- cgit v1.2.3