remove some dead code in DrawDeviceBitmapEx
ever since we added the call to DrawDeviceAlphaBitmap Change-Id: Ia329e355839ffc27c88135513898e7ea460242fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173772 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
This commit is contained in:
parent
4605d36e7e
commit
3194b9b42e
1 changed files with 6 additions and 92 deletions
|
@ -190,100 +190,14 @@ void OutputDevice::DrawDeviceBitmapEx( const Point& rDestPt, const Size& rDestSi
|
|||
rBitmapEx.Mirror(nMirrFlags);
|
||||
|
||||
const SalBitmap* pSalSrcBmp = rBitmapEx.ImplGetBitmapSalBitmap().get();
|
||||
std::shared_ptr<SalBitmap> xMaskBmp = rBitmapEx.maAlphaMask.GetBitmap().ImplGetSalBitmap();
|
||||
assert(!rBitmapEx.maAlphaMask.GetBitmap().ImplGetSalBitmap() && "I removed some code here that will need to be restored");
|
||||
|
||||
if (xMaskBmp)
|
||||
mpGraphics->DrawBitmap(aPosAry, *pSalSrcBmp, *this);
|
||||
|
||||
if (mpAlphaVDev)
|
||||
{
|
||||
if (mpGraphics->DrawAlphaBitmap(aPosAry, *pSalSrcBmp, *xMaskBmp, *this))
|
||||
{
|
||||
// tried to paint as alpha directly. If this worked, we are done (except
|
||||
// alpha, see below)
|
||||
}
|
||||
else
|
||||
{
|
||||
// #4919452# reduce operation area to bounds of
|
||||
// cliprect. since masked transparency involves
|
||||
// creation of a large vdev and copying the screen
|
||||
// content into that (slooow read from framebuffer),
|
||||
// that should considerably increase performance for
|
||||
// large bitmaps and small clippings.
|
||||
|
||||
// Note that this optimization is a workaround for a
|
||||
// Writer peculiarity, namely, to decompose background
|
||||
// graphics into myriads of disjunct, tiny
|
||||
// rectangles. That otherwise kills us here, since for
|
||||
// transparent output, SAL always prepares the whole
|
||||
// bitmap, if aPosAry contains the whole bitmap (and
|
||||
// it's _not_ to blame for that).
|
||||
|
||||
// Note the call to ImplPixelToDevicePixel(), since
|
||||
// aPosAry already contains the mnOutOff-offsets, they
|
||||
// also have to be applied to the region
|
||||
tools::Rectangle aClipRegionBounds( ImplPixelToDevicePixel(maRegion).GetBoundRect() );
|
||||
|
||||
// TODO: Also respect scaling (that's a bit tricky,
|
||||
// since the source points have to move fractional
|
||||
// amounts (which is not possible, thus has to be
|
||||
// emulated by increases copy area)
|
||||
// const double nScaleX( aPosAry.mnDestWidth / aPosAry.mnSrcWidth );
|
||||
// const double nScaleY( aPosAry.mnDestHeight / aPosAry.mnSrcHeight );
|
||||
|
||||
// for now, only identity scales allowed
|
||||
if (!aClipRegionBounds.IsEmpty() &&
|
||||
aPosAry.mnDestWidth == aPosAry.mnSrcWidth &&
|
||||
aPosAry.mnDestHeight == aPosAry.mnSrcHeight)
|
||||
{
|
||||
// now intersect dest rect with clip region
|
||||
aClipRegionBounds.Intersection(tools::Rectangle(aPosAry.mnDestX,
|
||||
aPosAry.mnDestY,
|
||||
aPosAry.mnDestX + aPosAry.mnDestWidth - 1,
|
||||
aPosAry.mnDestY + aPosAry.mnDestHeight - 1));
|
||||
|
||||
// Note: I could theoretically optimize away the
|
||||
// DrawBitmap below, if the region is empty
|
||||
// here. Unfortunately, cannot rule out that
|
||||
// somebody relies on the side effects.
|
||||
if (!aClipRegionBounds.IsEmpty())
|
||||
{
|
||||
aPosAry.mnSrcX += aClipRegionBounds.Left() - aPosAry.mnDestX;
|
||||
aPosAry.mnSrcY += aClipRegionBounds.Top() - aPosAry.mnDestY;
|
||||
aPosAry.mnSrcWidth = aClipRegionBounds.GetWidth();
|
||||
aPosAry.mnSrcHeight = aClipRegionBounds.GetHeight();
|
||||
|
||||
aPosAry.mnDestX = aClipRegionBounds.Left();
|
||||
aPosAry.mnDestY = aClipRegionBounds.Top();
|
||||
aPosAry.mnDestWidth = aClipRegionBounds.GetWidth();
|
||||
aPosAry.mnDestHeight = aClipRegionBounds.GetHeight();
|
||||
}
|
||||
}
|
||||
|
||||
mpGraphics->DrawBitmap(aPosAry, *pSalSrcBmp, *xMaskBmp, *this);
|
||||
}
|
||||
|
||||
// #110958# Paint mask to alpha channel. Luckily, the
|
||||
// black and white representation of the mask maps to
|
||||
// the alpha channel
|
||||
|
||||
// #i25167# Restrict mask painting to _opaque_ areas
|
||||
// of the mask, otherwise we spoil areas where no
|
||||
// bitmap content was ever visible. Interestingly
|
||||
// enough, this can be achieved by taking the mask as
|
||||
// the transparency mask of itself
|
||||
if (mpAlphaVDev)
|
||||
mpAlphaVDev->DrawBitmapEx(rDestPt,
|
||||
rDestSize,
|
||||
BitmapEx(rBitmapEx.GetAlphaMask().GetBitmap(),
|
||||
rBitmapEx.GetAlphaMask()));
|
||||
}
|
||||
else
|
||||
{
|
||||
mpGraphics->DrawBitmap(aPosAry, *pSalSrcBmp, *this);
|
||||
|
||||
if (mpAlphaVDev)
|
||||
{
|
||||
// #i32109#: Make bitmap area opaque
|
||||
mpAlphaVDev->ImplFillOpaqueRectangle( tools::Rectangle(rDestPt, rDestSize) );
|
||||
}
|
||||
// #i32109#: Make bitmap area opaque
|
||||
mpAlphaVDev->ImplFillOpaqueRectangle( tools::Rectangle(rDestPt, rDestSize) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue