[Libreoffice-commits] core.git: drawinglayer/source include/vcl vcl/osx vcl/source vcl/unx
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 3 07:27:31 UTC 2021
drawinglayer/source/texture/texture3d.cxx | 11 -----
include/vcl/bitmapex.hxx | 9 +---
vcl/osx/salinst.cxx | 6 --
vcl/source/bitmap/BitmapEx.cxx | 61 ++++++------------------------
vcl/source/bitmap/BitmapTools.cxx | 13 ------
vcl/source/bitmap/dibtools.cxx | 13 +-----
vcl/source/gdi/mtfxmldump.cxx | 1
vcl/source/gdi/pdfwriter_impl.cxx | 30 --------------
vcl/source/outdev/outdevstate.cxx | 6 --
vcl/unx/generic/window/salframe.cxx | 3 -
10 files changed, 21 insertions(+), 132 deletions(-)
New commits:
commit 63dd594d535b1272a29a3f4217212b6063a08af6
Author: Noel Grandin <noel at peralex.com>
AuthorDate: Sat Feb 27 18:35:14 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Mar 3 08:26:47 2021 +0100
drop TransparentType::Color usage
which is dead code, since we convert to TransparentType::Bitmask
in the constructor of BitmapEx
Change-Id: I047b7d25317c4be4d17a8b0db9a90ec101875c9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111683
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx
index b4154f1e1bd6..ef53c94d0d10 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -121,17 +121,6 @@ namespace drawinglayer::texture
{
break;
}
- case TransparentType::Color:
- {
- const BitmapColor aBitmapColor(mpReadBitmap->GetColor(rY, rX));
-
- if(maBitmapEx.GetTransparentColor() == aBitmapColor)
- {
- return 255;
- }
-
- break;
- }
case TransparentType::Bitmap:
{
OSL_ENSURE(mpReadTransparence, "OOps, transparence type Bitmap, but no read access created in the constructor (?)");
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 75e605cb96a9..506901134719 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -36,9 +36,9 @@ namespace basegfx { class BColorModifierStack; }
enum class TransparentType
{
- NONE,
- Color,
- Bitmap
+ NONE = 0,
+ // Color = 1, Never actually used in BitmapEx, only present for backwards compat with existing SVM files
+ Bitmap = 2
};
class SAL_WARN_UNUSED VCL_DLLPUBLIC BitmapEx
@@ -90,8 +90,6 @@ public:
const MapMode& GetPrefMapMode() const { return maBitmap.GetPrefMapMode(); }
void SetPrefMapMode( const MapMode& rPrefMapMode ) { maBitmap.SetPrefMapMode( rPrefMapMode ); }
- const Color& GetTransparentColor() const { return maTransparentColor; }
-
sal_uInt16 GetBitCount() const { return maBitmap.GetBitCount(); }
sal_uLong GetSizeBytes() const;
BitmapChecksum GetChecksum() const;
@@ -475,7 +473,6 @@ private:
Bitmap maBitmap;
Bitmap maMask;
Size maBitmapSize;
- Color maTransparentColor;
TransparentType meTransparent;
bool mbAlpha;
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 748655c86641..b090957fc922 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -932,12 +932,6 @@ CGImageRef CreateCGImage( const Image& rImage )
else
xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
}
- else if( aBmpEx.GetTransparentType() == TransparentType::Color )
- {
- Color aTransColor( aBmpEx.GetTransparentColor() );
- Color nTransColor( aTransColor.GetRed(), aTransColor.GetGreen(), aTransColor.GetBlue() );
- xImage = pSalBmp->CreateColorMask( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight, nTransColor );
- }
return xImage;
}
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index c75aa12ed27b..db889e8c6a98 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -156,19 +156,20 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask ) :
}
}
+
BitmapEx::BitmapEx( const Bitmap& rBmp, const Color& rTransparentColor ) :
maBitmap ( rBmp ),
maBitmapSize ( maBitmap.GetSizePixel() ),
- maTransparentColor ( rTransparentColor ),
meTransparent ( TransparentType::Bitmap ),
mbAlpha ( false )
{
- maMask = maBitmap.CreateMask( maTransparentColor );
+ maMask = maBitmap.CreateMask( rTransparentColor );
SAL_WARN_IF(rBmp.GetSizePixel() != maMask.GetSizePixel(), "vcl",
"BitmapEx::BitmapEx(): size mismatch for bitmap and alpha mask.");
}
+
BitmapEx& BitmapEx::operator=( const BitmapEx& ) = default;
bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) const
@@ -182,10 +183,6 @@ bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) const
if (meTransparent != rBitmapEx.meTransparent)
return false;
- if (meTransparent == TransparentType::Color
- && maTransparentColor != rBitmapEx.maTransparentColor)
- return false;
-
if (mbAlpha != rBitmapEx.mbAlpha)
return false;
@@ -234,12 +231,7 @@ Bitmap BitmapEx::GetBitmap( Color aTransparentReplaceColor ) const
if( meTransparent != TransparentType::NONE )
{
- Bitmap aTempMask;
-
- if( meTransparent == TransparentType::Color )
- aTempMask = maBitmap.CreateMask( maTransparentColor );
- else
- aTempMask = maMask;
+ Bitmap aTempMask = maMask;
if( !IsAlpha() )
aRetBmp.Replace( aTempMask, aTransparentReplaceColor );
@@ -315,13 +307,8 @@ bool BitmapEx::Invert()
bool bRet = false;
if (!!maBitmap)
- {
bRet = maBitmap.Invert();
- if (bRet && (meTransparent == TransparentType::Color))
- maTransparentColor.Invert();
- }
-
return bRet;
}
@@ -392,22 +379,17 @@ bool BitmapEx::Rotate( Degree10 nAngle10, const Color& rFillColor )
if( bTransRotate )
{
- if( meTransparent == TransparentType::Color )
- bRet = maBitmap.Rotate( nAngle10, maTransparentColor );
- else
- {
- bRet = maBitmap.Rotate( nAngle10, COL_BLACK );
+ bRet = maBitmap.Rotate( nAngle10, COL_BLACK );
- if( meTransparent == TransparentType::NONE )
- {
- maMask = Bitmap(GetSizePixel(), 1);
- maMask.Erase( COL_BLACK );
- meTransparent = TransparentType::Bitmap;
- }
-
- if( bRet && !!maMask )
- maMask.Rotate( nAngle10, COL_WHITE );
+ if( meTransparent == TransparentType::NONE )
+ {
+ maMask = Bitmap(GetSizePixel(), 1);
+ maMask.Erase( COL_BLACK );
+ meTransparent = TransparentType::Bitmap;
}
+
+ if( bRet && !!maMask )
+ maMask.Rotate( nAngle10, COL_WHITE );
}
else
{
@@ -693,22 +675,6 @@ sal_uInt8 BitmapEx::GetAlpha(sal_Int32 nX, sal_Int32 nY) const
nAlpha = 255;
break;
}
- case TransparentType::Color:
- {
- Bitmap aTestBitmap(maBitmap);
- Bitmap::ScopedReadAccess pRead(aTestBitmap);
-
- if(pRead)
- {
- const BitmapColor aBmpColor = pRead->GetColor(nY, nX);
-
- // If color is not equal to TransparentColor, we are not transparent
- if (aBmpColor != maTransparentColor)
- nAlpha = 255;
-
- }
- break;
- }
case TransparentType::Bitmap:
{
if(!maMask.IsEmpty())
@@ -1336,7 +1302,6 @@ void BitmapEx::ReplaceTransparency(const Color& rColor)
maBitmap.Replace( GetMask(), rColor );
maMask = Bitmap();
maBitmapSize = maBitmap.GetSizePixel();
- maTransparentColor = Color();
meTransparent = TransparentType::NONE;
mbAlpha = false;
}
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index 61c4b3e1ecee..c81380adeeb0 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -486,10 +486,6 @@ void DrawAlphaBitmapAndAlphaGradient(BitmapEx & rBitmapEx, bool bFixedTransparen
{
aOldMask = rBitmapEx.GetMask();
}
- else if(TransparentType::Color == rBitmapEx.GetTransparentType())
- {
- aOldMask = rBitmapEx.GetBitmap().CreateMask(rBitmapEx.GetTransparentColor());
- }
{
AlphaScopedWriteAccess pOld(aOldMask);
@@ -611,14 +607,7 @@ void DrawAndClipBitmap(const Point& rPos, const Size& rSize, const BitmapEx& rBi
// need to blend in Mask quality (1Bit)
Bitmap aMask(aVDevMask.CreateMask(COL_WHITE));
- if ( rBitmap.GetTransparentColor() == COL_WHITE )
- {
- aMask.CombineSimple( rBitmap.GetMask(), BmpCombine::Or );
- }
- else
- {
- aMask.CombineSimple( rBitmap.GetMask(), BmpCombine::And );
- }
+ aMask.CombineSimple( rBitmap.GetMask(), BmpCombine::And );
aBmpEx = BitmapEx( rBitmap.GetBitmap(), aMask );
}
diff --git a/vcl/source/bitmap/dibtools.cxx b/vcl/source/bitmap/dibtools.cxx
index bb5bf5e94fb0..8609215ce46e 100644
--- a/vcl/source/bitmap/dibtools.cxx
+++ b/vcl/source/bitmap/dibtools.cxx
@@ -1766,14 +1766,13 @@ bool ReadDIBBitmapEx(
{
sal_uInt8 tmp = 0;
rIStm.ReadUChar( tmp );
- TransparentType transparent = static_cast<TransparentType>(tmp);
bRetval = !rIStm.GetError();
if(bRetval)
{
- switch (transparent)
+ switch (tmp)
{
- case TransparentType::Bitmap:
+ case static_cast<int>(TransparentType::Bitmap):
{
Bitmap aMask;
@@ -1800,7 +1799,7 @@ bool ReadDIBBitmapEx(
}
break;
}
- case TransparentType::Color:
+ case 1: // backwards compat for old option TransparentType::Color
{
Color aTransparentColor;
@@ -1887,12 +1886,6 @@ bool WriteDIBBitmapEx(
{
return ImplWriteDIB(rSource.maMask, rOStm, true, true);
}
- else if(TransparentType::Color == rSource.meTransparent)
- {
- tools::GenericTypeSerializer aSerializer(rOStm);
- aSerializer.writeColor(rSource.maTransparentColor);
- return true;
- }
}
return false;
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 01b973ba60af..8b1fa773eb27 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -338,7 +338,6 @@ OUString convertBitmapExTransparentType(TransparentType eType)
default:
case TransparentType::NONE: return "none";
case TransparentType::Bitmap: return "bitmap";
- case TransparentType::Color: return "color";
}
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index f7c6f827eba5..4cf1b8ac5e8f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8699,7 +8699,6 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
CHECK_RETURN( updateObject( rObject.m_nObject ) );
Bitmap aBitmap;
- Color aTransparentColor( COL_TRANSPARENT );
bool bWriteMask = false;
if( ! bMask )
{
@@ -8716,9 +8715,6 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
{
case TransparentType::NONE:
break;
- case TransparentType::Color:
- aTransparentColor = rObject.m_aBitmap.GetTransparentColor();
- break;
case TransparentType::Bitmap:
bWriteMask = true;
break;
@@ -8902,32 +8898,8 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
aLine.append( nMaskObject );
aLine.append( " 0 R\n" );
}
- else if( aTransparentColor != COL_TRANSPARENT )
- {
- aLine.append( "/Mask[ " );
- if( bTrueColor )
- {
- aLine.append( static_cast<sal_Int32>(aTransparentColor.GetRed()) );
- aLine.append( ' ' );
- aLine.append( static_cast<sal_Int32>(aTransparentColor.GetRed()) );
- aLine.append( ' ' );
- aLine.append( static_cast<sal_Int32>(aTransparentColor.GetGreen()) );
- aLine.append( ' ' );
- aLine.append( static_cast<sal_Int32>(aTransparentColor.GetGreen()) );
- aLine.append( ' ' );
- aLine.append( static_cast<sal_Int32>(aTransparentColor.GetBlue()) );
- aLine.append( ' ' );
- aLine.append( static_cast<sal_Int32>(aTransparentColor.GetBlue()) );
- }
- else
- {
- sal_Int32 nIndex = pAccess->GetBestPaletteIndex( BitmapColor( aTransparentColor ) );
- aLine.append( nIndex );
- }
- aLine.append( " ]\n" );
- }
}
- else if( m_bIsPDF_A1 && (bWriteMask || aTransparentColor != COL_TRANSPARENT) )
+ else if( m_bIsPDF_A1 && bWriteMask )
m_aErrors.insert( PDFWriter::Warning_Transparency_Omitted_PDFA );
aLine.append( ">>\n"
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 7d07be6fb31c..22b6b9c63d3b 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -471,12 +471,6 @@ void OutputDevice::SetBackground( const Wallpaper& rBackground )
case TransparentType::NONE:
mpAlphaVDev->SetBackground( Wallpaper( COL_BLACK ));
break;
- case TransparentType::Color:
- {
- AlphaMask mask( bitmap.GetBitmap().CreateMask( bitmap.GetTransparentColor()));
- mpAlphaVDev->SetBackground( Wallpaper( BitmapEx( bitmap.GetBitmap(), mask )));
- break;
- }
case TransparentType::Bitmap:
mpAlphaVDev->SetBackground( Wallpaper( BitmapEx( bitmap.GetMask())));
break;
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 741af25b3fc8..af6cae4c865a 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -273,9 +273,6 @@ static void CreateNetWmAppIcon( sal_uInt16 nIcon, NetWmIconData& netwm_icon )
mask = AlphaMask( icon.GetSizePixel(), &nTrans );
}
break;
- case TransparentType::Color:
- mask = AlphaMask( icon.CreateMask( aIcon.GetTransparentColor() ) );
- break;
case TransparentType::Bitmap:
mask = aIcon.GetAlpha();
break;
More information about the Libreoffice-commits
mailing list