loplugin:flatten in cppcanvas
Change-Id: I4303c31ad3de1ba71aa366b6dc203504b8fffd77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92453 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -83,20 +83,20 @@ namespace
|
|||||||
const cppcanvas::CanvasSharedPtr& rCanvas )
|
const cppcanvas::CanvasSharedPtr& rCanvas )
|
||||||
{
|
{
|
||||||
rIsColorSet = pAct->IsSetting();
|
rIsColorSet = pAct->IsSetting();
|
||||||
if (rIsColorSet)
|
if (!rIsColorSet)
|
||||||
{
|
return;
|
||||||
::Color aColor( pAct->GetColor() );
|
|
||||||
|
|
||||||
// force alpha part of color to
|
::Color aColor( pAct->GetColor() );
|
||||||
// opaque. transparent painting is done
|
|
||||||
// explicitly via MetaActionType::Transparent
|
|
||||||
aColor.SetTransparency(0);
|
|
||||||
//aColor.SetTransparency(128);
|
|
||||||
|
|
||||||
rColorSequence = vcl::unotools::colorToDoubleSequence(
|
// force alpha part of color to
|
||||||
aColor,
|
// opaque. transparent painting is done
|
||||||
rCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace() );
|
// explicitly via MetaActionType::Transparent
|
||||||
}
|
aColor.SetTransparency(0);
|
||||||
|
//aColor.SetTransparency(128);
|
||||||
|
|
||||||
|
rColorSequence = vcl::unotools::colorToDoubleSequence(
|
||||||
|
aColor,
|
||||||
|
rCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupStrokeAttributes( rendering::StrokeAttributes& o_rStrokeAttributes,
|
void setupStrokeAttributes( rendering::StrokeAttributes& o_rStrokeAttributes,
|
||||||
@@ -150,46 +150,46 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( LineStyle::Dash == rLineInfo.GetStyle() )
|
if( LineStyle::Dash != rLineInfo.GetStyle() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
const ::cppcanvas::internal::OutDevState& rState( rParms.mrStates.getState() );
|
||||||
|
|
||||||
|
// TODO(F1): Interpret OutDev::GetRefPoint() for the start of the dashing.
|
||||||
|
|
||||||
|
// interpret dash info only if explicitly enabled as
|
||||||
|
// style
|
||||||
|
const ::basegfx::B2DSize aDistance( rLineInfo.GetDistance(), 0 );
|
||||||
|
const double nDistance( (rState.mapModeTransform * aDistance).getX() );
|
||||||
|
|
||||||
|
const ::basegfx::B2DSize aDashLen( rLineInfo.GetDashLen(), 0 );
|
||||||
|
const double nDashLen( (rState.mapModeTransform * aDashLen).getX() );
|
||||||
|
|
||||||
|
const ::basegfx::B2DSize aDotLen( rLineInfo.GetDotLen(), 0 );
|
||||||
|
const double nDotLen( (rState.mapModeTransform * aDotLen).getX() );
|
||||||
|
|
||||||
|
const sal_Int32 nNumArryEntries( 2*rLineInfo.GetDashCount() +
|
||||||
|
2*rLineInfo.GetDotCount() );
|
||||||
|
|
||||||
|
o_rStrokeAttributes.DashArray.realloc( nNumArryEntries );
|
||||||
|
double* pDashArray = o_rStrokeAttributes.DashArray.getArray();
|
||||||
|
|
||||||
|
|
||||||
|
// iteratively fill dash array, first with dashes, then
|
||||||
|
// with dots.
|
||||||
|
|
||||||
|
|
||||||
|
sal_Int32 nCurrEntry=0;
|
||||||
|
|
||||||
|
for( sal_Int32 i=0; i<rLineInfo.GetDashCount(); ++i )
|
||||||
{
|
{
|
||||||
const ::cppcanvas::internal::OutDevState& rState( rParms.mrStates.getState() );
|
pDashArray[nCurrEntry++] = nDashLen;
|
||||||
|
pDashArray[nCurrEntry++] = nDistance;
|
||||||
// TODO(F1): Interpret OutDev::GetRefPoint() for the start of the dashing.
|
}
|
||||||
|
for( sal_Int32 i=0; i<rLineInfo.GetDotCount(); ++i )
|
||||||
// interpret dash info only if explicitly enabled as
|
{
|
||||||
// style
|
pDashArray[nCurrEntry++] = nDotLen;
|
||||||
const ::basegfx::B2DSize aDistance( rLineInfo.GetDistance(), 0 );
|
pDashArray[nCurrEntry++] = nDistance;
|
||||||
const double nDistance( (rState.mapModeTransform * aDistance).getX() );
|
|
||||||
|
|
||||||
const ::basegfx::B2DSize aDashLen( rLineInfo.GetDashLen(), 0 );
|
|
||||||
const double nDashLen( (rState.mapModeTransform * aDashLen).getX() );
|
|
||||||
|
|
||||||
const ::basegfx::B2DSize aDotLen( rLineInfo.GetDotLen(), 0 );
|
|
||||||
const double nDotLen( (rState.mapModeTransform * aDotLen).getX() );
|
|
||||||
|
|
||||||
const sal_Int32 nNumArryEntries( 2*rLineInfo.GetDashCount() +
|
|
||||||
2*rLineInfo.GetDotCount() );
|
|
||||||
|
|
||||||
o_rStrokeAttributes.DashArray.realloc( nNumArryEntries );
|
|
||||||
double* pDashArray = o_rStrokeAttributes.DashArray.getArray();
|
|
||||||
|
|
||||||
|
|
||||||
// iteratively fill dash array, first with dashes, then
|
|
||||||
// with dots.
|
|
||||||
|
|
||||||
|
|
||||||
sal_Int32 nCurrEntry=0;
|
|
||||||
|
|
||||||
for( sal_Int32 i=0; i<rLineInfo.GetDashCount(); ++i )
|
|
||||||
{
|
|
||||||
pDashArray[nCurrEntry++] = nDashLen;
|
|
||||||
pDashArray[nCurrEntry++] = nDistance;
|
|
||||||
}
|
|
||||||
for( sal_Int32 i=0; i<rLineInfo.GetDotCount(); ++i )
|
|
||||||
{
|
|
||||||
pDashArray[nCurrEntry++] = nDotLen;
|
|
||||||
pDashArray[nCurrEntry++] = nDistance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,21 +1026,21 @@ namespace cppcanvas::internal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pTextAction )
|
if( !pTextAction )
|
||||||
|
return;
|
||||||
|
|
||||||
|
maActions.emplace_back(
|
||||||
|
pTextAction,
|
||||||
|
rParms.mrCurrActionIndex );
|
||||||
|
|
||||||
|
if ( pStrikeoutTextAction )
|
||||||
{
|
{
|
||||||
maActions.emplace_back(
|
maActions.emplace_back(
|
||||||
pTextAction,
|
pStrikeoutTextAction,
|
||||||
rParms.mrCurrActionIndex );
|
rParms.mrCurrActionIndex );
|
||||||
|
|
||||||
if ( pStrikeoutTextAction )
|
|
||||||
{
|
|
||||||
maActions.emplace_back(
|
|
||||||
pStrikeoutTextAction,
|
|
||||||
rParms.mrCurrActionIndex );
|
|
||||||
}
|
|
||||||
|
|
||||||
rParms.mrCurrActionIndex += pTextAction->getActionCount()-1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rParms.mrCurrActionIndex += pTextAction->getActionCount()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImplRenderer::updateClipping( const ::basegfx::B2DPolyPolygon& rClipPoly,
|
void ImplRenderer::updateClipping( const ::basegfx::B2DPolyPolygon& rClipPoly,
|
||||||
|
@@ -90,21 +90,21 @@ namespace cppcanvas::internal
|
|||||||
{
|
{
|
||||||
OSL_ENSURE( mxSprite.is(), "ImplSprite::move(): Invalid sprite");
|
OSL_ENSURE( mxSprite.is(), "ImplSprite::move(): Invalid sprite");
|
||||||
|
|
||||||
if( mxSprite.is() )
|
if( !mxSprite.is() )
|
||||||
{
|
return;
|
||||||
rendering::ViewState aViewState;
|
|
||||||
rendering::RenderState aRenderState;
|
|
||||||
|
|
||||||
::canvas::tools::initViewState( aViewState );
|
rendering::ViewState aViewState;
|
||||||
::canvas::tools::initRenderState( aRenderState );
|
rendering::RenderState aRenderState;
|
||||||
|
|
||||||
::canvas::tools::setViewStateTransform( aViewState,
|
::canvas::tools::initViewState( aViewState );
|
||||||
mpTransformArbiter->getTransformation() );
|
::canvas::tools::initRenderState( aRenderState );
|
||||||
|
|
||||||
mxSprite->move( ::basegfx::unotools::point2DFromB2DPoint( rNewPos ),
|
::canvas::tools::setViewStateTransform( aViewState,
|
||||||
aViewState,
|
mpTransformArbiter->getTransformation() );
|
||||||
aRenderState );
|
|
||||||
}
|
mxSprite->move( ::basegfx::unotools::point2DFromB2DPoint( rNewPos ),
|
||||||
|
aViewState,
|
||||||
|
aRenderState );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImplSprite::transform( const ::basegfx::B2DHomMatrix& rMatrix )
|
void ImplSprite::transform( const ::basegfx::B2DHomMatrix& rMatrix )
|
||||||
@@ -135,22 +135,22 @@ namespace cppcanvas::internal
|
|||||||
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::setClip(): Invalid canvas");
|
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::setClip(): Invalid canvas");
|
||||||
OSL_ENSURE( mxSprite.is(), "ImplSprite::transform(): Invalid sprite");
|
OSL_ENSURE( mxSprite.is(), "ImplSprite::transform(): Invalid sprite");
|
||||||
|
|
||||||
if( mxSprite.is() && mxGraphicDevice.is() )
|
if( !(mxSprite.is() && mxGraphicDevice.is()) )
|
||||||
{
|
return;
|
||||||
::basegfx::B2DPolyPolygon aTransformedClipPoly( rClipPoly );
|
|
||||||
|
|
||||||
// extract linear part of canvas view transformation (linear means:
|
::basegfx::B2DPolyPolygon aTransformedClipPoly( rClipPoly );
|
||||||
// without translational components)
|
|
||||||
::basegfx::B2DHomMatrix aViewTransform( mpTransformArbiter->getTransformation() );
|
|
||||||
aViewTransform.set( 0, 2, 0.0 );
|
|
||||||
aViewTransform.set( 1, 2, 0.0 );
|
|
||||||
|
|
||||||
// transform polygon from view to device coordinate space
|
// extract linear part of canvas view transformation (linear means:
|
||||||
aTransformedClipPoly.transform( aViewTransform );
|
// without translational components)
|
||||||
|
::basegfx::B2DHomMatrix aViewTransform( mpTransformArbiter->getTransformation() );
|
||||||
|
aViewTransform.set( 0, 2, 0.0 );
|
||||||
|
aViewTransform.set( 1, 2, 0.0 );
|
||||||
|
|
||||||
mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice,
|
// transform polygon from view to device coordinate space
|
||||||
aTransformedClipPoly ) );
|
aTransformedClipPoly.transform( aViewTransform );
|
||||||
}
|
|
||||||
|
mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice,
|
||||||
|
aTransformedClipPoly ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImplSprite::setClip()
|
void ImplSprite::setClip()
|
||||||
|
Reference in New Issue
Block a user