Kaydet (Commit) 11fc3b52 authored tarafından Noel Grandin's avatar Noel Grandin

remove unused BmpDitherFlags enum values

Change-Id: I09a0eb661b66da78d8b3809124930bc761960712
Reviewed-on: https://gerrit.libreoffice.org/64064
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 190de05d
...@@ -590,10 +590,6 @@ include/unotools/fontdefs.hxx:71 ...@@ -590,10 +590,6 @@ include/unotools/fontdefs.hxx:71
enum DefaultFontType LATIN_FIXED enum DefaultFontType LATIN_FIXED
include/unotools/fontdefs.hxx:81 include/unotools/fontdefs.hxx:81
enum DefaultFontType CTL_DISPLAY enum DefaultFontType CTL_DISPLAY
include/vcl/bitmap.hxx:65
enum BmpDitherFlags Matrix
include/vcl/bitmap.hxx:67
enum BmpDitherFlags Floyd16
include/vcl/errinf.hxx:84 include/vcl/errinf.hxx:84
enum DialogMask ButtonsYesNo enum DialogMask ButtonsYesNo
include/vcl/errinf.hxx:87 include/vcl/errinf.hxx:87
......
...@@ -62,13 +62,11 @@ enum class BmpScaleFlag ...@@ -62,13 +62,11 @@ enum class BmpScaleFlag
enum class BmpDitherFlags enum class BmpDitherFlags
{ {
NONE = 0x0000, NONE = 0x0000,
Matrix = 0x0001, Floyd = 0x0001,
Floyd = 0x0002,
Floyd16 = 0x0004,
}; };
namespace o3tl namespace o3tl
{ {
template<> struct typed_flags<BmpDitherFlags> : is_typed_flags<BmpDitherFlags, 0x07> {}; template<> struct typed_flags<BmpDitherFlags> : is_typed_flags<BmpDitherFlags, 0x01> {};
} }
#define BMP_COL_TRANS Color( 252, 3, 251 ) #define BMP_COL_TRANS Color( 252, 3, 251 )
...@@ -535,9 +533,7 @@ public: ...@@ -535,9 +533,7 @@ public:
SAL_DLLPRIVATE void ImplSetSalBitmap( const std::shared_ptr<SalBitmap>& xImpBmp ); SAL_DLLPRIVATE void ImplSetSalBitmap( const std::shared_ptr<SalBitmap>& xImpBmp );
SAL_DLLPRIVATE bool ImplMakeGreyscales( sal_uInt16 nGreyscales ); SAL_DLLPRIVATE bool ImplMakeGreyscales( sal_uInt16 nGreyscales );
SAL_DLLPRIVATE bool ImplDitherMatrix();
SAL_DLLPRIVATE bool ImplDitherFloyd(); SAL_DLLPRIVATE bool ImplDitherFloyd();
SAL_DLLPRIVATE bool ImplDitherFloyd16();
public: public:
......
...@@ -895,84 +895,8 @@ bool Bitmap::Dither( BmpDitherFlags nDitherFlags ) ...@@ -895,84 +895,8 @@ bool Bitmap::Dither( BmpDitherFlags nDitherFlags )
if( aSizePix.Width() == 1 || aSizePix.Height() == 1 ) if( aSizePix.Width() == 1 || aSizePix.Height() == 1 )
bRet = true; bRet = true;
else if( nDitherFlags & BmpDitherFlags::Matrix )
bRet = ImplDitherMatrix();
else if( nDitherFlags & BmpDitherFlags::Floyd ) else if( nDitherFlags & BmpDitherFlags::Floyd )
bRet = ImplDitherFloyd(); bRet = ImplDitherFloyd();
else if( ( nDitherFlags & BmpDitherFlags::Floyd16 ) && ( GetBitCount() == 24 ) )
bRet = ImplDitherFloyd16();
return bRet;
}
bool Bitmap::ImplDitherMatrix()
{
ScopedReadAccess pReadAcc(*this);
Bitmap aNewBmp( GetSizePixel(), 8 );
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
bool bRet = false;
if( pReadAcc && pWriteAcc )
{
const sal_uLong nWidth = pReadAcc->Width();
const sal_uLong nHeight = pReadAcc->Height();
BitmapColor aIndex( sal_uInt8(0) );
if( pReadAcc->HasPalette() )
{
for( sal_uLong nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( sal_uLong nX = 0, nModY = ( nY & 0x0FUL ) << 4; nX < nWidth; nX++ )
{
const BitmapColor aCol( pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nX ) ) );
const sal_uLong nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ];
const sal_uLong nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16;
const sal_uLong nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16;
const sal_uLong nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16;
aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) );
pWriteAcc->SetPixelOnData( pScanline, nX, aIndex );
}
}
}
else
{
for( sal_uLong nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( sal_uLong nX = 0, nModY = ( nY & 0x0FUL ) << 4; nX < nWidth; nX++ )
{
const BitmapColor aCol( pReadAcc->GetPixelFromData( pScanlineRead, nX ) );
const sal_uLong nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ];
const sal_uLong nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16;
const sal_uLong nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16;
const sal_uLong nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16;
aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) );
pWriteAcc->SetPixelOnData( pScanline, nX, aIndex );
}
}
}
bRet = true;
}
pReadAcc.reset();
pWriteAcc.reset();
if( bRet )
{
const MapMode aMap( maPrefMapMode );
const Size aSize( maPrefSize );
*this = aNewBmp;
maPrefMapMode = aMap;
maPrefSize = aSize;
}
return bRet; return bRet;
} }
...@@ -1118,104 +1042,6 @@ bool Bitmap::ImplDitherFloyd() ...@@ -1118,104 +1042,6 @@ bool Bitmap::ImplDitherFloyd()
return bRet; return bRet;
} }
bool Bitmap::ImplDitherFloyd16()
{
ScopedReadAccess pReadAcc(*this);
Bitmap aNewBmp( GetSizePixel(), 24 );
BitmapScopedWriteAccess pWriteAcc(aNewBmp);
bool bRet = false;
if( pReadAcc && pWriteAcc )
{
const long nWidth = pWriteAcc->Width();
const long nWidth1 = nWidth - 1;
const long nHeight = pWriteAcc->Height();
BitmapColor aColor;
BitmapColor aBestCol;
ImpErrorQuad aErrQuad;
std::unique_ptr<ImpErrorQuad[]> pErrQuad1(new ImpErrorQuad[ nWidth ]);
std::unique_ptr<ImpErrorQuad[]> pErrQuad2(new ImpErrorQuad[ nWidth ]);
ImpErrorQuad* pQLine1 = pErrQuad1.get();
ImpErrorQuad* pQLine2 = nullptr;
long nYTmp = 0;
bool bQ1 = true;
for( long nY = 0; nY < std::min( nHeight, 2L ); nY++, nYTmp++ )
{
pQLine2 = !nY ? pErrQuad1.get() : pErrQuad2.get();
Scanline pScanlineRead = pReadAcc->GetScanline(nYTmp);
for( long nX = 0; nX < nWidth; nX++ )
pQLine2[ nX ] = pReadAcc->GetPixelFromData( pScanlineRead, nX );
}
assert(pQLine2 || nHeight == 0);
for( long nY = 0; nY < nHeight; nY++, nYTmp++ )
{
// First RowPixel
aBestCol = pQLine1[ 0 ].ImplGetColor();
aBestCol.SetRed( ( aBestCol.GetRed() & 248 ) | 7 );
aBestCol.SetGreen( ( aBestCol.GetGreen() & 248 ) | 7 );
aBestCol.SetBlue( ( aBestCol.GetBlue() & 248 ) | 7 );
Scanline pScanline = pWriteAcc->GetScanline(nY);
pWriteAcc->SetPixelOnData( pScanline, 0, aBestCol );
long nX;
for( nX = 1; nX < nWidth1; nX++ )
{
aColor = pQLine1[ nX ].ImplGetColor();
aBestCol.SetRed( ( aColor.GetRed() & 248 ) | 7 );
aBestCol.SetGreen( ( aColor.GetGreen() & 248 ) | 7 );
aBestCol.SetBlue( ( aColor.GetBlue() & 248 ) | 7 );
aErrQuad = ( ImpErrorQuad( aColor ) -= aBestCol );
pQLine1[ ++nX ].ImplAddColorError7( aErrQuad );
pQLine2[ nX-- ].ImplAddColorError1( aErrQuad );
pQLine2[ nX-- ].ImplAddColorError5( aErrQuad );
pQLine2[ nX++ ].ImplAddColorError3( aErrQuad );
pWriteAcc->SetPixelOnData( pScanline, nX, aBestCol );
}
// Last RowPixel
aBestCol = pQLine1[ nWidth1 ].ImplGetColor();
aBestCol.SetRed( ( aBestCol.GetRed() & 248 ) | 7 );
aBestCol.SetGreen( ( aBestCol.GetGreen() & 248 ) | 7 );
aBestCol.SetBlue( ( aBestCol.GetBlue() & 248 ) | 7 );
pWriteAcc->SetPixelOnData( pScanline, nX, aBestCol );
// Refill/copy row buffer
pQLine1 = pQLine2;
bQ1 = !bQ1;
pQLine2 = bQ1 ? pErrQuad2.get() : pErrQuad1.get();
if( nYTmp < nHeight )
{
Scanline pScanlineRead = pReadAcc->GetScanline(nYTmp);
for( nX = 0; nX < nWidth; nX++ )
pQLine2[ nX ] = pReadAcc->GetPixelFromData( pScanlineRead, nX );
}
}
bRet = true;
}
pReadAcc.reset();
pWriteAcc.reset();
if( bRet )
{
const MapMode aMap( maPrefMapMode );
const Size aSize( maPrefSize );
*this = aNewBmp;
maPrefMapMode = aMap;
maPrefSize = aSize;
}
return bRet;
}
void Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, const Link<long,void>* pProgress ) void Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, const Link<long,void>* pProgress )
{ {
ImplVectorizer::ImplVectorize( *this, rMtf, cReduce, pProgress ); ImplVectorizer::ImplVectorize( *this, rMtf, cReduce, pProgress );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment