summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-06-09 19:02:52 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-06-09 21:27:29 +0200
commitda44de883f205736fffeacc148c32dcfd638ad66 (patch)
treedea77f479307779f4a3746d6889d96c46ae83f77 /sdext
parent53dd6aa5f3817d42bf676980f980051c3b7cdb03 (diff)
Simplify Sequences initializations (sdext)
Change-Id: Ide9a3ddd4f6915f45b02353293236988bff51eba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116935 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/presenter/PresenterGeometryHelper.cxx44
-rw-r--r--sdext/source/presenter/PresenterSlideShowView.cxx27
-rw-r--r--sdext/source/presenter/PresenterWindowManager.cxx27
3 files changed, 55 insertions, 43 deletions
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 <math.h>
#include <algorithm>
+#include <o3tl/safeint.hxx>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -183,12 +185,15 @@ Reference<rendering::XPolyPolygon2D> PresenterGeometryHelper::CreatePolygon(
if ( ! rxDevice.is())
return nullptr;
- Sequence<Sequence<geometry::RealPoint2D> > aPoints(1);
- aPoints[0] = Sequence<geometry::RealPoint2D>(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<Sequence<geometry::RealPoint2D> > aPoints
+ {
+ {
+ { o3tl::narrowing<double>(rBox.X), o3tl::narrowing<double>(rBox.Y) },
+ { o3tl::narrowing<double>(rBox.X), o3tl::narrowing<double>(rBox.Y+rBox.Height) },
+ { o3tl::narrowing<double>(rBox.X+rBox.Width), o3tl::narrowing<double>(rBox.Y+rBox.Height) },
+ { o3tl::narrowing<double>(rBox.X+rBox.Width), o3tl::narrowing<double>(rBox.Y) }
+ }
+ };
Reference<rendering::XLinePolyPolygon2D> xPolygon (
rxDevice->createCompatibleLinePolyPolygon(aPoints));
if (xPolygon.is())
@@ -204,12 +209,15 @@ Reference<rendering::XPolyPolygon2D> PresenterGeometryHelper::CreatePolygon(
if ( ! rxDevice.is())
return nullptr;
- Sequence<Sequence<geometry::RealPoint2D> > aPoints(1);
- aPoints[0] = Sequence<geometry::RealPoint2D>(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<Sequence<geometry::RealPoint2D> > aPoints
+ {
+ {
+ { rBox.X1, rBox.Y1 },
+ { rBox.X1, rBox.Y2 },
+ { rBox.X2, rBox.Y2 },
+ { rBox.X2, rBox.Y1 }
+ }
+ };
Reference<rendering::XLinePolyPolygon2D> xPolygon (
rxDevice->createCompatibleLinePolyPolygon(aPoints));
if (xPolygon.is())
@@ -230,11 +238,13 @@ Reference<rendering::XPolyPolygon2D> PresenterGeometryHelper::CreatePolygon(
for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
{
const awt::Rectangle& rBox (rBoxes[nIndex]);
- aPoints[nIndex] = Sequence<geometry::RealPoint2D>(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<geometry::RealPoint2D>
+ {
+ { o3tl::narrowing<double>(rBox.X), o3tl::narrowing<double>(rBox.Y) },
+ { o3tl::narrowing<double>(rBox.X), o3tl::narrowing<double>(rBox.Y+rBox.Height) },
+ { o3tl::narrowing<double>(rBox.X+rBox.Width), o3tl::narrowing<double>(rBox.Y+rBox.Height) },
+ { o3tl::narrowing<double>(rBox.X+rBox.Width), o3tl::narrowing<double>(rBox.Y) }
+ };
}
Reference<rendering::XLinePolyPolygon2D> 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<rendering::XBitmap> xBackgroundBitmap (mpBackground->GetNormalBitmap());
if (xBackgroundBitmap.is())
{
- Sequence<rendering::Texture> 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<rendering::Texture> 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<rendering::Texture> 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<rendering::Texture> 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,