[Libreoffice-commits] core.git: sdext/source
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 9 19:28:55 UTC 2021
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(-)
New commits:
commit da44de883f205736fffeacc148c32dcfd638ad66
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Wed Jun 9 19:02:52 2021 +0200
Commit: Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Wed Jun 9 21:27:29 2021 +0200
Simplify Sequences initializations (sdext)
Change-Id: Ide9a3ddd4f6915f45b02353293236988bff51eba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116935
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
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,
More information about the Libreoffice-commits
mailing list