Kaydet (Commit) 05a8749e authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

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: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 13f44922
...@@ -296,9 +296,9 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, SvtValueSet*, void) ...@@ -296,9 +296,9 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, SvtValueSet*, void)
if(pGraphicObject) if(pGraphicObject)
{ {
BitmapColor aBack; Color aBackColor;
BitmapColor aFront; Color aPixelColor;
bool bIs8x8(vcl::bitmap::isHistorical8x8(pGraphicObject->GetGraphic().GetBitmapEx(), aBack, aFront)); bool bIs8x8(vcl::bitmap::isHistorical8x8(pGraphicObject->GetGraphic().GetBitmapEx(), aBackColor, aPixelColor));
m_xLbColor->SetNoSelection(); m_xLbColor->SetNoSelection();
m_xLbBackgroundColor->SetNoSelection(); m_xLbBackgroundColor->SetNoSelection();
...@@ -313,9 +313,6 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, SvtValueSet*, void) ...@@ -313,9 +313,6 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, SvtValueSet*, void)
m_xCtlPixel->SetXBitmap(pGraphicObject->GetGraphic().GetBitmapEx()); m_xCtlPixel->SetXBitmap(pGraphicObject->GetGraphic().GetBitmapEx());
Color aPixelColor = aFront.GetColor();
Color aBackColor = aBack.GetColor();
m_xLbColor->SelectEntry( aPixelColor ); m_xLbColor->SelectEntry( aPixelColor );
m_xLbBackgroundColor->SelectEntry( aBackColor ); m_xLbBackgroundColor->SelectEntry( aBackColor );
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <array> #include <array>
class SdrModel; class SdrModel;
class BitmapColor;
// class XFillBitmapItem // class XFillBitmapItem
......
...@@ -125,7 +125,7 @@ VCL_DLLPUBLIC css::uno::Sequence< sal_Int8 > CanvasExtractBitmapData(BitmapEx co ...@@ -125,7 +125,7 @@ VCL_DLLPUBLIC css::uno::Sequence< sal_Int8 > CanvasExtractBitmapData(BitmapEx co
// helper to construct historical 8x8 bitmaps with two colors // helper to construct historical 8x8 bitmaps with two colors
BitmapEx VCL_DLLPUBLIC createHistorical8x8FromArray(std::array<sal_uInt8,64> const & pArray, Color aColorPix, Color aColorBack); 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); VCL_DLLPUBLIC bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult);
......
...@@ -873,25 +873,12 @@ void SvxPixelCtl::LoseFocus() ...@@ -873,25 +873,12 @@ void SvxPixelCtl::LoseFocus()
void SvxPixelCtl::SetXBitmap(const BitmapEx& rBitmapEx) void SvxPixelCtl::SetXBitmap(const BitmapEx& rBitmapEx)
{ {
BitmapColor aBack; if (vcl::bitmap::isHistorical8x8(rBitmapEx, aBackgroundColor, aPixelColor))
BitmapColor aFront;
if (vcl::bitmap::isHistorical8x8(rBitmapEx, aBack, aFront))
{ {
Bitmap aBitmap(rBitmapEx.GetBitmap()); for (sal_uInt16 i = 0; i < nSquares; i++)
Bitmap::ScopedReadAccess pRead(aBitmap);
aBackgroundColor = aBack.GetColor();
aPixelColor = aFront.GetColor();
for(sal_uInt16 i(0); i < nSquares; i++)
{ {
const BitmapColor aColor(pRead->GetColor(i/8, i%8)); Color aColor = rBitmapEx.GetPixelColor(i%8, i/8);
maPixelData[i] = (aColor == aBackgroundColor) ? 0 : 1;
if (aColor == aBack)
maPixelData[i] = 0;
else
maPixelData[i] = 1;
} }
} }
} }
......
...@@ -164,7 +164,7 @@ bool XFillBitmapItem::operator==(const SfxPoolItem& rItem) const ...@@ -164,7 +164,7 @@ bool XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
bool XFillBitmapItem::isPattern() const bool XFillBitmapItem::isPattern() const
{ {
BitmapColor aBack, aFront; Color aBack, aFront;
return vcl::bitmap::isHistorical8x8(GetGraphicObject().GetGraphic().GetBitmapEx(), aBack, aFront); return vcl::bitmap::isHistorical8x8(GetGraphicObject().GetGraphic().GetBitmapEx(), aBack, aFront);
} }
......
...@@ -1004,7 +1004,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un ...@@ -1004,7 +1004,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
return BitmapEx(aBitmap); 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); bool bRet(false);
...@@ -1026,8 +1026,8 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un ...@@ -1026,8 +1026,8 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
// #i123564# background and foreground were exchanged; of course // #i123564# background and foreground were exchanged; of course
// rPalette[0] is the background color // rPalette[0] is the background color
o_rFront = rPalette[1]; o_rFront = rPalette[1].GetColor();
o_rBack = rPalette[0]; o_rBack = rPalette[0].GetColor();
bRet = true; bRet = true;
} }
......
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