summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-02-27 15:50:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-26 12:51:58 +0200
commitddd2639a482befb4a3bf1f75a88e66c21a691b67 (patch)
tree2d2a2a0695dce2b8b065f107368ef0412807fa73 /vcl/source/gdi
parent9c4e0c35d70659097b235028047efcb80dcfb10d (diff)
drop mask from BitmapEx
So that we have fewer cases to deal with when we transition to 32-bit bitmaps. (*) rename maMask to maAlphaMask, since now it is only being used for alpha duties. (*) drop mbAlpha and mbTransparent to simplify state management, the only thing we need to check for alpha is if maAlphaMask is non-empty. Change-Id: I06252e38e950e846a94b4c2ba8ea763be17801fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111679 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/gdimetafiletools.cxx2
-rw-r--r--vcl/source/gdi/gdimtf.cxx2
-rw-r--r--vcl/source/gdi/impgraph.cxx4
-rw-r--r--vcl/source/gdi/mtfxmldump.cxx20
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx7
-rw-r--r--vcl/source/gdi/pdfwriter.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx52
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx21
-rw-r--r--vcl/source/gdi/print.cxx5
-rw-r--r--vcl/source/gdi/print2.cxx32
11 files changed, 45 insertions, 108 deletions
diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx
index e0b96a6ba5ce..9b3e26afb331 100644
--- a/vcl/source/gdi/gdimetafiletools.cxx
+++ b/vcl/source/gdi/gdimetafiletools.cxx
@@ -171,7 +171,7 @@ namespace
aVDev->SetFillColor( COL_WHITE);
aVDev->SetLineColor();
- if(rBitmapEx.IsTransparent())
+ if(rBitmapEx.IsAlpha())
{
// use given alpha channel
aVDev->DrawBitmap(Point(0, 0), rBitmapEx.GetAlpha().GetBitmap());
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 2856ecaed18e..a31f8e768ece 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -1780,8 +1780,6 @@ BitmapEx GDIMetaFile::ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpPa
if( rBmpEx.IsAlpha() )
return BitmapEx( aBmp, rBmpEx.GetAlpha() );
- else if( rBmpEx.IsTransparent() )
- return BitmapEx( aBmp, rBmpEx.GetMask() );
else
return BitmapEx( aBmp );
}
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index b06423adbe3e..91f2bca31189 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -466,7 +466,7 @@ bool ImpGraphic::isTransparent() const
}
else if (meType == GraphicType::Bitmap && !maVectorGraphicData)
{
- bRet = mpAnimation ? mpAnimation->IsTransparent() : maBitmapEx.IsTransparent();
+ bRet = mpAnimation ? mpAnimation->IsTransparent() : maBitmapEx.IsAlpha();
}
return bRet;
@@ -741,7 +741,7 @@ const GDIMetaFile& ImpGraphic::getGDIMetaFile() const
// #123983# directly create a metafile with the same PrefSize and PrefMapMode
// the bitmap has, this will be an always correct metafile
- if(maBitmapEx.IsTransparent())
+ if(maBitmapEx.IsAlpha())
{
pThat->maMetaFile.AddAction(new MetaBmpExScaleAction(Point(), maBitmapEx.GetPrefSize(), maBitmapEx));
}
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 373eb2b20a69..d612898e6c8c 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -331,14 +331,12 @@ OString convertLineStyleToString(const MetaActionType nActionType)
return "";
}
-OUString convertBitmapExTransparentType(TransparentType eType)
+OUString convertBitmapExTransparentType(BitmapEx const & rBitmapEx)
{
- switch (eType)
- {
- default:
- case TransparentType::NONE: return "none";
- case TransparentType::Bitmap: return "bitmap";
- }
+ if (rBitmapEx.IsAlpha())
+ return "bitmap";
+ else
+ return "none";
}
OUString convertMapUnitToString(MapUnit eUnit)
@@ -856,7 +854,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
rWriter.startElement(sCurrentElementTag);
writePoint(rWriter, pMeta->GetPoint());
rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
- rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
+ rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
rWriter.endElement();
}
break;
@@ -868,7 +866,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
writePoint(rWriter, pMeta->GetPoint());
writeSize(rWriter, pMeta->GetSize());
rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
- rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
+ rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
rWriter.endElement();
}
break;
@@ -886,7 +884,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
- rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
+ rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
rWriter.endElement();
}
break;
@@ -1002,7 +1000,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
rWriter.startElement("bitmap");
BitmapEx const & rBitmapEx = rWallpaper.GetBitmap();
rWriter.attribute("crc", hex32(rBitmapEx.GetChecksum()));
- rWriter.attribute("transparenttype", convertBitmapExTransparentType(rBitmapEx.GetTransparentType()));
+ rWriter.attribute("transparenttype", convertBitmapExTransparentType(rBitmapEx));
rWriter.attribute("pixelformat", convertPixelFormatToString(rBitmapEx.GetBitmap().getPixelFormat()));
rWriter.attribute("width", hex32(rBitmapEx.GetSizePixel().Width()));
rWriter.attribute("height", hex32(rBitmapEx.GetSizePixel().Height()));
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index fc431c7e65a2..96a77a15d94d 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -451,12 +451,11 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
rWriter.SetClipRegion( aRect);
}
- Bitmap aMask;
+ AlphaMask aAlphaMask;
if (nTransparency)
{
- AlphaMask aAlphaMask(aGraphic.GetSizePixel());
+ aAlphaMask = AlphaMask(aGraphic.GetSizePixel());
aAlphaMask.Erase(nTransparency);
- aMask = aAlphaMask.GetBitmap();
}
SvMemoryStream aTmp;
@@ -483,7 +482,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
}
}
auto ePixelFormat = aGraphic.GetBitmapEx().getPixelFormat();
- rWriter.DrawJPGBitmap(aTmp, ePixelFormat > vcl::PixelFormat::N8_BPP, aGraphic.GetSizePixel(), aOutputRect, aMask, aGraphic);
+ rWriter.DrawJPGBitmap(aTmp, ePixelFormat > vcl::PixelFormat::N8_BPP, aGraphic.GetSizePixel(), aOutputRect, aAlphaMask, aGraphic);
}
if ( bClippingNeeded )
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index ab7a03cb205c..53609379bca8 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -323,9 +323,9 @@ void PDFWriter::SetTextAlign( ::TextAlign eAlign )
xImplementation->setTextAlign( eAlign );
}
-void PDFWriter::DrawJPGBitmap( SvStream& rStreamData, bool bIsTrueColor, const Size& rSrcSizePixel, const tools::Rectangle& rTargetArea, const Bitmap& rMask, const Graphic& rGraphic )
+void PDFWriter::DrawJPGBitmap( SvStream& rStreamData, bool bIsTrueColor, const Size& rSrcSizePixel, const tools::Rectangle& rTargetArea, const AlphaMask& rAlphaMask, const Graphic& rGraphic )
{
- xImplementation->drawJPGBitmap( rStreamData, bIsTrueColor, rSrcSizePixel, rTargetArea, rMask, rGraphic );
+ xImplementation->drawJPGBitmap( rStreamData, bIsTrueColor, rSrcSizePixel, rTargetArea, rAlphaMask, rGraphic );
}
sal_Int32 PDFWriter::CreateLink( const tools::Rectangle& rRect, sal_Int32 nPageNr )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index ad9c1e0935e4..99918b8df1b1 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1735,7 +1735,7 @@ void PDFWriterImpl::endPage()
{
writeJPG( jpeg );
jpeg.m_pStream.reset();
- jpeg.m_aMask = Bitmap();
+ jpeg.m_aAlphaMask = AlphaMask();
}
}
for (auto & item : m_aTransparentObjects)
@@ -8368,12 +8368,10 @@ void PDFWriterImpl::writeJPG( JPGEmit& rObject )
rObject.m_pStream->Seek( STREAM_SEEK_TO_BEGIN );
sal_Int32 nMaskObject = 0;
- if( !rObject.m_aMask.IsEmpty() )
+ if( !rObject.m_aAlphaMask.IsEmpty() )
{
- if (rObject.m_aMask.getPixelFormat() == vcl::PixelFormat::N1_BPP
- || (rObject.m_aMask.getPixelFormat() == vcl::PixelFormat::N8_BPP
- && m_aContext.Version >= PDFWriter::PDFVersion::PDF_1_4
- && !m_bIsPDF_A1))
+ if (m_aContext.Version >= PDFWriter::PDFVersion::PDF_1_4
+ && !m_bIsPDF_A1)
{
nMaskObject = createObject();
}
@@ -8404,7 +8402,7 @@ void PDFWriterImpl::writeJPG( JPGEmit& rObject )
aLine.append( nLength );
if( nMaskObject )
{
- aLine.append(rObject.m_aMask.getPixelFormat() == vcl::PixelFormat::N1_BPP ? " /Mask " : " /SMask ");
+ aLine.append(" /SMask ");
aLine.append( nMaskObject );
aLine.append( " 0 R " );
}
@@ -8423,10 +8421,7 @@ void PDFWriterImpl::writeJPG( JPGEmit& rObject )
{
BitmapEmit aEmit;
aEmit.m_nObject = nMaskObject;
- if (rObject.m_aMask.getPixelFormat() == vcl::PixelFormat::N1_BPP)
- aEmit.m_aBitmap = BitmapEx( rObject.m_aMask, rObject.m_aMask );
- else if(rObject.m_aMask.getPixelFormat() == vcl::PixelFormat::N8_BPP)
- aEmit.m_aBitmap = BitmapEx( rObject.m_aMask, AlphaMask( rObject.m_aMask ) );
+ aEmit.m_aBitmap = BitmapEx( rObject.m_aAlphaMask, rObject.m_aAlphaMask );
writeBitmapObject( aEmit, true );
}
@@ -8708,23 +8703,12 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
bWriteMask = true;
// else draw without alpha channel
}
- else
- {
- switch( rObject.m_aBitmap.GetTransparentType() )
- {
- case TransparentType::NONE:
- break;
- case TransparentType::Bitmap:
- bWriteMask = true;
- break;
- }
- }
}
else
{
if( m_aContext.Version < PDFWriter::PDFVersion::PDF_1_4 || ! rObject.m_aBitmap.IsAlpha() )
{
- aBitmap = getExportBitmap(rObject.m_aBitmap.GetMask());
+ aBitmap = getExportBitmap(rObject.m_aBitmap.GetAlpha());
aBitmap.Convert( BmpConversion::N1BitThreshold );
SAL_WARN_IF(aBitmap.getPixelFormat() != vcl::PixelFormat::N1_BPP, "vcl.pdfwriter", "mask conversion failed" );
}
@@ -9003,7 +8987,7 @@ void PDFWriterImpl::createEmbeddedFile(const Graphic& rGraphic, ReferenceXObject
rEmit.m_aPixelSize = rGraphic.GetPrefSize();
}
-void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const Size& rSizePixel, const tools::Rectangle& rTargetArea, const Bitmap& rMask, const Graphic& rGraphic )
+void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const Size& rSizePixel, const tools::Rectangle& rTargetArea, const AlphaMask& rAlphaMask, const Graphic& rGraphic )
{
MARK( "drawJPGBitmap" );
@@ -9023,10 +9007,10 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const
// load stream to bitmap and draw the bitmap instead
Graphic aGraphic;
GraphicConverter::Import( rDCTData, aGraphic, ConvertDataFormat::JPG );
- if( !rMask.IsEmpty() && rMask.GetSizePixel() == aGraphic.GetSizePixel() )
+ if( !rAlphaMask.IsEmpty() && rAlphaMask.GetSizePixel() == aGraphic.GetSizePixel() )
{
Bitmap aBmp( aGraphic.GetBitmapEx().GetBitmap() );
- BitmapEx aBmpEx( aBmp, rMask );
+ BitmapEx aBmpEx( aBmp, rAlphaMask );
drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmpEx );
}
else
@@ -9043,8 +9027,8 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const
aID.m_nSize = pStream->Tell();
pStream->Seek( STREAM_SEEK_TO_BEGIN );
aID.m_nChecksum = vcl_get_checksum( 0, pStream->GetData(), aID.m_nSize );
- if( ! rMask.IsEmpty() )
- aID.m_nMaskChecksum = rMask.GetChecksum();
+ if( ! rAlphaMask.IsEmpty() )
+ aID.m_nMaskChecksum = rAlphaMask.GetChecksum();
std::vector< JPGEmit >::const_iterator it = std::find_if(m_aJPGs.begin(), m_aJPGs.end(),
[&](const JPGEmit& arg) { return aID == arg.m_aID; });
@@ -9057,8 +9041,8 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const
rEmit.m_aID = aID;
rEmit.m_pStream = std::move( pStream );
rEmit.m_bTrueColor = bIsTrueColor;
- if( !rMask.IsEmpty() && rMask.GetSizePixel() == rSizePixel )
- rEmit.m_aMask = rMask;
+ if( !rAlphaMask.IsEmpty() && rAlphaMask.GetSizePixel() == rSizePixel )
+ rEmit.m_aAlphaMask = rAlphaMask;
createEmbeddedFile(rGraphic, rEmit.m_aReferenceXObject, rEmit.m_nObject);
it = m_aJPGs.begin();
@@ -9140,12 +9124,6 @@ const BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx& i_rBitmap, co
aID.m_nMaskChecksum = 0;
if( aBitmap.IsAlpha() )
aID.m_nMaskChecksum = aBitmap.GetAlpha().GetChecksum();
- else
- {
- Bitmap aMask = aBitmap.GetMask();
- if( ! aMask.IsEmpty() )
- aID.m_nMaskChecksum = aMask.GetChecksum();
- }
std::list< BitmapEmit >::const_iterator it = std::find_if(m_aBitmaps.begin(), m_aBitmaps.end(),
[&](const BitmapEmit& arg) { return aID == arg.m_aID; });
if( it == m_aBitmaps.end() )
@@ -9412,7 +9390,7 @@ void PDFWriterImpl::drawWallpaper( const tools::Rectangle& rRect, const Wallpape
bDrawBitmap = true;
}
- if( aBitmap.IsTransparent() )
+ if( aBitmap.IsAlpha() )
{
if( rWall.IsGradient() )
bDrawGradient = true;
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 6280fc5ec11f..d49add8e8f71 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -230,7 +230,7 @@ struct JPGEmit
BitmapID m_aID;
std::unique_ptr<SvMemoryStream>
m_pStream;
- Bitmap m_aMask;
+ AlphaMask m_aAlphaMask;
sal_Int32 m_nObject;
bool m_bTrueColor;
ReferenceXObjectEmit m_aReferenceXObject;
@@ -1204,7 +1204,7 @@ public:
void drawBitmap( const Point& rDestPoint, const Size& rDestSize, const Bitmap& rBitmap, const Graphic& rGraphic );
void drawBitmap( const Point& rDestPoint, const Size& rDestSize, const BitmapEx& rBitmap );
- void drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const Size& rSizePixel, const tools::Rectangle& rTargetArea, const Bitmap& rMask, const Graphic& rGraphic );
+ void drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const Size& rSizePixel, const tools::Rectangle& rTargetArea, const AlphaMask& rAlphaMask, const Graphic& rGraphic );
/// Stores the original PDF data from rGraphic as an embedded file.
void createEmbeddedFile(const Graphic& rGraphic, ReferenceXObjectEmit& rEmit, sal_Int32 nBitmapObject);
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index a0a4fb828995..878915e650c7 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -172,21 +172,21 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
bUseJPGCompression = false;
auto pStrm=std::make_shared<SvMemoryStream>();
- Bitmap aMask;
+ AlphaMask aAlphaMask;
bool bTrueColorJPG = true;
if ( bUseJPGCompression )
{
// TODO this checks could be done much earlier, saving us
// from trying conversion & stores before...
- if ( !aBitmapEx.IsTransparent() )
+ if ( !aBitmapEx.IsAlpha() )
{
const auto& rCacheEntry=m_aPDFBmpCache.find(
aBitmapEx.GetChecksum());
if ( rCacheEntry != m_aPDFBmpCache.end() )
{
m_rOuterFace.DrawJPGBitmap( *rCacheEntry->second, true, aSizePixel,
- tools::Rectangle( aPoint, aSize ), aMask, i_Graphic );
+ tools::Rectangle( aPoint, aSize ), aAlphaMask, i_Graphic );
return;
}
}
@@ -199,13 +199,8 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
WriteDIBBitmapEx(aBitmapEx, aTemp); // is capable of zlib stream compression
nZippedFileSize = aTemp.TellEnd();
}
- if ( aBitmapEx.IsTransparent() )
- {
- if ( aBitmapEx.IsAlpha() )
- aMask = aBitmapEx.GetAlpha().GetBitmap();
- else
- aMask = aBitmapEx.GetMask();
- }
+ if ( aBitmapEx.IsAlpha() )
+ aAlphaMask = aBitmapEx.GetAlpha();
Graphic aGraphic(BitmapEx(aBitmapEx.GetBitmap()));
Sequence< PropertyValue > aFilterData( 2 );
@@ -261,15 +256,15 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
}
if ( bUseJPGCompression )
{
- m_rOuterFace.DrawJPGBitmap( *pStrm, bTrueColorJPG, aSizePixel, tools::Rectangle( aPoint, aSize ), aMask, i_Graphic );
- if (!aBitmapEx.IsTransparent() && bTrueColorJPG)
+ m_rOuterFace.DrawJPGBitmap( *pStrm, bTrueColorJPG, aSizePixel, tools::Rectangle( aPoint, aSize ), aAlphaMask, i_Graphic );
+ if (!aBitmapEx.IsAlpha() && bTrueColorJPG)
{
// Cache last jpeg export
m_aPDFBmpCache.insert(
{aBitmapEx.GetChecksum(), pStrm});
}
}
- else if ( aBitmapEx.IsTransparent() )
+ else if ( aBitmapEx.IsAlpha() )
m_rOuterFace.DrawBitmapEx( aPoint, aSize, aBitmapEx );
else
m_rOuterFace.DrawBitmap( aPoint, aSize, aBitmapEx.GetBitmap(), i_Graphic );
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index e88592f225a5..d7928956e9bd 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -307,9 +307,8 @@ void Printer::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize,
}
else
{
- Bitmap aBmp( rBmpEx.GetBitmap() ), aMask( rBmpEx.GetMask() );
- aBmp.Replace( aMask, COL_WHITE );
- ImplPrintTransparent( aBmp, aMask, rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
+ Bitmap aBmp( rBmpEx.GetBitmap() );
+ ImplPrintTransparent( aBmp, Bitmap(), rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
}
}
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index f7e4d8875341..3526d9017cb5 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -186,37 +186,7 @@ void ImplConvertTransparentAction( GDIMetaFile& o_rMtf,
}
Bitmap aBmp(aBmpEx.GetBitmap());
- if (!aBmpEx.IsAlpha())
- {
- // blend with mask
- Bitmap::ScopedReadAccess pRA(aBmp);
-
- if (!pRA)
- return; // what else should I do?
-
- Color aActualColor(aBgColor);
-
- if (pRA->HasPalette())
- aActualColor = pRA->GetBestPaletteColor(aBgColor);
-
- pRA.reset();
-
- // did we get true white?
- if (aActualColor.GetColorError(aBgColor))
- {
- // no, create truecolor bitmap, then
- aBmp.Convert(BmpConversion::N24Bit);
-
- // fill masked out areas white
- aBmp.Replace(aBmpEx.GetMask(), aBgColor);
- }
- else
- {
- // fill masked out areas white
- aBmp.Replace(aBmpEx.GetMask(), aActualColor);
- }
- }
- else
+ if (aBmpEx.IsAlpha())
{
// blend with alpha channel
aBmp.Convert(BmpConversion::N24Bit);