VCL: Renamed two functions
Renamed functions: + supportsOperation -> SupportsOperation For consistency + DrawAlphaBitmap -> DrawDeviceAlphaBitmap I want to make it more clear that these are the functions that call on mpGraphics to actually draw on the graphics device Change-Id: Ic4951bfcc0ac0c09fe5b6908dfdf1f699a634265
This commit is contained in:
@@ -935,7 +935,7 @@ void OfaViewTabPage::Reset( const SfxItemSet& )
|
|||||||
// check if transparent selection is possible on this system
|
// check if transparent selection is possible on this system
|
||||||
const bool bTransparentSelectionPossible(
|
const bool bTransparentSelectionPossible(
|
||||||
!GetSettings().GetStyleSettings().GetHighContrastMode()
|
!GetSettings().GetStyleSettings().GetHighContrastMode()
|
||||||
&& supportsOperation(OutDevSupport_TransparentRect));
|
&& SupportsOperation(OutDevSupport_TransparentRect));
|
||||||
|
|
||||||
// enter values
|
// enter values
|
||||||
if(bTransparentSelectionPossible)
|
if(bTransparentSelectionPossible)
|
||||||
|
@@ -470,7 +470,7 @@ public:
|
|||||||
|
|
||||||
@returns true if operation supported, else false
|
@returns true if operation supported, else false
|
||||||
*/
|
*/
|
||||||
bool supportsOperation( OutDevSupportType ) const;
|
bool SupportsOperation( OutDevSupportType ) const;
|
||||||
|
|
||||||
vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
|
vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
|
||||||
|
|
||||||
@@ -734,7 +734,7 @@ private:
|
|||||||
|
|
||||||
// #i101491#
|
// #i101491#
|
||||||
// Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check.
|
// Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check.
|
||||||
SAL_DLLPRIVATE bool TryDrawPolyLineDirectNoAA(
|
SAL_DLLPRIVATE bool TryDrawPolyLineDirectNoAACheck(
|
||||||
const basegfx::B2DPolygon& rB2DPolygon,
|
const basegfx::B2DPolygon& rB2DPolygon,
|
||||||
double fLineWidth = 0.0,
|
double fLineWidth = 0.0,
|
||||||
double fTransparency = 0.0,
|
double fTransparency = 0.0,
|
||||||
@@ -1342,7 +1342,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SAL_DLLPRIVATE void DrawAlphaBitmap(
|
SAL_DLLPRIVATE void DrawDeviceAlphaBitmap(
|
||||||
const Bitmap& rBmp,
|
const Bitmap& rBmp,
|
||||||
const AlphaMask& rAlpha,
|
const AlphaMask& rAlpha,
|
||||||
const Point& rDestPt,
|
const Point& rDestPt,
|
||||||
|
@@ -809,7 +809,7 @@ bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check XRenderExtension
|
// check XRenderExtension
|
||||||
if(m_bAllowAA && !Application::GetDefaultDevice()->supportsOperation( OutDevSupport_TransparentRect ))
|
if(m_bAllowAA && !Application::GetDefaultDevice()->SupportsOperation( OutDevSupport_TransparentRect ))
|
||||||
{
|
{
|
||||||
pThat->m_bAllowAA = false;
|
pThat->m_bAllowAA = false;
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,7 @@ namespace sdr
|
|||||||
return OVERLAY_INVERT;
|
return OVERLAY_INVERT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pOut->supportsOperation(OutDevSupport_TransparentRect))
|
if(!pOut->SupportsOperation(OutDevSupport_TransparentRect))
|
||||||
{
|
{
|
||||||
// not possible when no fast transparence paint is supported on the system
|
// not possible when no fast transparence paint is supported on the system
|
||||||
return OVERLAY_INVERT;
|
return OVERLAY_INVERT;
|
||||||
|
@@ -486,8 +486,6 @@ BitmapEx OutputDevice::GetBitmapEx( const Point& rSrcPt, const Size& rSize ) con
|
|||||||
return GetBitmap( rSrcPt, rSize );
|
return GetBitmap( rSrcPt, rSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize,
|
void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize,
|
||||||
const Point& rSrcPtPixel, const Size& rSrcSizePixel,
|
const Point& rSrcPtPixel, const Size& rSrcSizePixel,
|
||||||
BitmapEx& rBmpEx )
|
BitmapEx& rBmpEx )
|
||||||
@@ -512,7 +510,7 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize
|
|||||||
aSrcPtPixel.X() = rSrcPtPixel.X() * fScaleX;
|
aSrcPtPixel.X() = rSrcPtPixel.X() * fScaleX;
|
||||||
aSrcPtPixel.Y() = rSrcPtPixel.Y() * fScaleY;
|
aSrcPtPixel.Y() = rSrcPtPixel.Y() * fScaleY;
|
||||||
}
|
}
|
||||||
DrawAlphaBitmap(aScaledBitmapEx.GetBitmap(), aScaledBitmapEx.GetAlpha(), rDestPt, rDestSize, aSrcPtPixel, aSrcSizePixel);
|
DrawDeviceAlphaBitmap(aScaledBitmapEx.GetBitmap(), aScaledBitmapEx.GetAlpha(), rDestPt, rDestSize, aSrcPtPixel, aSrcSizePixel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,6 +651,184 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& rAlpha,
|
||||||
|
const Point& rDestPt, const Size& rDestSize,
|
||||||
|
const Point& rSrcPtPixel, const Size& rSrcSizePixel )
|
||||||
|
{
|
||||||
|
Point aOutPt( LogicToPixel( rDestPt ) );
|
||||||
|
Size aOutSz( LogicToPixel( rDestSize ) );
|
||||||
|
Rectangle aDstRect( Point(), GetOutputSizePixel() );
|
||||||
|
const bool bHMirr = aOutSz.Width() < 0;
|
||||||
|
const bool bVMirr = aOutSz.Height() < 0;
|
||||||
|
|
||||||
|
ClipToPaintRegion(aDstRect);
|
||||||
|
|
||||||
|
if( bHMirr )
|
||||||
|
{
|
||||||
|
aOutSz.Width() = -aOutSz.Width();
|
||||||
|
aOutPt.X() -= ( aOutSz.Width() - 1L );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bVMirr )
|
||||||
|
{
|
||||||
|
aOutSz.Height() = -aOutSz.Height();
|
||||||
|
aOutPt.Y() -= ( aOutSz.Height() - 1L );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !aDstRect.Intersection( Rectangle( aOutPt, aOutSz ) ).IsEmpty() )
|
||||||
|
{
|
||||||
|
bool bNativeAlpha = false;
|
||||||
|
static const char* pDisableNative = getenv( "SAL_DISABLE_NATIVE_ALPHA");
|
||||||
|
// #i83087# Naturally, system alpha blending cannot work with
|
||||||
|
// separate alpha VDev
|
||||||
|
bool bTryDirectPaint(!mpAlphaVDev && !pDisableNative && !bHMirr && !bVMirr);
|
||||||
|
|
||||||
|
#ifdef WNT
|
||||||
|
if(bTryDirectPaint)
|
||||||
|
{
|
||||||
|
// only paint direct when no scaling and no MapMode, else the
|
||||||
|
// more expensive conversions may be done for short-time Bitmap/BitmapEx
|
||||||
|
// used for buffering only
|
||||||
|
if(!IsMapMode() && rSrcSizePixel.Width() == aOutSz.Width() && rSrcSizePixel.Height() == aOutSz.Height())
|
||||||
|
{
|
||||||
|
bTryDirectPaint = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(bTryDirectPaint)
|
||||||
|
{
|
||||||
|
Point aRelPt = aOutPt + Point( mnOutOffX, mnOutOffY );
|
||||||
|
SalTwoRect aTR = {
|
||||||
|
rSrcPtPixel.X(), rSrcPtPixel.Y(),
|
||||||
|
rSrcSizePixel.Width(), rSrcSizePixel.Height(),
|
||||||
|
aRelPt.X(), aRelPt.Y(),
|
||||||
|
aOutSz.Width(), aOutSz.Height()
|
||||||
|
};
|
||||||
|
SalBitmap* pSalSrcBmp = rBmp.ImplGetImpBitmap()->ImplGetSalBitmap();
|
||||||
|
SalBitmap* pSalAlphaBmp = rAlpha.ImplGetImpBitmap()->ImplGetSalBitmap();
|
||||||
|
bNativeAlpha = mpGraphics->DrawAlphaBitmap( aTR, *pSalSrcBmp, *pSalAlphaBmp, this );
|
||||||
|
}
|
||||||
|
|
||||||
|
VirtualDevice* pOldVDev = mpAlphaVDev;
|
||||||
|
|
||||||
|
Rectangle aBmpRect( Point(), rBmp.GetSizePixel() );
|
||||||
|
if( !bNativeAlpha
|
||||||
|
&& !aBmpRect.Intersection( Rectangle( rSrcPtPixel, rSrcSizePixel ) ).IsEmpty() )
|
||||||
|
{
|
||||||
|
// The scaling in this code path produces really ugly results - it
|
||||||
|
// does the most trivial scaling with no smoothing.
|
||||||
|
|
||||||
|
GDIMetaFile* pOldMetaFile = mpMetaFile;
|
||||||
|
const bool bOldMap = mbMap;
|
||||||
|
mpMetaFile = NULL; // fdo#55044 reset before GetBitmap!
|
||||||
|
mbMap = false;
|
||||||
|
Bitmap aBmp( GetBitmap( aDstRect.TopLeft(), aDstRect.GetSize() ) );
|
||||||
|
|
||||||
|
// #109044# The generated bitmap need not necessarily be
|
||||||
|
// of aDstRect dimensions, it's internally clipped to
|
||||||
|
// window bounds. Thus, we correct the dest size here,
|
||||||
|
// since we later use it (in nDstWidth/Height) for pixel
|
||||||
|
// access)
|
||||||
|
// #i38887# reading from screen may sometimes fail
|
||||||
|
if( aBmp.ImplGetImpBitmap() )
|
||||||
|
aDstRect.SetSize( aBmp.GetSizePixel() );
|
||||||
|
|
||||||
|
BitmapColor aDstCol;
|
||||||
|
const long nSrcWidth = aBmpRect.GetWidth(), nSrcHeight = aBmpRect.GetHeight();
|
||||||
|
const long nDstWidth = aDstRect.GetWidth(), nDstHeight = aDstRect.GetHeight();
|
||||||
|
const long nOutWidth = aOutSz.Width(), nOutHeight = aOutSz.Height();
|
||||||
|
// calculate offset in original bitmap
|
||||||
|
// in RTL case this is a little more complicated since the contents of the
|
||||||
|
// bitmap is not mirrored (it never is), however the paint region and bmp region
|
||||||
|
// are in mirrored coordinates, so the intersection of (aOutPt,aOutSz) with these
|
||||||
|
// is content wise somewhere else and needs to take mirroring into account
|
||||||
|
const long nOffX = IsRTLEnabled()
|
||||||
|
? aOutSz.Width() - aDstRect.GetWidth() - (aDstRect.Left() - aOutPt.X())
|
||||||
|
: aDstRect.Left() - aOutPt.X(),
|
||||||
|
nOffY = aDstRect.Top() - aOutPt.Y();
|
||||||
|
long nX, nOutX, nY, nOutY;
|
||||||
|
long nMirrOffX = 0;
|
||||||
|
long nMirrOffY = 0;
|
||||||
|
boost::scoped_array<long> pMapX(new long[ nDstWidth ]);
|
||||||
|
boost::scoped_array<long> pMapY(new long[ nDstHeight ]);
|
||||||
|
|
||||||
|
// create horizontal mapping table
|
||||||
|
if( bHMirr )
|
||||||
|
nMirrOffX = ( aBmpRect.Left() << 1 ) + nSrcWidth - 1;
|
||||||
|
|
||||||
|
for( nX = 0L, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
|
||||||
|
{
|
||||||
|
pMapX[ nX ] = aBmpRect.Left() + nOutX * nSrcWidth / nOutWidth;
|
||||||
|
if( bHMirr )
|
||||||
|
pMapX[ nX ] = nMirrOffX - pMapX[ nX ];
|
||||||
|
}
|
||||||
|
|
||||||
|
// create vertical mapping table
|
||||||
|
if( bVMirr )
|
||||||
|
nMirrOffY = ( aBmpRect.Top() << 1 ) + nSrcHeight - 1;
|
||||||
|
|
||||||
|
for( nY = 0L, nOutY = nOffY; nY < nDstHeight; nY++, nOutY++ )
|
||||||
|
{
|
||||||
|
pMapY[ nY ] = aBmpRect.Top() + nOutY * nSrcHeight / nOutHeight;
|
||||||
|
|
||||||
|
if( bVMirr )
|
||||||
|
pMapY[ nY ] = nMirrOffY - pMapY[ nY ];
|
||||||
|
}
|
||||||
|
|
||||||
|
BitmapReadAccess* pP = ( (Bitmap&) rBmp ).AcquireReadAccess();
|
||||||
|
BitmapReadAccess* pA = ( (AlphaMask&) rAlpha ).AcquireReadAccess();
|
||||||
|
|
||||||
|
DBG_ASSERT( pA->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ||
|
||||||
|
pA->GetScanlineFormat() == BMP_FORMAT_8BIT_TC_MASK,
|
||||||
|
"OutputDevice::ImplDrawAlpha(): non-8bit alpha no longer supported!" );
|
||||||
|
|
||||||
|
// #i38887# reading from screen may sometimes fail
|
||||||
|
if( aBmp.ImplGetImpBitmap() )
|
||||||
|
{
|
||||||
|
Bitmap aTmp;
|
||||||
|
|
||||||
|
if( mpAlphaVDev )
|
||||||
|
{
|
||||||
|
aTmp = BlendBitmapWithAlpha(
|
||||||
|
aBmp,pP,pA,
|
||||||
|
aDstRect,
|
||||||
|
nOffY,nDstHeight,
|
||||||
|
nOffX,nDstWidth,
|
||||||
|
pMapX.get(),pMapY.get() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aTmp = BlendBitmap(
|
||||||
|
aBmp,pP,pA,
|
||||||
|
nOffY,nDstHeight,
|
||||||
|
nOffX,nDstWidth,
|
||||||
|
aBmpRect,aOutSz,
|
||||||
|
bHMirr,bVMirr,
|
||||||
|
pMapX.get(),pMapY.get() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// #110958# Disable alpha VDev, we're doing the necessary
|
||||||
|
// stuff explicitly furher below
|
||||||
|
if( mpAlphaVDev )
|
||||||
|
mpAlphaVDev = NULL;
|
||||||
|
|
||||||
|
DrawBitmap( aDstRect.TopLeft(),
|
||||||
|
aTmp );
|
||||||
|
|
||||||
|
// #110958# Enable alpha VDev again
|
||||||
|
mpAlphaVDev = pOldVDev;
|
||||||
|
}
|
||||||
|
|
||||||
|
( (Bitmap&) rBmp ).ReleaseAccess( pP );
|
||||||
|
( (AlphaMask&) rAlpha ).ReleaseAccess( pA );
|
||||||
|
|
||||||
|
mbMap = bOldMap;
|
||||||
|
mpMetaFile = pOldMetaFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OutputDevice::ScaleBitmap (Bitmap &rBmp, SalTwoRect &rPosAry)
|
void OutputDevice::ScaleBitmap (Bitmap &rBmp, SalTwoRect &rPosAry)
|
||||||
{
|
{
|
||||||
const double nScaleX = rPosAry.mnDestWidth / static_cast<double>( rPosAry.mnSrcWidth );
|
const double nScaleX = rPosAry.mnDestWidth / static_cast<double>( rPosAry.mnSrcWidth );
|
||||||
@@ -775,7 +951,7 @@ bool OutputDevice::TransformAndReduceBitmapExToTargetRange(
|
|||||||
aVisibleRange.transform(aMakeVisibleRangeRelative);
|
aVisibleRange.transform(aMakeVisibleRangeRelative);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for pixel devices, do *not* limit size, else OutputDevice::DrawAlphaBitmap
|
// for pixel devices, do *not* limit size, else OutputDevice::DrawDeviceAlphaBitmap
|
||||||
// will create another, badly scaled bitmap to do the job. Nonetheless, do a
|
// will create another, badly scaled bitmap to do the job. Nonetheless, do a
|
||||||
// maximum clipping of something big (1600x1280x2). Add 1.0 to avoid rounding
|
// maximum clipping of something big (1600x1280x2). Add 1.0 to avoid rounding
|
||||||
// errors in rough estimations
|
// errors in rough estimations
|
||||||
@@ -1014,184 +1190,6 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputDevice::DrawAlphaBitmap( const Bitmap& rBmp, const AlphaMask& rAlpha,
|
|
||||||
const Point& rDestPt, const Size& rDestSize,
|
|
||||||
const Point& rSrcPtPixel, const Size& rSrcSizePixel )
|
|
||||||
{
|
|
||||||
Point aOutPt( LogicToPixel( rDestPt ) );
|
|
||||||
Size aOutSz( LogicToPixel( rDestSize ) );
|
|
||||||
Rectangle aDstRect( Point(), GetOutputSizePixel() );
|
|
||||||
const bool bHMirr = aOutSz.Width() < 0;
|
|
||||||
const bool bVMirr = aOutSz.Height() < 0;
|
|
||||||
|
|
||||||
ClipToPaintRegion(aDstRect);
|
|
||||||
|
|
||||||
if( bHMirr )
|
|
||||||
{
|
|
||||||
aOutSz.Width() = -aOutSz.Width();
|
|
||||||
aOutPt.X() -= ( aOutSz.Width() - 1L );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( bVMirr )
|
|
||||||
{
|
|
||||||
aOutSz.Height() = -aOutSz.Height();
|
|
||||||
aOutPt.Y() -= ( aOutSz.Height() - 1L );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !aDstRect.Intersection( Rectangle( aOutPt, aOutSz ) ).IsEmpty() )
|
|
||||||
{
|
|
||||||
bool bNativeAlpha = false;
|
|
||||||
static const char* pDisableNative = getenv( "SAL_DISABLE_NATIVE_ALPHA");
|
|
||||||
// #i83087# Naturally, system alpha blending cannot work with
|
|
||||||
// separate alpha VDev
|
|
||||||
bool bTryDirectPaint(!mpAlphaVDev && !pDisableNative && !bHMirr && !bVMirr);
|
|
||||||
|
|
||||||
#ifdef WNT
|
|
||||||
if(bTryDirectPaint)
|
|
||||||
{
|
|
||||||
// only paint direct when no scaling and no MapMode, else the
|
|
||||||
// more expensive conversions may be done for short-time Bitmap/BitmapEx
|
|
||||||
// used for buffering only
|
|
||||||
if(!IsMapMode() && rSrcSizePixel.Width() == aOutSz.Width() && rSrcSizePixel.Height() == aOutSz.Height())
|
|
||||||
{
|
|
||||||
bTryDirectPaint = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(bTryDirectPaint)
|
|
||||||
{
|
|
||||||
Point aRelPt = aOutPt + Point( mnOutOffX, mnOutOffY );
|
|
||||||
SalTwoRect aTR = {
|
|
||||||
rSrcPtPixel.X(), rSrcPtPixel.Y(),
|
|
||||||
rSrcSizePixel.Width(), rSrcSizePixel.Height(),
|
|
||||||
aRelPt.X(), aRelPt.Y(),
|
|
||||||
aOutSz.Width(), aOutSz.Height()
|
|
||||||
};
|
|
||||||
SalBitmap* pSalSrcBmp = rBmp.ImplGetImpBitmap()->ImplGetSalBitmap();
|
|
||||||
SalBitmap* pSalAlphaBmp = rAlpha.ImplGetImpBitmap()->ImplGetSalBitmap();
|
|
||||||
bNativeAlpha = mpGraphics->DrawAlphaBitmap( aTR, *pSalSrcBmp, *pSalAlphaBmp, this );
|
|
||||||
}
|
|
||||||
|
|
||||||
VirtualDevice* pOldVDev = mpAlphaVDev;
|
|
||||||
|
|
||||||
Rectangle aBmpRect( Point(), rBmp.GetSizePixel() );
|
|
||||||
if( !bNativeAlpha
|
|
||||||
&& !aBmpRect.Intersection( Rectangle( rSrcPtPixel, rSrcSizePixel ) ).IsEmpty() )
|
|
||||||
{
|
|
||||||
// The scaling in this code path produces really ugly results - it
|
|
||||||
// does the most trivial scaling with no smoothing.
|
|
||||||
|
|
||||||
GDIMetaFile* pOldMetaFile = mpMetaFile;
|
|
||||||
const bool bOldMap = mbMap;
|
|
||||||
mpMetaFile = NULL; // fdo#55044 reset before GetBitmap!
|
|
||||||
mbMap = false;
|
|
||||||
Bitmap aBmp( GetBitmap( aDstRect.TopLeft(), aDstRect.GetSize() ) );
|
|
||||||
|
|
||||||
// #109044# The generated bitmap need not necessarily be
|
|
||||||
// of aDstRect dimensions, it's internally clipped to
|
|
||||||
// window bounds. Thus, we correct the dest size here,
|
|
||||||
// since we later use it (in nDstWidth/Height) for pixel
|
|
||||||
// access)
|
|
||||||
// #i38887# reading from screen may sometimes fail
|
|
||||||
if( aBmp.ImplGetImpBitmap() )
|
|
||||||
aDstRect.SetSize( aBmp.GetSizePixel() );
|
|
||||||
|
|
||||||
BitmapColor aDstCol;
|
|
||||||
const long nSrcWidth = aBmpRect.GetWidth(), nSrcHeight = aBmpRect.GetHeight();
|
|
||||||
const long nDstWidth = aDstRect.GetWidth(), nDstHeight = aDstRect.GetHeight();
|
|
||||||
const long nOutWidth = aOutSz.Width(), nOutHeight = aOutSz.Height();
|
|
||||||
// calculate offset in original bitmap
|
|
||||||
// in RTL case this is a little more complicated since the contents of the
|
|
||||||
// bitmap is not mirrored (it never is), however the paint region and bmp region
|
|
||||||
// are in mirrored coordinates, so the intersection of (aOutPt,aOutSz) with these
|
|
||||||
// is content wise somewhere else and needs to take mirroring into account
|
|
||||||
const long nOffX = IsRTLEnabled()
|
|
||||||
? aOutSz.Width() - aDstRect.GetWidth() - (aDstRect.Left() - aOutPt.X())
|
|
||||||
: aDstRect.Left() - aOutPt.X(),
|
|
||||||
nOffY = aDstRect.Top() - aOutPt.Y();
|
|
||||||
long nX, nOutX, nY, nOutY;
|
|
||||||
long nMirrOffX = 0;
|
|
||||||
long nMirrOffY = 0;
|
|
||||||
boost::scoped_array<long> pMapX(new long[ nDstWidth ]);
|
|
||||||
boost::scoped_array<long> pMapY(new long[ nDstHeight ]);
|
|
||||||
|
|
||||||
// create horizontal mapping table
|
|
||||||
if( bHMirr )
|
|
||||||
nMirrOffX = ( aBmpRect.Left() << 1 ) + nSrcWidth - 1;
|
|
||||||
|
|
||||||
for( nX = 0L, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
|
|
||||||
{
|
|
||||||
pMapX[ nX ] = aBmpRect.Left() + nOutX * nSrcWidth / nOutWidth;
|
|
||||||
if( bHMirr )
|
|
||||||
pMapX[ nX ] = nMirrOffX - pMapX[ nX ];
|
|
||||||
}
|
|
||||||
|
|
||||||
// create vertical mapping table
|
|
||||||
if( bVMirr )
|
|
||||||
nMirrOffY = ( aBmpRect.Top() << 1 ) + nSrcHeight - 1;
|
|
||||||
|
|
||||||
for( nY = 0L, nOutY = nOffY; nY < nDstHeight; nY++, nOutY++ )
|
|
||||||
{
|
|
||||||
pMapY[ nY ] = aBmpRect.Top() + nOutY * nSrcHeight / nOutHeight;
|
|
||||||
|
|
||||||
if( bVMirr )
|
|
||||||
pMapY[ nY ] = nMirrOffY - pMapY[ nY ];
|
|
||||||
}
|
|
||||||
|
|
||||||
BitmapReadAccess* pP = ( (Bitmap&) rBmp ).AcquireReadAccess();
|
|
||||||
BitmapReadAccess* pA = ( (AlphaMask&) rAlpha ).AcquireReadAccess();
|
|
||||||
|
|
||||||
DBG_ASSERT( pA->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ||
|
|
||||||
pA->GetScanlineFormat() == BMP_FORMAT_8BIT_TC_MASK,
|
|
||||||
"OutputDevice::ImplDrawAlpha(): non-8bit alpha no longer supported!" );
|
|
||||||
|
|
||||||
// #i38887# reading from screen may sometimes fail
|
|
||||||
if( aBmp.ImplGetImpBitmap() )
|
|
||||||
{
|
|
||||||
Bitmap aTmp;
|
|
||||||
|
|
||||||
if( mpAlphaVDev )
|
|
||||||
{
|
|
||||||
aTmp = BlendBitmapWithAlpha(
|
|
||||||
aBmp,pP,pA,
|
|
||||||
aDstRect,
|
|
||||||
nOffY,nDstHeight,
|
|
||||||
nOffX,nDstWidth,
|
|
||||||
pMapX.get(),pMapY.get() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aTmp = BlendBitmap(
|
|
||||||
aBmp,pP,pA,
|
|
||||||
nOffY,nDstHeight,
|
|
||||||
nOffX,nDstWidth,
|
|
||||||
aBmpRect,aOutSz,
|
|
||||||
bHMirr,bVMirr,
|
|
||||||
pMapX.get(),pMapY.get() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// #110958# Disable alpha VDev, we're doing the necessary
|
|
||||||
// stuff explicitly furher below
|
|
||||||
if( mpAlphaVDev )
|
|
||||||
mpAlphaVDev = NULL;
|
|
||||||
|
|
||||||
DrawBitmap( aDstRect.TopLeft(),
|
|
||||||
aTmp );
|
|
||||||
|
|
||||||
// #110958# Enable alpha VDev again
|
|
||||||
mpAlphaVDev = pOldVDev;
|
|
||||||
}
|
|
||||||
|
|
||||||
( (Bitmap&) rBmp ).ReleaseAccess( pP );
|
|
||||||
( (AlphaMask&) rAlpha ).ReleaseAccess( pA );
|
|
||||||
|
|
||||||
mbMap = bOldMap;
|
|
||||||
mpMetaFile = pOldMetaFile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// Co = Cs + Cd*(1-As) premultiplied alpha -or-
|
// Co = Cs + Cd*(1-As) premultiplied alpha -or-
|
||||||
|
@@ -428,7 +428,7 @@ void OutputDevice::Pop()
|
|||||||
mpMetaFile = pOldMetaFile;
|
mpMetaFile = pOldMetaFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OutputDevice::supportsOperation( OutDevSupportType eType ) const
|
bool OutputDevice::SupportsOperation( OutDevSupportType eType ) const
|
||||||
{
|
{
|
||||||
if( !mpGraphics )
|
if( !mpGraphics )
|
||||||
if( !AcquireGraphics() )
|
if( !AcquireGraphics() )
|
||||||
|
Reference in New Issue
Block a user