summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-02-16 09:18:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-02-16 16:08:19 +0100
commitc4957b237eeb3e7895a102f9a01d7cf087cc5373 (patch)
treea0cb06f432ff0809765e25802f412dcc3c3e78cf /canvas
parent807317255a655372e3b602a80cec2989776804c5 (diff)
ofz#1473106 Uninitialized scalar field
Change-Id: If38a5ad4e5db287a3105bb0faca031bc98c47fd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110979 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/opengl/ogl_canvashelper.cxx88
1 files changed, 45 insertions, 43 deletions
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index 4ac30e703ba7..d64e1ba1d7f0 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -69,14 +69,6 @@ namespace oglcanvas
Text: http://www.opengl.org/resources/features/fontsurvey/
*/
- typedef std::function< bool (
- const CanvasHelper&,
- const ::basegfx::B2DHomMatrix&,
- GLenum,
- GLenum,
- const rendering::ARGBColor&,
- const ::basegfx::B2DPolyPolygonVector&)> functor;
-
struct CanvasHelper::Action
{
::basegfx::B2DHomMatrix maTransform;
@@ -85,12 +77,13 @@ namespace oglcanvas
rendering::ARGBColor maARGBColor;
::basegfx::B2DPolyPolygonVector maPolyPolys;
- functor maFunction;
-
- Action(const functor& rFunction)
- : maFunction(rFunction)
- {
- }
+ std::function< bool (
+ const CanvasHelper&,
+ const ::basegfx::B2DHomMatrix&,
+ GLenum,
+ GLenum,
+ const rendering::ARGBColor&,
+ const ::basegfx::B2DPolyPolygonVector&)> maFunction;
};
namespace
@@ -392,13 +385,13 @@ namespace oglcanvas
{
if( mpDevice )
{
- mpRecordedActions->push_back(Action(std::bind(lcl_drawLine,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
- aStartPoint, aEndPoint)));
-
+ mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
+ rAct.maFunction = std::bind(&lcl_drawLine,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
+ aStartPoint, aEndPoint);
}
}
@@ -411,17 +404,18 @@ namespace oglcanvas
if( !mpDevice )
return;
- // TODO(F2): subdivide&render whole curve
- mpRecordedActions->push_back(Action(std::bind(lcl_drawLine,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
- geometry::RealPoint2D(
- aBezierSegment.Px,
- aBezierSegment.Py),
- aEndPoint)));
-
+ mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
+
+ // TODO(F2): subdivide&render whole curve
+ rAct.maFunction = std::bind(&lcl_drawLine,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
+ geometry::RealPoint2D(
+ aBezierSegment.Px,
+ aBezierSegment.Py),
+ aEndPoint);
}
uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* /*pCanvas*/,
@@ -434,13 +428,15 @@ namespace oglcanvas
if( mpDevice )
{
- mpRecordedActions->push_back(Action(lcl_drawPolyPolygon));
+ mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
rAct.maPolyPolys.push_back(
::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
+
+ rAct.maFunction = &lcl_drawPolyPolygon;
}
// TODO(P1): Provide caching here.
@@ -458,14 +454,16 @@ namespace oglcanvas
if( mpDevice )
{
- // TODO(F3): fallback to drawPolyPolygon currently
- mpRecordedActions->push_back(Action(lcl_drawPolyPolygon));
+ mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
rAct.maPolyPolys.push_back(
::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
+
+ // TODO(F3): fallback to drawPolyPolygon currently
+ rAct.maFunction = &lcl_drawPolyPolygon;
}
// TODO(P1): Provide caching here.
@@ -515,13 +513,15 @@ namespace oglcanvas
if( mpDevice )
{
- mpRecordedActions->push_back(Action(lcl_fillPolyPolygon));
+ mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
rAct.maPolyPolys.push_back(
::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
+
+ rAct.maFunction = &lcl_fillPolyPolygon;
}
// TODO(P1): Provide caching here.
@@ -539,7 +539,7 @@ namespace oglcanvas
if( mpDevice )
{
- mpRecordedActions->push_back( Action(nullptr) );
+ mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
@@ -718,7 +718,7 @@ namespace oglcanvas
// set font
pVDev->SetFont(aFont);
- mpRecordedActions->push_back(Action(lcl_fillPolyPolygon));
+ mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
@@ -755,6 +755,8 @@ namespace oglcanvas
// own copy, for thread safety
for( auto& rPoly : rAct.maPolyPolys )
rPoly.makeUnique();
+
+ rAct.maFunction = &lcl_fillPolyPolygon;
}
}
@@ -779,13 +781,13 @@ namespace oglcanvas
// insert as transformed copy of bitmap action vector -
// during rendering, this gets rendered into a temporary
// buffer, and then composited to the front
- mpRecordedActions->push_back(Action(std::bind(lcl_drawOwnBitmap,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
- *pOwnBitmap)));
-
+ mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
+ rAct.maFunction = std::bind(&lcl_drawOwnBitmap,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
+ *pOwnBitmap);
}
else
{
@@ -808,16 +810,16 @@ namespace oglcanvas
aPixelData,
canvas::tools::getStdColorSpace()));
- mpRecordedActions->push_back(Action(std::bind(lcl_drawGenericBitmap,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
- aSize, aARGBBytes,
- rtl_crc32(0,
- aARGBBytes.getConstArray(),
- aARGBBytes.getLength()))));
-
+ mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
+ rAct.maFunction = std::bind(&lcl_drawGenericBitmap,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
+ aSize, aARGBBytes,
+ rtl_crc32(0,
+ aARGBBytes.getConstArray(),
+ aARGBBytes.getLength()));
}
// TODO(F1): handle non-integer case
}