diff options
Diffstat (limited to 'cppcanvas/source/mtfrenderer')
-rw-r--r-- | cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx | 5 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx | 2 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/implrenderer.cxx | 86 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/lineaction.cxx | 7 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/mtftools.cxx | 2 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/pointaction.cxx | 7 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/polypolyaction.cxx | 8 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/textaction.cxx | 103 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/textaction.hxx | 8 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/textlineshelper.cxx | 7 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/textlineshelper.hxx | 2 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/transparencygroupaction.cxx | 97 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/transparencygroupaction.hxx | 9 |
13 files changed, 214 insertions, 129 deletions
diff --git a/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx b/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx index 8001ae8733f5..e5664cabfc1d 100644 --- a/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx +++ b/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx @@ -26,14 +26,15 @@ #include "cachedprimitivebase.hxx" #include <sal/log.hxx> +#include <utility> using namespace ::com::sun::star; namespace cppcanvas::internal { - CachedPrimitiveBase::CachedPrimitiveBase( const CanvasSharedPtr& rCanvas, + CachedPrimitiveBase::CachedPrimitiveBase( CanvasSharedPtr xCanvas, bool bOnlyRedrawWithSameTransform ) : - mpCanvas( rCanvas ), + mpCanvas(std::move( xCanvas )), mbOnlyRedrawWithSameTransform( bOnlyRedrawWithSameTransform ) { // TODO(F2): also store last view transform, and refuse to diff --git a/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx b/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx index 2f32d887b515..48a31db5d294 100644 --- a/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx +++ b/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx @@ -57,7 +57,7 @@ namespace cppcanvas::internal same. Otherwise, repaints are always performed via the cached primitive. */ - CachedPrimitiveBase( const CanvasSharedPtr& rCanvas, + CachedPrimitiveBase( CanvasSharedPtr xCanvas, bool bOnlyRedrawWithSameTransform ); CachedPrimitiveBase(const CachedPrimitiveBase&) = delete; diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index f7fe8db551f0..d3cfe793f45f 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -17,8 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <tools/debug.hxx> +#include <utility> #include <vcl/svapp.hxx> #include <comphelper/propertysequence.hxx> #include <comphelper/propertyvalue.hxx> @@ -66,7 +67,6 @@ #include "polypolyaction.hxx" #include "textaction.hxx" #include "transparencygroupaction.hxx" -#include <utility> #include <vector> #include <algorithm> #include <memory> @@ -208,9 +208,9 @@ namespace aWhite, rMaskColor }; - Bitmap aMask( rBitmap.CreateMask( aWhite )); + AlphaMask aMask( rBitmap.CreateAlphaMask( aWhite )); Bitmap aSolid( rBitmap.GetSizePixel(), - vcl::PixelFormat::N1_BPP, + vcl::PixelFormat::N8_BPP, &aBiLevelPalette ); aSolid.Erase( rMaskColor ); @@ -549,7 +549,7 @@ namespace cppcanvas::internal uno::Sequence< uno::Sequence < double > > aColors; uno::Sequence< double > aStops; - if( rGradient.GetStyle() == GradientStyle::Axial ) + if( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) { aStops = { 0.0, 0.5, 1.0 }; aColors = { aEndColor, aStartColor, aEndColor }; @@ -575,7 +575,7 @@ namespace cppcanvas::internal OUString aGradientService; switch( rGradient.GetStyle() ) { - case GradientStyle::Linear: + case css::awt::GradientStyle_LINEAR: aGradInfo = basegfx::utils::createLinearODFGradientInfo( aBounds, nSteps, @@ -587,7 +587,7 @@ namespace cppcanvas::internal aGradientService = "LinearGradient"; break; - case GradientStyle::Axial: + case css::awt::GradientStyle_AXIAL: { // Adapt the border so that it is suitable // for the axial gradient. An axial @@ -621,7 +621,7 @@ namespace cppcanvas::internal break; } - case GradientStyle::Radial: + case css::awt::GradientStyle_RADIAL: aGradInfo = basegfx::utils::createRadialODFGradientInfo( aBounds, aOffset, @@ -630,7 +630,7 @@ namespace cppcanvas::internal aGradientService = "EllipticalGradient"; break; - case GradientStyle::Elliptical: + case css::awt::GradientStyle_ELLIPTICAL: aGradInfo = basegfx::utils::createEllipticalODFGradientInfo( aBounds, aOffset, @@ -640,7 +640,7 @@ namespace cppcanvas::internal aGradientService = "EllipticalGradient"; break; - case GradientStyle::Square: + case css::awt::GradientStyle_SQUARE: aGradInfo = basegfx::utils::createSquareODFGradientInfo( aBounds, aOffset, @@ -650,7 +650,7 @@ namespace cppcanvas::internal aGradientService = "RectangularGradient"; break; - case GradientStyle::Rect: + case css::awt::GradientStyle_RECT: aGradInfo = basegfx::utils::createRectangularODFGradientInfo( aBounds, aOffset, @@ -825,7 +825,7 @@ namespace cppcanvas::internal else aFontMatrix.m11 *= nScaleY / nScaleX; } - aFontRequest.CellSize = (rState.mapModeTransform * vcl::unotools::b2DSizeFromSize(rFontSizeLog)).getY(); + aFontRequest.CellSize = (rState.mapModeTransform * vcl::unotools::b2DSizeFromSize(rFontSizeLog)).getHeight(); if (rFont.GetEmphasisMark() != FontEmphasisMark::NONE) { @@ -846,7 +846,8 @@ namespace cppcanvas::internal const OUString& rString, int nIndex, int nLength, - o3tl::span<const sal_Int32> pCharWidths, + KernArraySpan pCharWidths, + std::span<const sal_Bool> pKashidaArray, const ActionFactoryParameters& rParms, bool bSubsettableActions ) { @@ -943,6 +944,7 @@ namespace cppcanvas::internal nIndex, nLength, pCharWidths, + pKashidaArray, rParms.mrVDev, rParms.mrCanvas, rState, @@ -963,7 +965,7 @@ namespace cppcanvas::internal pChars[3]=pChars[2]=pChars[1]=pChars[0]; ::tools::Long nStrikeoutWidth = (rParms.mrVDev.GetTextWidth( - OUString(pChars, SAL_N_ELEMENTS(pChars))) + 2) / 4; + OUString(pChars, std::size(pChars))) + 2) / 4; if( nStrikeoutWidth <= 0 ) nStrikeoutWidth = 1; @@ -984,16 +986,16 @@ namespace cppcanvas::internal { ::tools::Long nInterval = ( nWidth - nStrikeoutWidth * nLen ) / nLen; nStrikeoutWidth += nInterval; - std::vector<sal_Int32> aStrikeoutCharWidths(nLen); + KernArray aStrikeoutCharWidths; for ( int i = 0;i<nLen; i++) { - aStrikeoutCharWidths[i] = nStrikeoutWidth; + aStrikeoutCharWidths.push_back(nStrikeoutWidth); } for ( int i = 1;i< nLen; i++ ) { - aStrikeoutCharWidths[ i ] += aStrikeoutCharWidths[ i-1 ]; + aStrikeoutCharWidths.adjust(i, aStrikeoutCharWidths[i - 1]); } pStrikeoutTextAction = @@ -1008,6 +1010,7 @@ namespace cppcanvas::internal 0/*nStartPos*/, nLen, aStrikeoutCharWidths, + pKashidaArray, rParms.mrVDev, rParms.mrCanvas, rState, @@ -1492,7 +1495,7 @@ namespace cppcanvas::internal // TODO(Q2): define and use appropriate enumeration types rState.textReliefStyle = rFont.GetRelief(); rState.textOverlineStyle = static_cast<sal_Int8>(rFont.GetOverline()); - rState.textUnderlineStyle = rParms.maFontUnderline ? + rState.textUnderlineStyle = rParms.maFontUnderline.has_value() ? (*rParms.maFontUnderline ? sal_Int8(LINESTYLE_SINGLE) : sal_Int8(LINESTYLE_NONE)) : static_cast<sal_Int8>(rFont.GetUnderline()); rState.textStrikeoutStyle = static_cast<sal_Int8>(rFont.GetStrikeout()); @@ -1542,7 +1545,7 @@ namespace cppcanvas::internal case MetaActionType::GRADIENT: { MetaGradientAction* pGradAct = static_cast<MetaGradientAction*>(pCurrAct); - createGradientAction( ::tools::Polygon( pGradAct->GetRect() ), + createGradientAction( ::tools::PolyPolygon( pGradAct->GetRect() ), pGradAct->GetGradient(), rFactoryParms, true, @@ -2137,10 +2140,8 @@ namespace cppcanvas::internal std::shared_ptr<Action> pBmpAction( internal::BitmapActionFactory::createBitmapAction( BitmapEx(pAct->GetBitmap()), - rStates.getState().mapModeTransform * - vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ), - rStates.getState().mapModeTransform * - vcl::unotools::b2DSizeFromSize( pAct->GetSize() ), + rStates.getState().mapModeTransform * vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ), + rStates.getState().mapModeTransform * vcl::unotools::b2DVectorFromSize( pAct->GetSize() ), rCanvas, rStates.getState() ) ); @@ -2172,7 +2173,7 @@ namespace cppcanvas::internal rStates.getState().mapModeTransform * vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ), rStates.getState().mapModeTransform * - vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ), + vcl::unotools::b2DVectorFromSize( pAct->GetDestSize() ), rCanvas, rStates.getState() ) ); @@ -2220,7 +2221,7 @@ namespace cppcanvas::internal rStates.getState().mapModeTransform * vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ), rStates.getState().mapModeTransform * - vcl::unotools::b2DSizeFromSize( pAct->GetSize() ), + vcl::unotools::b2DVectorFromSize( pAct->GetSize() ), rCanvas, rStates.getState() ) ); @@ -2252,7 +2253,7 @@ namespace cppcanvas::internal rStates.getState().mapModeTransform * vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ), rStates.getState().mapModeTransform * - vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ), + vcl::unotools::b2DVectorFromSize( pAct->GetDestSize() ), rCanvas, rStates.getState() ) ); @@ -2312,7 +2313,7 @@ namespace cppcanvas::internal rStates.getState().mapModeTransform * vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ), rStates.getState().mapModeTransform * - vcl::unotools::b2DSizeFromSize( pAct->GetSize() ), + vcl::unotools::b2DVectorFromSize( pAct->GetSize() ), rCanvas, rStates.getState() ) ); @@ -2349,7 +2350,7 @@ namespace cppcanvas::internal rStates.getState().mapModeTransform * vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ), rStates.getState().mapModeTransform * - vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ), + vcl::unotools::b2DVectorFromSize( pAct->GetDestSize() ), rCanvas, rStates.getState() ) ); @@ -2406,12 +2407,11 @@ namespace cppcanvas::internal { MetaFloatTransparentAction* pAct = static_cast<MetaFloatTransparentAction*>(pCurrAct); - internal::MtfAutoPtr pMtf( + std::unique_ptr< GDIMetaFile > pMtf( new ::GDIMetaFile( pAct->GetGDIMetaFile() ) ); // TODO(P2): Use native canvas gradients here (saves a lot of UNO calls) - internal::GradientAutoPtr pGradient( - new Gradient( pAct->GetGradient() ) ); + std::optional< Gradient > pGradient( pAct->GetGradient() ); DBG_TESTSOLARMUTEX(); @@ -2422,7 +2422,7 @@ namespace cppcanvas::internal rStates.getState().mapModeTransform * vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ), rStates.getState().mapModeTransform * - vcl::unotools::b2DSizeFromSize( pAct->GetSize() ), + vcl::unotools::b2DVectorFromSize( pAct->GetSize() ), rCanvas, rStates.getState() ) ); @@ -2453,6 +2453,7 @@ namespace cppcanvas::internal pAct->GetIndex(), nLen, {}, + {}, rFactoryParms, bSubsettableActions ); } @@ -2474,6 +2475,7 @@ namespace cppcanvas::internal pAct->GetIndex(), nLen, pAct->GetDXArray(), + pAct->GetKashidaArray(), rFactoryParms, bSubsettableActions ); } @@ -2496,8 +2498,8 @@ namespace cppcanvas::internal rState.mapModeTransform * ::basegfx::B2DPoint( vcl::unotools::b2DPointFromPoint(pAct->GetStartPoint()) + - vcl::unotools::b2DSizeFromSize(aBaselineOffset)), - aSize.getX(), + vcl::unotools::b2DVectorFromSize(aBaselineOffset)), + aSize.getWidth(), tools::createTextLineInfo( rVDev, rState )), rCanvas, @@ -2556,7 +2558,7 @@ namespace cppcanvas::internal // generating a DX array, and uniformly // distributing the excess/insufficient width // to every logical character. - std::vector<sal_Int32> aDXArray; + KernArray aDXArray; rVDev.GetTextArray( pAct->GetText(), &aDXArray, pAct->GetIndex(), pAct->GetLen() ); @@ -2564,7 +2566,6 @@ namespace cppcanvas::internal const sal_Int32 nWidthDifference( pAct->GetWidth() - aDXArray[ nLen-1 ] ); // Last entry of pDXArray contains total width of the text - sal_Int32* p = aDXArray.data(); for (sal_Int32 i = 1; i <= nLen; ++i) { // calc ratio for every array entry, to @@ -2573,7 +2574,7 @@ namespace cppcanvas::internal // entry represents the 'end' position of // the corresponding character, thus, we // let i run from 1 to nLen. - *p++ += i * nWidthDifference / nLen; + aDXArray.adjust(i - 1, i * nWidthDifference / nLen); } createTextAction( @@ -2582,6 +2583,7 @@ namespace cppcanvas::internal pAct->GetIndex(), nLen, aDXArray, + {}, rFactoryParms, bSubsettableActions ); } @@ -2607,8 +2609,8 @@ namespace cppcanvas::internal class ActionRenderer { public: - explicit ActionRenderer( const ::basegfx::B2DHomMatrix& rTransformation ) : - maTransformation( rTransformation ), + explicit ActionRenderer( ::basegfx::B2DHomMatrix aTransformation ) : + maTransformation(std::move( aTransformation )), mbRet( true ) { } @@ -2642,8 +2644,8 @@ namespace cppcanvas::internal class AreaQuery { public: - explicit AreaQuery( const ::basegfx::B2DHomMatrix& rTransformation ) : - maTransformation( rTransformation ) + explicit AreaQuery( ::basegfx::B2DHomMatrix aTransformation ) : + maTransformation(std::move( aTransformation )) { } @@ -2930,7 +2932,7 @@ namespace cppcanvas::internal if( rParams.maFontName || rParams.maFontWeight || rParams.maFontLetterForm || - rParams.maFontUnderline ) + rParams.maFontUnderline.has_value() ) { ::cppcanvas::internal::OutDevState& rState = aStateStack.getState(); diff --git a/cppcanvas/source/mtfrenderer/lineaction.cxx b/cppcanvas/source/mtfrenderer/lineaction.cxx index 9c8734fdf450..4bc55d929958 100644 --- a/cppcanvas/source/mtfrenderer/lineaction.cxx +++ b/cppcanvas/source/mtfrenderer/lineaction.cxx @@ -30,6 +30,7 @@ #include <sal/log.hxx> #include <cppcanvas/canvas.hxx> +#include <utility> #include "mtftools.hxx" @@ -45,7 +46,7 @@ namespace cppcanvas::internal public: LineAction( const ::basegfx::B2DPoint&, const ::basegfx::B2DPoint&, - const CanvasSharedPtr&, + CanvasSharedPtr, const OutDevState& ); LineAction(const LineAction&) = delete; @@ -70,11 +71,11 @@ namespace cppcanvas::internal LineAction::LineAction( const ::basegfx::B2DPoint& rStartPoint, const ::basegfx::B2DPoint& rEndPoint, - const CanvasSharedPtr& rCanvas, + CanvasSharedPtr xCanvas, const OutDevState& rState ) : maStartPoint( rStartPoint ), maEndPoint( rEndPoint ), - mpCanvas( rCanvas ) + mpCanvas(std::move( xCanvas )) { tools::initRenderState(maState,rState); maState.DeviceColor = rState.lineColor; diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx index 0181fa78ec9c..94a83da70c19 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.cxx +++ b/cppcanvas/source/mtfrenderer/mtftools.cxx @@ -18,7 +18,7 @@ */ -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <com/sun/star/rendering/XCanvas.hpp> #include <basegfx/utils/canvastools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> diff --git a/cppcanvas/source/mtfrenderer/pointaction.cxx b/cppcanvas/source/mtfrenderer/pointaction.cxx index 72550db5480b..449f4b9b4249 100644 --- a/cppcanvas/source/mtfrenderer/pointaction.cxx +++ b/cppcanvas/source/mtfrenderer/pointaction.cxx @@ -22,6 +22,7 @@ #include <sal/types.h> #include <sal/log.hxx> +#include <utility> #include <vcl/canvastools.hxx> #include <basegfx/range/b2drange.hxx> @@ -45,7 +46,7 @@ namespace cppcanvas::internal { public: PointAction( const ::basegfx::B2DPoint&, - const CanvasSharedPtr&, + CanvasSharedPtr, const OutDevState& ); PointAction( const ::basegfx::B2DPoint&, const CanvasSharedPtr&, @@ -72,10 +73,10 @@ namespace cppcanvas::internal }; PointAction::PointAction( const ::basegfx::B2DPoint& rPoint, - const CanvasSharedPtr& rCanvas, + CanvasSharedPtr xCanvas, const OutDevState& rState ) : maPoint( rPoint ), - mpCanvas( rCanvas ) + mpCanvas(std::move( xCanvas )) { tools::initRenderState(maState,rState); maState.DeviceColor = rState.lineColor; diff --git a/cppcanvas/source/mtfrenderer/polypolyaction.cxx b/cppcanvas/source/mtfrenderer/polypolyaction.cxx index e191e512ec61..955727a31309 100644 --- a/cppcanvas/source/mtfrenderer/polypolyaction.cxx +++ b/cppcanvas/source/mtfrenderer/polypolyaction.cxx @@ -28,11 +28,13 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <canvas/canvastools.hxx> +#include <osl/diagnose.h> #include <sal/log.hxx> #include "cachedprimitivebase.hxx" #include "polypolyaction.hxx" #include <outdevstate.hxx> +#include <utility> #include "mtftools.hxx" @@ -337,7 +339,7 @@ namespace cppcanvas::internal StrokedPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly, const CanvasSharedPtr& rCanvas, const OutDevState& rState, - const rendering::StrokeAttributes& rStrokeAttributes ); + rendering::StrokeAttributes aStrokeAttributes ); virtual bool renderSubset( const ::basegfx::B2DHomMatrix& rTransformation, const Subset& rSubset ) const override; @@ -363,12 +365,12 @@ namespace cppcanvas::internal StrokedPolyPolyAction::StrokedPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPolyPoly, const CanvasSharedPtr& rCanvas, const OutDevState& rState, - const rendering::StrokeAttributes& rStrokeAttributes ) : + rendering::StrokeAttributes aStrokeAttributes ) : CachedPrimitiveBase( rCanvas, false ), mxPolyPoly( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), rPolyPoly) ), maBounds( ::basegfx::utils::getRange(rPolyPoly) ), mpCanvas( rCanvas ), - maStrokeAttributes( rStrokeAttributes ) + maStrokeAttributes(std::move( aStrokeAttributes )) { tools::initRenderState(maState,rState); maState.DeviceColor = rState.lineColor; diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index 091dde1c456c..2f2148c44dbd 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -18,7 +18,7 @@ */ -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <com/sun/star/rendering/PathCapType.hpp> #include <com/sun/star/rendering/PathJoinType.hpp> @@ -33,6 +33,7 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <tools/gen.hxx> +#include <utility> #include <vcl/canvastools.hxx> #include <vcl/virdev.hxx> @@ -157,7 +158,7 @@ namespace cppcanvas::internal rLayoutWidth = *(std::max_element(rOffsets.begin(), rOffsets.end())); } - uno::Sequence< double > setupDXArray( o3tl::span<const sal_Int32> rCharWidths, + uno::Sequence< double > setupDXArray( KernArraySpan rCharWidths, sal_Int32 nLen, const OutDevState& rState ) { @@ -169,11 +170,10 @@ namespace cppcanvas::internal // array, by circumventing integer-based // OutDev-mapping const double nScale( rState.mapModeTransform.get(0,0) ); - sal_Int32 const * pCharWidths = rCharWidths.data(); for( int i = 0; i < nLen; ++i ) { // TODO(F2): use correct scale direction - *pOutputWidths++ = *pCharWidths++ * nScale; + *pOutputWidths++ = rCharWidths[i] * nScale; } return aCharWidthSeq; @@ -187,7 +187,7 @@ namespace cppcanvas::internal { // no external DX array given, create one from given // string - std::vector<sal_Int32> aCharWidths; + KernArray aCharWidths; rVDev.GetTextArray( rText, &aCharWidths, nStartPos, nLen ); @@ -229,6 +229,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState, const ::basegfx::B2DHomMatrix* pTextTransform ) @@ -255,6 +256,7 @@ namespace cppcanvas::internal "::cppcanvas::internal::initArrayAction(): Invalid font" ); o_rTextLayout->applyLogicalAdvancements( rOffsets ); + o_rTextLayout->applyKashidaPositions( rKashidas ); } @@ -268,7 +270,7 @@ namespace cppcanvas::internal static_cast<sal_uInt16>(rStringContext.Length) ), 0 ); - return (rState.mapModeTransform * aSize).getX(); + return (rState.mapModeTransform * aSize).getWidth(); } uno::Sequence< double > @@ -457,6 +459,10 @@ namespace cppcanvas::internal io_rTextLayout, nLayoutWidth, rSubset ) ); + uno::Sequence< sal_Bool > aOrigKashidaPositions(io_rTextLayout->queryKashidaPositions()); + uno::Sequence< sal_Bool > aKashidaPositions(aOrigKashidaPositions.getArray() + rSubset.mnSubsetBegin, + rSubset.mnSubsetEnd - rSubset.mnSubsetBegin); + xTextLayout->applyKashidaPositions(aKashidaPositions); } io_rTextLayout = xTextLayout; @@ -503,8 +509,8 @@ namespace cppcanvas::internal rendering::RenderState aShadowState( rRenderState ); ::basegfx::B2DHomMatrix aTranslate; - aTranslate.translate( rShadowOffset.getX(), - rShadowOffset.getY() ); + aTranslate.translate(rShadowOffset.getWidth(), + rShadowOffset.getHeight()); ::canvas::tools::appendToRenderState(aShadowState, aTranslate); @@ -521,8 +527,8 @@ namespace cppcanvas::internal rendering::RenderState aReliefState( rRenderState ); ::basegfx::B2DHomMatrix aTranslate; - aTranslate.translate( rReliefOffset.getX(), - rReliefOffset.getY() ); + aTranslate.translate(rReliefOffset.getWidth(), + rReliefOffset.getHeight()); ::canvas::tools::appendToRenderState(aReliefState, aTranslate); @@ -555,15 +561,15 @@ namespace cppcanvas::internal // TODO(Q3): Provide this functionality at the B2DRange ::basegfx::B2DRange aTotalBounds( aBounds ); aTotalBounds.expand( - ::basegfx::B2DRange( aBounds.getMinX() + rReliefOffset.getX(), - aBounds.getMinY() + rReliefOffset.getY(), - aBounds.getMaxX() + rReliefOffset.getX(), - aBounds.getMaxY() + rReliefOffset.getY() ) ); + ::basegfx::B2DRange( aBounds.getMinX() + rReliefOffset.getWidth(), + aBounds.getMinY() + rReliefOffset.getHeight(), + aBounds.getMaxX() + rReliefOffset.getWidth(), + aBounds.getMaxY() + rReliefOffset.getHeight() ) ); aTotalBounds.expand( - ::basegfx::B2DRange( aBounds.getMinX() + rShadowOffset.getX(), - aBounds.getMinY() + rShadowOffset.getY(), - aBounds.getMaxX() + rShadowOffset.getX(), - aBounds.getMaxY() + rShadowOffset.getY() ) ); + ::basegfx::B2DRange( aBounds.getMinX() + rShadowOffset.getWidth(), + aBounds.getMinY() + rShadowOffset.getHeight(), + aBounds.getMaxX() + rShadowOffset.getWidth(), + aBounds.getMaxY() + rShadowOffset.getHeight() ) ); return tools::calcDevicePixelBounds( aTotalBounds, rViewState, @@ -579,8 +585,8 @@ namespace cppcanvas::internal const ::basegfx::B2DPolyPolygon aPoly( tools::createTextLinesPolyPolygon( 0.0, nLineWidth, rLineInfo ) ); - - o_rOverallSize = ::basegfx::utils::getRange( aPoly ).getRange(); + auto aRange = basegfx::utils::getRange( aPoly ).getRange(); + o_rOverallSize = basegfx::B2DSize(aRange.getX(), aRange.getY()); o_rTextLines = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), @@ -979,8 +985,8 @@ namespace cppcanvas::internal return calcEffectTextBounds( ::basegfx::unotools::b2DRectangleFromRealRectangle2D( queryTextBounds() ), ::basegfx::B2DRange( 0,0, - maLinesOverallSize.getX(), - maLinesOverallSize.getY() ), + maLinesOverallSize.getWidth(), + maLinesOverallSize.getHeight() ), maReliefOffset, maShadowOffset, aLocalState, @@ -1017,6 +1023,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState ); @@ -1025,6 +1032,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState, const ::basegfx::B2DHomMatrix& rTextTransform ); @@ -1061,6 +1069,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState ) : mpCanvas( rCanvas ) @@ -1074,6 +1083,7 @@ namespace cppcanvas::internal nStartPos, nLen, rOffsets, + rKashidas, rCanvas, rState, nullptr ); } @@ -1083,6 +1093,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState, const ::basegfx::B2DHomMatrix& rTextTransform ) : @@ -1097,6 +1108,7 @@ namespace cppcanvas::internal nStartPos, nLen, rOffsets, + rKashidas, rCanvas, rState, &rTextTransform ); @@ -1206,6 +1218,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState ); @@ -1219,6 +1232,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, @@ -1273,6 +1287,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState ) : @@ -1296,6 +1311,7 @@ namespace cppcanvas::internal nStartPos, nLen, rOffsets, + rKashidas, rCanvas, rState, nullptr ); } @@ -1310,6 +1326,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, @@ -1334,6 +1351,7 @@ namespace cppcanvas::internal nStartPos, nLen, rOffsets, + rKashidas, rCanvas, rState, &rTextTransform ); @@ -1505,9 +1523,9 @@ namespace cppcanvas::internal return calcEffectTextBounds( ::basegfx::unotools::b2DRectangleFromRealRectangle2D( mxTextLayout->queryTextBounds() ), - ::basegfx::B2DRange( 0,0, - aSize.getX(), - aSize.getY() ), + basegfx::B2DRange(0, 0, + aSize.getWidth(), + aSize.getHeight()), maReliefOffset, maShadowOffset, aLocalState, @@ -1575,7 +1593,7 @@ namespace cppcanvas::internal const ::basegfx::B2DSize& rShadowOffset, const ::Color& rShadowColor, const ::basegfx::B2DRectangle& rOutlineBounds, - const uno::Reference< rendering::XPolyPolygon2D >& rTextPoly, + uno::Reference< rendering::XPolyPolygon2D > xTextPoly, const uno::Sequence< double >& rOffsets, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, @@ -1586,7 +1604,7 @@ namespace cppcanvas::internal const ::basegfx::B2DSize& rShadowOffset, const ::Color& rShadowColor, const ::basegfx::B2DRectangle& rOutlineBounds, - const uno::Reference< rendering::XPolyPolygon2D >& rTextPoly, + uno::Reference< rendering::XPolyPolygon2D > xTextPoly, const uno::Sequence< double >& rOffsets, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, @@ -1642,7 +1660,7 @@ namespace cppcanvas::internal rVDev.GetFont().GetFontHeight() / 64.0 ); const double nOutlineWidth( - (rState.mapModeTransform * aFontSize).getY() ); + (rState.mapModeTransform * aFontSize).getHeight() ); return nOutlineWidth < 1.0 ? 1.0 : nOutlineWidth; } @@ -1653,12 +1671,12 @@ namespace cppcanvas::internal const ::basegfx::B2DSize& rShadowOffset, const ::Color& rShadowColor, const ::basegfx::B2DRectangle& rOutlineBounds, - const uno::Reference< rendering::XPolyPolygon2D >& rTextPoly, + uno::Reference< rendering::XPolyPolygon2D > xTextPoly, const uno::Sequence< double >& rOffsets, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState ) : - mxTextPoly( rTextPoly ), + mxTextPoly(std::move( xTextPoly )), maOffsets( rOffsets ), mpCanvas( rCanvas ), mnOutlineWidth( calcOutlineWidth(rState,rVDev) ), @@ -1695,13 +1713,13 @@ namespace cppcanvas::internal const ::basegfx::B2DSize& rShadowOffset, const ::Color& rShadowColor, const ::basegfx::B2DRectangle& rOutlineBounds, - const uno::Reference< rendering::XPolyPolygon2D >& rTextPoly, + uno::Reference< rendering::XPolyPolygon2D > xTextPoly, const uno::Sequence< double >& rOffsets, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, const ::basegfx::B2DHomMatrix& rTextTransform ) : - mxTextPoly( rTextPoly ), + mxTextPoly(std::move( xTextPoly )), maOffsets( rOffsets ), mpCanvas( rCanvas ), mnOutlineWidth( calcOutlineWidth(rState,rVDev) ), @@ -1925,9 +1943,9 @@ namespace cppcanvas::internal ::canvas::tools::prependToRenderState(aLocalState, rTransformation); return calcEffectTextBounds( maOutlineBounds, - ::basegfx::B2DRange( 0,0, - maLinesOverallSize.getX(), - maLinesOverallSize.getY() ), + ::basegfx::B2DRange(0, 0, + maLinesOverallSize.getWidth(), + maLinesOverallSize.getHeight()), maReliefOffset, maShadowOffset, aLocalState, @@ -1966,7 +1984,8 @@ namespace cppcanvas::internal const OUString& rText, sal_Int32 nStartPos, sal_Int32 nLen, - o3tl::span<const sal_Int32> pDXArray, + KernArraySpan pDXArray, + std::span<const sal_Bool> pKashidaArray, VirtualDevice& rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, @@ -1994,7 +2013,7 @@ namespace cppcanvas::internal static_cast<sal_uInt16>(nStartPos), static_cast<sal_uInt16>(nStartPos), static_cast<sal_uInt16>(nLen), - 0, pDXArray ) ); + 0, pDXArray, pKashidaArray ) ); rVDev.SetFont(aOrigFont); if( !bHaveOutlines ) @@ -2096,7 +2115,8 @@ namespace cppcanvas::internal const OUString& rText, sal_Int32 nStartPos, sal_Int32 nLen, - o3tl::span<const sal_Int32> pDXArray, + KernArraySpan pDXArray, + std::span<const sal_Bool> pKashidaArray, VirtualDevice& rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, @@ -2129,6 +2149,7 @@ namespace cppcanvas::internal nStartPos, nLen, pDXArray, + pKashidaArray, rVDev, rCanvas, rState, @@ -2146,6 +2167,8 @@ namespace cppcanvas::internal rVDev, rState )); + const uno::Sequence< sal_Bool > aKashidas(pKashidaArray.data(), pKashidaArray.size()); + // determine type of text action to create // ======================================= @@ -2240,6 +2263,7 @@ namespace cppcanvas::internal nStartPos, nLen, aCharWidths, + aKashidas, rCanvas, rState, *rParms.maTextTransformation ); @@ -2250,6 +2274,7 @@ namespace cppcanvas::internal nStartPos, nLen, aCharWidths, + aKashidas, rCanvas, rState ); } @@ -2268,6 +2293,7 @@ namespace cppcanvas::internal nStartPos, nLen, aCharWidths, + aKashidas, rVDev, rCanvas, rState, @@ -2284,6 +2310,7 @@ namespace cppcanvas::internal nStartPos, nLen, aCharWidths, + aKashidas, rVDev, rCanvas, rState ); diff --git a/cppcanvas/source/mtfrenderer/textaction.hxx b/cppcanvas/source/mtfrenderer/textaction.hxx index f59ed4115c76..9f7349caccc9 100644 --- a/cppcanvas/source/mtfrenderer/textaction.hxx +++ b/cppcanvas/source/mtfrenderer/textaction.hxx @@ -19,10 +19,13 @@ #pragma once +#include <sal/config.h> + +#include <span> + #include <action.hxx> #include <cppcanvas/canvas.hxx> #include <cppcanvas/renderer.hxx> -#include <o3tl/span.hxx> class VirtualDevice; class Point; @@ -68,7 +71,8 @@ namespace cppcanvas::internal const OUString& rText, sal_Int32 nStartPos, sal_Int32 nLen, - o3tl::span<const sal_Int32> pDXArray, + KernArraySpan pDXArray, + std::span<const sal_Bool> pKashidaArray, VirtualDevice& rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, diff --git a/cppcanvas/source/mtfrenderer/textlineshelper.cxx b/cppcanvas/source/mtfrenderer/textlineshelper.cxx index 6bdc172e30ac..125c3385afec 100644 --- a/cppcanvas/source/mtfrenderer/textlineshelper.cxx +++ b/cppcanvas/source/mtfrenderer/textlineshelper.cxx @@ -13,6 +13,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/utils/canvastools.hxx> #include <outdevstate.hxx> +#include <utility> #include "textlineshelper.hxx" #include "mtftools.hxx" @@ -30,8 +31,8 @@ void initLineStyleWaveline(sal_uInt32 nLineStyle, bool& bIsWaveline, bool& bIsBo namespace cppcanvas::internal { -TextLinesHelper::TextLinesHelper(const CanvasSharedPtr& rCanvas, const OutDevState& rState) - : mpCanvas(rCanvas) +TextLinesHelper::TextLinesHelper(CanvasSharedPtr xCanvas, const OutDevState& rState) + : mpCanvas(std::move(xCanvas)) , mbIsOverlineColorSet(rState.isTextOverlineColorSet) , maOverlineColor(rState.textOverlineColor) , mbIsUnderlineColorSet(rState.isTextLineColorSet) @@ -74,7 +75,7 @@ void TextLinesHelper::init(double nLineWidth, const tools::TextLineInfo& rLineIn mxStrikeout = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(xDevice, aStrikeout); } - maOverallSize = aRange.getRange(); + maOverallSize = basegfx::B2DSize(aRange.getRange().getX(), aRange.getRange().getY()); initLineStyleWaveline(rLineInfo.mnOverlineStyle, mbOverlineWaveline, mbOverlineWavelineBold); diff --git a/cppcanvas/source/mtfrenderer/textlineshelper.hxx b/cppcanvas/source/mtfrenderer/textlineshelper.hxx index 38105961ee05..f0a53ff7a07d 100644 --- a/cppcanvas/source/mtfrenderer/textlineshelper.hxx +++ b/cppcanvas/source/mtfrenderer/textlineshelper.hxx @@ -53,7 +53,7 @@ class TextLinesHelper bool mbUnderlineWavelineBold; public: - TextLinesHelper(const CanvasSharedPtr& rCanvas, const OutDevState& rState); + TextLinesHelper(CanvasSharedPtr xCanvas, const OutDevState& rState); ::basegfx::B2DSize const& getOverallSize() const { return maOverallSize; } diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx index e0562361e3ce..c3c1cfdf50f6 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx @@ -83,8 +83,8 @@ namespace cppcanvas::internal Size of the transparency group object, in current state coordinate system. */ - TransparencyGroupAction( MtfAutoPtr&& rGroupMtf, - GradientAutoPtr&& rAlphaGradient, + TransparencyGroupAction( std::unique_ptr< GDIMetaFile >&& rGroupMtf, + std::optional< Gradient >&& rAlphaGradient, const ::basegfx::B2DPoint& rDstPoint, const ::basegfx::B2DVector& rDstSize, const CanvasSharedPtr& rCanvas, @@ -104,8 +104,8 @@ namespace cppcanvas::internal virtual sal_Int32 getActionCount() const override; private: - MtfAutoPtr mpGroupMtf; - GradientAutoPtr mpAlphaGradient; + std::unique_ptr< GDIMetaFile > mpGroupMtf; + std::optional< Gradient > mpAlphaGradient; const ::basegfx::B2DSize maDstSize; @@ -135,15 +135,15 @@ namespace cppcanvas::internal aLocalTransformation ); } - TransparencyGroupAction::TransparencyGroupAction( MtfAutoPtr&& rGroupMtf, - GradientAutoPtr&& rAlphaGradient, + TransparencyGroupAction::TransparencyGroupAction( std::unique_ptr< GDIMetaFile >&& rGroupMtf, + std::optional< Gradient >&& rAlphaGradient, const ::basegfx::B2DPoint& rDstPoint, const ::basegfx::B2DVector& rDstSize, const CanvasSharedPtr& rCanvas, const OutDevState& rState ) : mpGroupMtf( std::move(rGroupMtf) ), mpAlphaGradient( std::move(rAlphaGradient) ), - maDstSize( rDstSize ), + maDstSize(rDstSize.getX(), rDstSize.getY()), mpCanvas( rCanvas ) { tools::initRenderState(maState,rState); @@ -205,6 +205,8 @@ namespace cppcanvas::internal return false; } + ::Point aMtfOffsetPoint; + // if there's no buffer bitmap, or as soon as the // total transformation changes, we've got to // re-render the bitmap @@ -215,21 +217,65 @@ namespace cppcanvas::internal { DBG_TESTSOLARMUTEX(); + // tdf#150610 fix broken rendering of text meta actions + // Even when drawing to a VirtualDevice where antialiasing + // is disabled, text will still be drawn with some + // antialiased pixels on HiDPI displays. So, expand the + // size of the VirtualDevice slightly to capture any of + // the pixels drawn past the edges of the destination + // bounds. + bool bHasTextActions = false; + MetaAction* pCurrAct; + int nCurrActionIndex; + for( nCurrActionIndex=0, pCurrAct=mpGroupMtf->FirstAction(); + pCurrAct && !bHasTextActions; + ++nCurrActionIndex, pCurrAct = mpGroupMtf->NextAction() ) + { + switch( pCurrAct->GetType() ) + { + case MetaActionType::TEXT: + case MetaActionType::TEXTARRAY: + case MetaActionType::STRETCHTEXT: + case MetaActionType::TEXTRECT: + if( ( rSubset.mnSubsetBegin == 0 && rSubset.mnSubsetEnd == -1 ) || ( rSubset.mnSubsetBegin <= nCurrActionIndex && rSubset.mnSubsetEnd > nCurrActionIndex ) ) + bHasTextActions = true; + break; + default: + break; + } + } + // output size of metafile - ::Size aOutputSizePixel( ::basegfx::fround( aScale.getX() * maDstSize.getX() ), - ::basegfx::fround( aScale.getY() * maDstSize.getY() ) ); + ::Size aOutputSizePixel( ::basegfx::fround<::tools::Long>( aScale.getX() * maDstSize.getWidth() ), + ::basegfx::fround<::tools::Long>( aScale.getY() * maDstSize.getHeight() ) ); - // pixel size of cache bitmap: round up to nearest int - ::Size aBitmapSizePixel( static_cast<sal_Int32>( aScale.getX() * maDstSize.getX() )+1, - static_cast<sal_Int32>( aScale.getY() * maDstSize.getY() )+1 ); + sal_Int32 nBitmapExtra; + if ( bHasTextActions ) + { + nBitmapExtra = 10; + aMtfOffsetPoint = ::Point( nBitmapExtra / 2, nBitmapExtra / 2 ); + } + else + { + // Related tdf#150610 assume antialiasing is enabled + // Although antialiasing is normally disabled in the + // VirtualDevice, lines in tdf#150610 will draw past + // the edge of the VirtualDevice when running a + // slideshow so always add an extra pixel on the + // right and bottom edges. + nBitmapExtra = 1; + } - ::Point aEmptyPoint; + // pixel size of cache bitmap: round up to nearest int + ::Point aBitmapPoint; + ::Size aBitmapSizePixel( static_cast<sal_Int32>( aScale.getX() * maDstSize.getWidth() ) + nBitmapExtra, + static_cast<sal_Int32>( aScale.getY() * maDstSize.getHeight() ) + nBitmapExtra ); // render our content into an appropriately sized // VirtualDevice with alpha channel ScopedVclPtrInstance<VirtualDevice> aVDev( - *::Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT ); - aVDev->SetOutputSizePixel( aBitmapSizePixel ); + *::Application::GetDefaultDevice(), DeviceFormat::WITH_ALPHA ); + aVDev->SetOutputSizePixel( aBitmapSizePixel, true, true ); aVDev->SetMapMode(); if( rSubset.mnSubsetBegin != 0 || @@ -238,8 +284,6 @@ namespace cppcanvas::internal // true subset - extract referenced // metaactions from mpGroupMtf GDIMetaFile aMtf; - MetaAction* pCurrAct; - int nCurrActionIndex; // extract subset actions for( nCurrActionIndex=0, @@ -320,7 +364,9 @@ namespace cppcanvas::internal } aVDev->DrawTransparent( aMtf, - aEmptyPoint, + aBitmapPoint, + aBitmapSizePixel, + aMtfOffsetPoint, aOutputSizePixel, *mpAlphaGradient ); } @@ -328,7 +374,9 @@ namespace cppcanvas::internal { // no subsetting - render whole mtf aVDev->DrawTransparent( *mpGroupMtf, - aEmptyPoint, + aBitmapPoint, + aBitmapSizePixel, + aMtfOffsetPoint, aOutputSizePixel, *mpAlphaGradient ); } @@ -338,7 +386,7 @@ namespace cppcanvas::internal BitmapSharedPtr aBmp( VCLFactory::createBitmap( mpCanvas, aVDev->GetBitmapEx( - aEmptyPoint, + aBitmapPoint, aBitmapSizePixel ) ) ); mxBufferBitmap = aBmp->getUNOBitmap(); maLastTransformation = aTotalTransform; @@ -362,6 +410,7 @@ namespace cppcanvas::internal // the contained scaling, we've got to right-multiply with // the inverse. ::basegfx::B2DHomMatrix aScaleCorrection; + aScaleCorrection.translate( -aMtfOffsetPoint.X(), -aMtfOffsetPoint.Y() ); aScaleCorrection.scale( 1/aScale.getX(), 1/aScale.getY() ); aTransform = aTransform * aScaleCorrection; @@ -423,8 +472,8 @@ namespace cppcanvas::internal return tools::calcDevicePixelBounds( ::basegfx::B2DRange( 0,0, - maDstSize.getX(), - maDstSize.getY() ), + maDstSize.getWidth(), + maDstSize.getHeight() ), mpCanvas->getViewState(), aLocalState ); } @@ -453,8 +502,8 @@ namespace cppcanvas::internal } - std::shared_ptr<Action> TransparencyGroupActionFactory::createTransparencyGroupAction( MtfAutoPtr&& rGroupMtf, - GradientAutoPtr&& rAlphaGradient, + std::shared_ptr<Action> TransparencyGroupActionFactory::createTransparencyGroupAction( std::unique_ptr< GDIMetaFile >&& rGroupMtf, + std::optional< Gradient >&& rAlphaGradient, const ::basegfx::B2DPoint& rDstPoint, const ::basegfx::B2DVector& rDstSize, const CanvasSharedPtr& rCanvas, diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.hxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.hxx index f863d18ed4c7..ddf01ca00934 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.hxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.hxx @@ -20,6 +20,7 @@ #pragma once #include <cppcanvas/canvas.hxx> +#include <vcl/gradient.hxx> #include <action.hxx> #include <memory> @@ -30,7 +31,6 @@ namespace basegfx { } class GDIMetaFile; -class Gradient; /* Definition of internal::TransparencyGroupActionFactory */ @@ -39,9 +39,6 @@ namespace cppcanvas::internal { struct OutDevState; - typedef std::unique_ptr< GDIMetaFile > MtfAutoPtr; - typedef std::unique_ptr< Gradient > GradientAutoPtr; - /** Transparency group action. This action groups a bunch of other actions, to be @@ -75,8 +72,8 @@ namespace cppcanvas::internal Size of the transparency group object, in current state coordinate system. */ - std::shared_ptr<Action> createTransparencyGroupAction( MtfAutoPtr&& rGroupMtf, - GradientAutoPtr&& rAlphaGradient, + std::shared_ptr<Action> createTransparencyGroupAction( std::unique_ptr< GDIMetaFile >&& rGroupMtf, + std::optional< Gradient >&& rAlphaGradient, const ::basegfx::B2DPoint& rDstPoint, const ::basegfx::B2DVector& rDstSize, const CanvasSharedPtr& rCanvas, |