remove some usages of BitmapColor outside of VCL

You get BitmapColor only from reading pixels from a Bitmap and
we want to avoid usage of Bitmap outside of VCL (and use BitmapEx
as the alternative which will eventually replace Bitmap).

Change-Id: Iddfa3ef739bfdd4dce5fb47fd9f67a5a36f3388b
Reviewed-on: https://gerrit.libreoffice.org/70447
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
Tomaž Vajngerl 2019-04-09 09:58:27 +09:00 committed by Tomaž Vajngerl
parent 13f449221e
commit 05a8749ee6
6 changed files with 12 additions and 30 deletions

View File

@ -296,9 +296,9 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, SvtValueSet*, void)
if(pGraphicObject)
{
BitmapColor aBack;
BitmapColor aFront;
bool bIs8x8(vcl::bitmap::isHistorical8x8(pGraphicObject->GetGraphic().GetBitmapEx(), aBack, aFront));
Color aBackColor;
Color aPixelColor;
bool bIs8x8(vcl::bitmap::isHistorical8x8(pGraphicObject->GetGraphic().GetBitmapEx(), aBackColor, aPixelColor));
m_xLbColor->SetNoSelection();
m_xLbBackgroundColor->SetNoSelection();
@ -313,9 +313,6 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, SvtValueSet*, void)
m_xCtlPixel->SetXBitmap(pGraphicObject->GetGraphic().GetBitmapEx());
Color aPixelColor = aFront.GetColor();
Color aBackColor = aBack.GetColor();
m_xLbColor->SelectEntry( aPixelColor );
m_xLbBackgroundColor->SelectEntry( aBackColor );

View File

@ -26,8 +26,6 @@
#include <array>
class SdrModel;
class BitmapColor;
// class XFillBitmapItem

View File

@ -125,7 +125,7 @@ VCL_DLLPUBLIC css::uno::Sequence< sal_Int8 > CanvasExtractBitmapData(BitmapEx co
// helper to construct historical 8x8 bitmaps with two colors
BitmapEx VCL_DLLPUBLIC createHistorical8x8FromArray(std::array<sal_uInt8,64> const & pArray, Color aColorPix, Color aColorBack);
bool VCL_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront);
bool VCL_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, Color& o_rBack, Color& o_rFront);
VCL_DLLPUBLIC bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult);

View File

@ -873,25 +873,12 @@ void SvxPixelCtl::LoseFocus()
void SvxPixelCtl::SetXBitmap(const BitmapEx& rBitmapEx)
{
BitmapColor aBack;
BitmapColor aFront;
if (vcl::bitmap::isHistorical8x8(rBitmapEx, aBack, aFront))
if (vcl::bitmap::isHistorical8x8(rBitmapEx, aBackgroundColor, aPixelColor))
{
Bitmap aBitmap(rBitmapEx.GetBitmap());
Bitmap::ScopedReadAccess pRead(aBitmap);
aBackgroundColor = aBack.GetColor();
aPixelColor = aFront.GetColor();
for(sal_uInt16 i(0); i < nSquares; i++)
for (sal_uInt16 i = 0; i < nSquares; i++)
{
const BitmapColor aColor(pRead->GetColor(i/8, i%8));
if (aColor == aBack)
maPixelData[i] = 0;
else
maPixelData[i] = 1;
Color aColor = rBitmapEx.GetPixelColor(i%8, i/8);
maPixelData[i] = (aColor == aBackgroundColor) ? 0 : 1;
}
}
}

View File

@ -164,7 +164,7 @@ bool XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
bool XFillBitmapItem::isPattern() const
{
BitmapColor aBack, aFront;
Color aBack, aFront;
return vcl::bitmap::isHistorical8x8(GetGraphicObject().GetGraphic().GetBitmapEx(), aBack, aFront);
}

View File

@ -1004,7 +1004,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
return BitmapEx(aBitmap);
}
bool isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront)
bool isHistorical8x8(const BitmapEx& rBitmapEx, Color& o_rBack, Color& o_rFront)
{
bool bRet(false);
@ -1026,8 +1026,8 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
// #i123564# background and foreground were exchanged; of course
// rPalette[0] is the background color
o_rFront = rPalette[1];
o_rBack = rPalette[0];
o_rFront = rPalette[1].GetColor();
o_rBack = rPalette[0].GetColor();
bRet = true;
}