Simplify Sequences initializations (canvas)
Change-Id: I651858d71e378341205d6a785bd97f294664a439 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116737 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
parent
e9a824dd6c
commit
87e8d5ec6b
4 changed files with 37 additions and 42 deletions
|
@ -114,11 +114,8 @@ public:
|
|||
mRenderState.AffineTransform = geometry::AffineMatrix2D(2, 0, 0, 0, 2, 0);
|
||||
mViewState.AffineTransform = geometry::AffineMatrix2D(5, 0, 0, 0, 5, 0);
|
||||
|
||||
uno::Sequence<geometry::RealPoint2D> points(2);
|
||||
points[0] = geometry::RealPoint2D(10, 5);
|
||||
points[1] = geometry::RealPoint2D(88, 5);
|
||||
uno::Sequence<uno::Sequence<geometry::RealPoint2D>> polygonPoints(1);
|
||||
polygonPoints[0] = points;
|
||||
uno::Sequence<uno::Sequence<geometry::RealPoint2D>> polygonPoints{ { { 10, 5 },
|
||||
{ 88, 5 } } };
|
||||
uno::Reference<rendering::XLinePolyPolygon2D> polygon
|
||||
= mDevice->createCompatibleLinePolyPolygon(polygonPoints);
|
||||
polygon->setClosed(0, false);
|
||||
|
|
|
@ -404,23 +404,25 @@ namespace cairocanvas
|
|||
{
|
||||
if( rLeft.getLength() == 3 )
|
||||
{
|
||||
uno::Sequence<double> aRes(3);
|
||||
aRes[0] = basegfx::utils::lerp(rLeft[0],rRight[0],fAlpha);
|
||||
aRes[1] = basegfx::utils::lerp(rLeft[1],rRight[1],fAlpha);
|
||||
aRes[2] = basegfx::utils::lerp(rLeft[2],rRight[2],fAlpha);
|
||||
return aRes;
|
||||
return
|
||||
{
|
||||
basegfx::utils::lerp(rLeft[0],rRight[0],fAlpha),
|
||||
basegfx::utils::lerp(rLeft[1],rRight[1],fAlpha),
|
||||
basegfx::utils::lerp(rLeft[2],rRight[2],fAlpha)
|
||||
};
|
||||
}
|
||||
else if( rLeft.getLength() == 4 )
|
||||
{
|
||||
uno::Sequence<double> aRes(4);
|
||||
aRes[0] = basegfx::utils::lerp(rLeft[0],rRight[0],fAlpha);
|
||||
aRes[1] = basegfx::utils::lerp(rLeft[1],rRight[1],fAlpha);
|
||||
aRes[2] = basegfx::utils::lerp(rLeft[2],rRight[2],fAlpha);
|
||||
aRes[3] = basegfx::utils::lerp(rLeft[3],rRight[3],fAlpha);
|
||||
return aRes;
|
||||
return
|
||||
{
|
||||
basegfx::utils::lerp(rLeft[0],rRight[0],fAlpha),
|
||||
basegfx::utils::lerp(rLeft[1],rRight[1],fAlpha),
|
||||
basegfx::utils::lerp(rLeft[2],rRight[2],fAlpha),
|
||||
basegfx::utils::lerp(rLeft[3],rRight[3],fAlpha)
|
||||
};
|
||||
}
|
||||
|
||||
return uno::Sequence<double>();
|
||||
return {};
|
||||
}
|
||||
|
||||
static cairo_pattern_t* patternFromParametricPolyPolygon( ::canvas::ParametricPolyPolygon const & rPolygon )
|
||||
|
|
|
@ -349,14 +349,13 @@ namespace dxcanvas::tools
|
|||
uno::Sequence< sal_Int8 > argbToIntSequence( Gdiplus::ARGB rColor )
|
||||
{
|
||||
// TODO(F1): handle color space conversions, when defined on canvas/graphicDevice
|
||||
uno::Sequence< sal_Int8 > aRet(4);
|
||||
|
||||
aRet[0] = static_cast<sal_Int8>((rColor >> 16) & 0xFF); // red
|
||||
aRet[1] = static_cast<sal_Int8>((rColor >> 8) & 0xFF); // green
|
||||
aRet[2] = static_cast<sal_Int8>(rColor & 0xFF); // blue
|
||||
aRet[3] = static_cast<sal_Int8>((rColor >> 24) & 0xFF); // alpha
|
||||
|
||||
return aRet;
|
||||
return
|
||||
{
|
||||
static_cast<sal_Int8>((rColor >> 16) & 0xFF), // red
|
||||
static_cast<sal_Int8>((rColor >> 8) & 0xFF), // green
|
||||
static_cast<sal_Int8>(rColor & 0xFF), // blue
|
||||
static_cast<sal_Int8>((rColor >> 24) & 0xFF) // alpha
|
||||
};
|
||||
}
|
||||
|
||||
Gdiplus::ARGB sequenceToArgb( const uno::Sequence< sal_Int8 >& rColor )
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/random.hxx>
|
||||
#include <cppuhelper/bootstrap.hxx>
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <vcl/canvastools.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/vclmain.hxx>
|
||||
|
@ -155,17 +156,16 @@ class DemoRenderer
|
|||
|
||||
void drawRect( tools::Rectangle rRect, const uno::Sequence< double > &aColor, int /*nWidth*/ )
|
||||
{
|
||||
uno::Sequence< geometry::RealPoint2D > aPoints(4);
|
||||
uno::Reference< rendering::XLinePolyPolygon2D > xPoly;
|
||||
|
||||
aPoints[0] = geometry::RealPoint2D( rRect.Left(), rRect.Top() );
|
||||
aPoints[1] = geometry::RealPoint2D( rRect.Left(), rRect.Bottom() );
|
||||
aPoints[2] = geometry::RealPoint2D( rRect.Right(), rRect.Bottom() );
|
||||
aPoints[3] = geometry::RealPoint2D( rRect.Right(), rRect.Top() );
|
||||
|
||||
uno::Sequence< uno::Sequence< geometry::RealPoint2D > > aPolys(1);
|
||||
aPolys[0] = aPoints;
|
||||
xPoly = mxDevice->createCompatibleLinePolyPolygon( aPolys );
|
||||
uno::Sequence< uno::Sequence< geometry::RealPoint2D > > aPolys
|
||||
{
|
||||
{
|
||||
{ o3tl::narrowing<double>(rRect.Left()), o3tl::narrowing<double>(rRect.Top()) },
|
||||
{ o3tl::narrowing<double>(rRect.Left()), o3tl::narrowing<double>(rRect.Bottom()) },
|
||||
{ o3tl::narrowing<double>(rRect.Right()), o3tl::narrowing<double>(rRect.Bottom()) },
|
||||
{ o3tl::narrowing<double>(rRect.Right()), o3tl::narrowing<double>(rRect.Top()) }
|
||||
}
|
||||
};
|
||||
auto xPoly = mxDevice->createCompatibleLinePolyPolygon( aPolys );
|
||||
xPoly->setClosed( 0, true );
|
||||
|
||||
rendering::RenderState aRenderState( maRenderState );
|
||||
|
@ -241,8 +241,7 @@ class DemoRenderer
|
|||
}
|
||||
}
|
||||
|
||||
uno::Sequence< uno::Sequence< geometry::RealPoint2D > > aPolys(1);
|
||||
aPolys[0] = aPoints;
|
||||
uno::Sequence< uno::Sequence< geometry::RealPoint2D > > aPolys { aPoints };
|
||||
|
||||
xPoly = mxDevice->createCompatibleLinePolyPolygon( aPolys );
|
||||
xPoly->setClosed( 0, false );
|
||||
|
@ -399,8 +398,7 @@ class DemoRenderer
|
|||
r * 2 * sin((i*2*M_PI + 2*M_PI)/num_curves), //C1y
|
||||
r * 2 * cos((i*2*M_PI + 2*M_PI)/num_curves), //C2x
|
||||
r * 2 * sin((i*2*M_PI + 2*M_PI)/num_curves)); //C2y
|
||||
uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > aPolys(1);
|
||||
aPolys[0] = aBeziers;
|
||||
uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > aPolys { aBeziers };
|
||||
xPoly = mxDevice->createCompatibleBezierPolyPolygon(aPolys);
|
||||
xPoly->setClosed( 0, true );
|
||||
//uno::Reference< rendering::XBezierPolyPolygon2D> xPP( xPoly, uno::UNO_QUERY );
|
||||
|
@ -490,8 +488,7 @@ class DemoRenderer
|
|||
aPoints[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(1);
|
||||
aPolys[0] = aPoints;
|
||||
uno::Sequence< uno::Sequence< geometry::RealPoint2D > > aPolys { aPoints };
|
||||
xPoly = mxDevice->createCompatibleLinePolyPolygon( aPolys );
|
||||
xPoly->setClosed( 0, true );
|
||||
rendering::RenderState aRenderState( maRenderState );
|
||||
|
|
Loading…
Reference in a new issue