[Libreoffice-commits] core.git: vcl/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 23 05:07:11 UTC 2020
vcl/source/outdev/bitmap.cxx | 15 +++++++++++++--
vcl/source/outdev/polygon.cxx | 3 +++
vcl/source/outdev/polyline.cxx | 9 ++++++++-
vcl/source/outdev/transparent.cxx | 20 ++++++++++++++++++--
4 files changed, 42 insertions(+), 5 deletions(-)
New commits:
commit 9c621ee8ea41a1c53bfeca49827290826785973e
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu May 14 14:42:24 2020 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat May 23 07:06:35 2020 +0200
Add missing mpAlphaVDev handling
... a pre-requisite for re-implementing soft edge to use mpAlphaVDev
necessary to keep objects' transparency when applying the effect
Change-Id: I56f5c0f2468c32843abbc1f14e06861a22f6919d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94662
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 44d28e15229a..401ebd6a77f2 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1051,17 +1051,25 @@ bool OutputDevice::DrawTransformBitmapExDirect(
const basegfx::B2DPoint aTopY(aFullTransform * basegfx::B2DPoint(0.0, 1.0));
SalBitmap* pSalSrcBmp = rBitmapEx.GetBitmap().ImplGetSalBitmap().get();
SalBitmap* pSalAlphaBmp = nullptr;
+ Bitmap aAlphaBitmap;
if(rBitmapEx.IsTransparent())
{
if(rBitmapEx.IsAlpha())
{
- pSalAlphaBmp = rBitmapEx.GetAlpha().ImplGetSalBitmap().get();
+ aAlphaBitmap = rBitmapEx.GetAlpha();
}
else
{
- pSalAlphaBmp = rBitmapEx.GetMask().ImplGetSalBitmap().get();
+ aAlphaBitmap = rBitmapEx.GetMask();
}
+ if (!mpAlphaVDev)
+ pSalAlphaBmp = aAlphaBitmap.ImplGetSalBitmap().get();
+ }
+ else if (mpAlphaVDev)
+ {
+ aAlphaBitmap = Bitmap(rBitmapEx.GetSizePixel(), 1);
+ aAlphaBitmap.Erase(COL_BLACK);
}
bDone = mpGraphics->DrawTransformedBitmap(
@@ -1072,6 +1080,9 @@ bool OutputDevice::DrawTransformBitmapExDirect(
pSalAlphaBmp,
this);
+ if (mpAlphaVDev)
+ mpAlphaVDev->DrawTransformBitmapExDirect(aFullTransform, BitmapEx(aAlphaBitmap));
+
return bDone;
};
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index 60deaceb822c..77e0564ba16f 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -338,6 +338,9 @@ void OutputDevice::ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyP
if(bSuccess)
{
+ if (mpAlphaVDev)
+ mpAlphaVDev->ImplDrawPolyPolygonWithB2DPolyPolygon(rB2DPolyPoly);
+
return;
}
}
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index d17056d58e13..672854a9ed55 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -342,11 +342,12 @@ bool OutputDevice::DrawPolyLineDirect(
const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation() * rObjectTransform);
const bool bPixelSnapHairline((mnAntialiasing & AntialiasingFlags::PixelSnapHairline) && rB2DPolygon.count() < 1000);
+ const double fAdjustedTransparency = mpAlphaVDev ? 0 : fTransparency;
// draw the polyline
bool bDrawSuccess = mpGraphics->DrawPolyLine(
aTransform,
rB2DPolygon,
- fTransparency,
+ fAdjustedTransparency,
fLineWidth, // tdf#124848 use LineWidth direct, do not try to solve for zero-case (aka hairline)
pStroke, // MM01
eLineJoin,
@@ -370,6 +371,12 @@ bool OutputDevice::DrawPolyLineDirect(
const tools::Polygon aToolsPolygon( rB2DPolygon );
mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) );
}
+
+ if (mpAlphaVDev)
+ mpAlphaVDev->DrawPolyLineDirect(rObjectTransform, rB2DPolygon, fLineWidth,
+ fTransparency, pStroke, eLineJoin, eLineCap,
+ fMiterMinimumAngle, bBypassAACheck);
+
return true;
}
}
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index e35d4dfbf959..a9e2ae080e8c 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -248,6 +248,7 @@ void OutputDevice::DrawTransparent(
// create ObjectToDevice transformation
const basegfx::B2DHomMatrix aFullTransform(ImplGetDeviceTransformation() * rObjectTransform);
+ const double fAdjustedTransparency = mpAlphaVDev ? 0 : fTransparency;
bool bDrawnOk(true);
if( IsFillColor() )
@@ -255,7 +256,7 @@ void OutputDevice::DrawTransparent(
bDrawnOk = mpGraphics->DrawPolyPolygon(
aFullTransform,
aB2DPolyPolygon,
- fTransparency,
+ fAdjustedTransparency,
this);
}
@@ -268,7 +269,7 @@ void OutputDevice::DrawTransparent(
mpGraphics->DrawPolyLine(
aFullTransform,
rPolygon,
- fTransparency,
+ fAdjustedTransparency,
0.0, // tdf#124848 hairline
nullptr, // MM01
basegfx::B2DLineJoin::NONE,
@@ -292,6 +293,21 @@ void OutputDevice::DrawTransparent(
static_cast< sal_uInt16 >(fTransparency * 100.0)));
}
+ if (mpAlphaVDev)
+ {
+ const Color aFillCol(mpAlphaVDev->GetFillColor());
+ const Color aLineColor(mpAlphaVDev->GetLineColor());
+ const auto nGreyScale = static_cast<sal_uInt8>(std::round(255 * fTransparency));
+ const Color aNewColor(nGreyScale, nGreyScale, nGreyScale);
+ mpAlphaVDev->SetFillColor(aNewColor);
+ mpAlphaVDev->SetLineColor(aNewColor);
+
+ mpAlphaVDev->DrawTransparent(rObjectTransform, rB2DPolyPoly, fTransparency);
+
+ mpAlphaVDev->SetFillColor(aFillCol);
+ mpAlphaVDev->SetLineColor(aLineColor);
+ }
+
return;
}
}
More information about the Libreoffice-commits
mailing list