[Libreoffice-commits] .: 2 commits - unusedcode.easy vcl/inc vcl/source
Michael Meeks
michael at kemper.freedesktop.org
Thu Nov 3 04:32:27 PDT 2011
unusedcode.easy | 46 ----------------------------------------------
vcl/inc/vcl/salbtype.hxx | 17 +++++++++--------
vcl/source/gdi/bitmap.cxx | 41 ++++++++++-------------------------------
3 files changed, 19 insertions(+), 85 deletions(-)
New commits:
commit b9474a8cacd02bcb7b2d3b48e20eed266923a6e2
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu Nov 3 11:32:23 2011 +0000
Cleanup inline IsGreyPalette implementation for mac platforms.
diff --git a/vcl/inc/vcl/salbtype.hxx b/vcl/inc/vcl/salbtype.hxx
index 111fdec..3e8c4c9 100644
--- a/vcl/inc/vcl/salbtype.hxx
+++ b/vcl/inc/vcl/salbtype.hxx
@@ -180,8 +180,8 @@ class VCL_DLLPUBLIC BitmapPalette
private:
BitmapColor* mpBitmapColor;
- sal_uInt16 mnCount;
-
+ sal_uInt16 mnCount;
+ bool mbIsGrey;
public:
@@ -196,18 +196,19 @@ public:
inline ~BitmapPalette();
inline BitmapPalette& operator=( const BitmapPalette& rBitmapPalette );
- inline sal_Bool operator==( const BitmapPalette& rBitmapPalette ) const;
- inline sal_Bool operator!=( const BitmapPalette& rBitmapPalette ) const;
- inline sal_Bool operator!();
+ inline sal_Bool operator==( const BitmapPalette& rBitmapPalette ) const;
+ inline sal_Bool operator!=( const BitmapPalette& rBitmapPalette ) const;
+ inline sal_Bool operator!();
- inline sal_uInt16 GetEntryCount() const;
+ inline sal_uInt16 GetEntryCount() const;
inline void SetEntryCount( sal_uInt16 nCount );
inline const BitmapColor& operator[]( sal_uInt16 nIndex ) const;
inline BitmapColor& operator[]( sal_uInt16 nIndex );
- inline sal_uInt16 GetBestIndex( const BitmapColor& rCol ) const;
- bool IsGreyPalette() const;
+ inline sal_uInt16 GetBestIndex( const BitmapColor& rCol ) const;
+ bool IsGreyPalette() const { return mbIsGrey; }
+ void SetGreyPalette( bool bGrey ) { mbIsGrey = bGrey; }
};
// ---------------
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 318ba68..4df609a 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -177,6 +177,7 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
aGreyPalette2.SetEntryCount( 2 );
aGreyPalette2[ 0 ] = BitmapColor( 0, 0, 0 );
aGreyPalette2[ 1 ] = BitmapColor( 255, 255, 255 );
+ aGreyPalette2.SetGreyPalette( true );
}
return aGreyPalette2;
@@ -190,6 +191,7 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
aGreyPalette4[ 1 ] = BitmapColor( 85, 85, 85 );
aGreyPalette4[ 2 ] = BitmapColor( 170, 170, 170 );
aGreyPalette4[ 3 ] = BitmapColor( 255, 255, 255 );
+ aGreyPalette4.SetGreyPalette( true );
}
return aGreyPalette4;
@@ -204,6 +206,7 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
for( sal_uInt16 i = 0; i < 16; i++, cGrey = sal::static_int_cast<sal_uInt8>(cGrey + cGreyInc) )
aGreyPalette16[ i ] = BitmapColor( cGrey, cGrey, cGrey );
+ aGreyPalette16.SetGreyPalette( true );
}
return aGreyPalette16;
@@ -216,6 +219,7 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
for( sal_uInt16 i = 0; i < 256; i++ )
aGreyPalette256[ i ] = BitmapColor( (sal_uInt8) i, (sal_uInt8) i, (sal_uInt8) i );
+ aGreyPalette256.SetGreyPalette( true );
}
return aGreyPalette256;
@@ -224,7 +228,7 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
else
{
OSL_FAIL( "Bitmap::GetGreyPalette: invalid entry count (2/4/16/256 allowed)" );
- return aGreyPalette2;
+ return GetGreyPalette( 2 );
}
}
@@ -301,12 +305,9 @@ sal_Bool Bitmap::HasGreyPalette() const
{
const BitmapColor& rCol0( pRAcc->GetPaletteColor( 0 ) );
const BitmapColor& rCol1( pRAcc->GetPaletteColor( 1 ) );
- if( rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() &&
- rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue() )
- {
- bRet = sal_True;
- }
- ( (Bitmap*) this )->ReleaseAccess( pRAcc );
+ bRet = rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() &&
+ rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue();
+ ( (Bitmap*) this )->ReleaseAccess( pRAcc );
}
else
bRet = sal_True;
@@ -317,10 +318,8 @@ sal_Bool Bitmap::HasGreyPalette() const
if( pRAcc )
{
- if( pRAcc->HasPalette() && ( (BitmapPalette&) pRAcc->GetPalette() == GetGreyPalette( 1 << nBitCount ) ) )
- bRet = sal_True;
-
- ( (Bitmap*) this )->ReleaseAccess( pRAcc );
+ bRet = pRAcc->HasPalette() && pRAcc->GetPalette().IsGreyPalette();
+ ( (Bitmap*) this )->ReleaseAccess( pRAcc );
}
}
commit 4029a580f725380c395ff9ebc7ed181f376b0a96
Author: Emanuele Fia <emanuele.fia at laptop>
Date: Wed Nov 2 18:54:01 2011 +0100
Removed IsGreyPalette
diff --git a/unusedcode.easy b/unusedcode.easy
index 9a1601d..f518828 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -4,57 +4,11 @@ AtomDocument::AtomDocument(AtomPubSession*, std::basic_string<char, std::char_tr
AtomFolder::AtomFolder(AtomPubSession*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)
AtomPubSession::getCollectionUrl(Collection::Type)
AtomPubSession::~AtomPubSession()
-BitmapPalette::IsGreyPalette() const
BufferNode::childAt(int) const
ByteString::Assign(char const*, unsigned short)
ByteString::Assign(char)
CAT::Inverse() const
CAT::makeChromaticAdaptationTag() const
-CIccCmm::FromInternalEncoding(icColorSpaceSignature, unsigned char*, float const*)
-CIccCmm::FromInternalEncoding(icColorSpaceSignature, unsigned short*, float const*)
-CIccCmm::GetFloatColorEncoding(char const*)
-CIccCmm::GetFloatColorEncoding(icFloatColorEncoding)
-CIccCmm::IsInGamut(float*)
-CIccCmm::ToInternalEncoding(icColorSpaceSignature, float*, unsigned char const*)
-CIccCmm::ToInternalEncoding(icColorSpaceSignature, float*, unsigned short const*)
-CIccFormulaCurveSegment::SetFunction(unsigned short, unsigned char, float*)
-CIccIO::ReadLine(void*, int)
-CIccInfo::GetSpotShapeName(icSpotShape)
-CIccMBB::NewCLUT(unsigned char*, unsigned char)
-CIccMemIO::Alloc(unsigned int, bool)
-CIccMpeCLUT::SetCLUT(CIccCLUT*)
-CIccMpeCreator::DoGetElementSigName(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, icElemTypeSignature)
-CIccMpeCurveSet::SetCurve(int, CIccCurveSetCurve*)
-CIccMruCmm::Attach(CIccCmm*, unsigned char)
-CIccNamedColorCmm::CIccNamedColorCmm(icColorSpaceSignature, icColorSpaceSignature, bool)
-CIccNamedColorCmm::SetLastXformDest(icColorSpaceSignature)
-CIccProfile::DeleteTag(unsigned int)
-CIccProfile::GetSpaceSamples() const
-CIccProfileIdDesc::CIccProfileIdDesc(CIccProfile&)
-CIccProfileIdDesc::CIccProfileIdDesc(icProfileID, CIccTagMultiLocalizedUnicode)
-CIccSegmentedCurve::Insert(CIccCurveSegment*)
-CIccTagCurve::SetGamma(float)
-CIccTagFixedNum<int, (icTagTypeSignature)1936077618>::GetSize() const
-CIccTagFixedNum<unsigned int, (icTagTypeSignature)1969632050>::GetSize() const
-CIccTagMultiLocalizedUnicode::SetText(unsigned short const*, unsigned short, unsigned short)
-CIccTagMultiProcessElement::GetElement(int)
-CIccTagNamedColor2::FindRootColor(char const*)
-CIccTagNamedColor2::Lab4ToLab2(float*, float const*)
-CIccTagNamedColor2::NegClip(float)
-CIccTagNum<unsigned char, (icTagTypeSignature)1969827896>::GetSize() const
-CIccTagNum<unsigned int, (icTagTypeSignature)1969828658>::GetSize() const
-CIccTagNum<unsigned long, (icTagTypeSignature)1969829428>::GetSize() const
-CIccTagNum<unsigned short, (icTagTypeSignature)1969828150>::GetSize() const
-CIccTagProfileSequenceId::AddProfileDescription(CIccProfileIdDesc const&)
-CIccTagProfileSequenceId::GetFirst()
-CIccTagProfileSequenceId::GetLast()
-CIccTagProfileSequenceId::ParseMem(unsigned char*, unsigned int)
-CIccTagResponseCurveSet16::GetFirstCurves()
-CIccTagResponseCurveSet16::GetNextCurves()
-CIccTagResponseCurveSet16::NewResponseCurves(icMeasurementUnitSig)
-CIccTagResponseCurveSet16::SetNumChannels(unsigned short)
-CIccXform::Create(CIccProfile&, bool, icRenderingIntent, icXformInterp, icXformLutType, bool)
-CIccXformMpe::Create(CIccProfile*, bool, icRenderingIntent, icXformInterp, icXformLutType)
CLUT::Iterate(IIccCLUTExec*)
CLUT::adaptedXYZToMeasuredXYZ(float*, float const*, float const*, float, CAT const*)
CLUT::makeAToBxTag(unsigned int, float const*, float const*, float const*, CAT const*, float, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float const*, bool)
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 417ebf7..318ba68 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -230,26 +230,6 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
// ------------------------------------------------------------------
-bool BitmapPalette::IsGreyPalette() const
-{
- // TODO: add an IsGreyPalette flag to BitmapPalette
- // TODO: unless this causes problems binary compatibility
- const int nEntryCount = GetEntryCount();
- if( !nEntryCount ) // NOTE: an empty palette means 1:1 mapping
- return true;
- // see above: only certain entry values will result in a valid call to GetGreyPalette
- if( nEntryCount == 2 || nEntryCount == 4 || nEntryCount == 16 || nEntryCount == 256 )
- {
- const BitmapPalette& rGreyPalette = Bitmap::GetGreyPalette( nEntryCount );
- if( rGreyPalette == *this )
- return true;
- }
- // TODO: is it worth to compare the entries?
- return false;
-}
-
-// ------------------------------------------------------------------
-
Bitmap& Bitmap::operator=( const Bitmap& rBitmap )
{
maPrefSize = rBitmap.maPrefSize;
More information about the Libreoffice-commits
mailing list