tdf#115297: 1bit images displaying fixed (again)
Previous fix25cd843664
like any other before it have some regressions, so reverted. The root of most problems: fix for tdf#104141d148340bab
, where mask drawing was implemented in bitmap drawing code. So instead of guessing for type of bitmap, mask is drawn with DrawBitmapEx resolving all known problems (tdf#114726, tdf#115297, tdf#113918 and tdf#104141). Change-Id: Ie00f7552d667e237b3c0f9505ee09cb51e85c43c Reviewed-on: https://gerrit.libreoffice.org/50828 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
1008cd6b0a
commit
ae11dec720
@@ -271,7 +271,8 @@ namespace drawinglayer
|
||||
}
|
||||
else
|
||||
{
|
||||
maVirtualDeviceMask->DrawBitmap(rAnimBitmap.aPosPix, aMask);
|
||||
BitmapEx aExpandVisibilityMask = BitmapEx(aMask, aMask);
|
||||
maVirtualDeviceMask->DrawBitmapEx(rAnimBitmap.aPosPix, aExpandVisibilityMask);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -279,7 +280,8 @@ namespace drawinglayer
|
||||
case Disposal::Previous:
|
||||
{
|
||||
maVirtualDevice->DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx);
|
||||
maVirtualDeviceMask->DrawBitmap(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx.GetMask());
|
||||
BitmapEx aExpandVisibilityMask = BitmapEx(rAnimBitmap.aBmpEx.GetMask(), rAnimBitmap.aBmpEx.GetMask());
|
||||
maVirtualDeviceMask->DrawBitmapEx(rAnimBitmap.aPosPix, aExpandVisibilityMask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -1200,39 +1200,8 @@ void SvpSalGraphics::copyBits( const SalTwoRect& rTR,
|
||||
cairo_surface_destroy(pCopy);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
bool isBlackWhite(const SalBitmap& rBitmap)
|
||||
{
|
||||
const SvpSalBitmap& rSrcBmp = static_cast<const SvpSalBitmap&>(rBitmap);
|
||||
const BitmapBuffer * pSourceBuffer = rSrcBmp.GetBuffer();
|
||||
const BitmapPalette & rPalette = pSourceBuffer->maPalette;
|
||||
|
||||
return (
|
||||
rPalette.GetEntryCount() < 2 ||
|
||||
|
||||
(rPalette.GetEntryCount() == 2 &&
|
||||
rPalette[0] == COL_BLACK &&
|
||||
rPalette[1] == COL_WHITE ) ||
|
||||
|
||||
(rPalette.GetEntryCount() == 2 &&
|
||||
rPalette[1] == COL_BLACK &&
|
||||
rPalette[0] == COL_WHITE )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void SvpSalGraphics::drawBitmap(const SalTwoRect& rTR, const SalBitmap& rSourceBitmap)
|
||||
{
|
||||
if (rSourceBitmap.GetBitCount() == 1 && isBlackWhite(rSourceBitmap))
|
||||
{
|
||||
// This way we draw only monochrome b/w bitmaps
|
||||
MaskHelper aMask(rSourceBitmap);
|
||||
cairo_surface_t* source = aMask.getMask();
|
||||
copySource(rTR, source);
|
||||
return;
|
||||
}
|
||||
|
||||
SourceHelper aSurface(rSourceBitmap);
|
||||
cairo_surface_t* source = aSurface.getSurface();
|
||||
copySource(rTR, source);
|
||||
|
Reference in New Issue
Block a user