[Libreoffice-commits] core.git: vcl/inc vcl/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 24 11:41:29 UTC 2021
vcl/inc/salgdi.hxx | 1 +
vcl/inc/salgdiimpl.hxx | 1 +
vcl/source/outdev/bitmap.cxx | 30 ++++++++++--------------------
3 files changed, 12 insertions(+), 20 deletions(-)
New commits:
commit 5d2faf94c2f0ac59223a84410979d57ba477ebf6
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Feb 19 18:50:29 2021 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Feb 24 12:40:38 2021 +0100
actually prefer DrawTransformedBitmap() if it's known to be fast
This partially reverts the logic of change 9d89d98d3349502b56d,
which always made DrawTransformedBitmap() get changed to DrawBitmapEx
if only translation+scaling was involved. But since that one
may call BitmapEx::Mirror() that'll do pixel-shuffling, trust
the DrawTransformedBitmap() implementation to do the right and
efficient thing if it says so.
Change-Id: If25b3d189ddd46b235e122e5e8d6f8079ec09f7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111248
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 494f03eef5a5..175123342318 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -588,6 +588,7 @@ protected:
double fAlpha) = 0;
/// Used e.g. by canvas to know whether to cache the drawing.
+ /// See also tdf#138068.
virtual bool hasFastDrawTransformedBitmap() const = 0;
/** Render solid rectangle with given transparency
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index 8b310c586e1a..94505b1a83f6 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -198,6 +198,7 @@ public:
double fAlpha) = 0;
/// Used e.g. by canvas to know whether to cache the drawing.
+ /// See also tdf#138068.
virtual bool hasFastDrawTransformedBitmap() const = 0;
virtual bool drawAlphaRect(
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 563989cc366d..426366580c4d 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1265,17 +1265,16 @@ void OutputDevice::DrawTransformedBitmapEx(
const bool bInvert(RasterOp::Invert == meRasterOp);
const bool bBitmapChangedColor(mnDrawMode & (DrawModeFlags::BlackBitmap | DrawModeFlags::WhiteBitmap | DrawModeFlags::GrayBitmap ));
const bool bTryDirectPaint(!bInvert && !bBitmapChangedColor && !bMetafile);
+ // tdf#130768 CAUTION(!) using GetViewTransformation() is *not* enough here, it may
+ // be that mnOutOffX/mnOutOffY is used - see AOO bug 75163, mentioned at
+ // ImplGetDeviceTransformation declaration
+ basegfx::B2DHomMatrix aFullTransform(ImplGetDeviceTransformation() * rTransformation);
// First try to handle additional alpha blending, either directly, or modify the bitmap.
if(!rtl::math::approxEqual( fAlpha, 1.0 ))
{
if(bTryDirectPaint)
{
- // tdf#130768 CAUTION(!) using GetViewTransformation() is *not* enough here, it may
- // be that mnOutOffX/mnOutOffY is used - see AOO bug 75163, mentioned at
- // ImplGetDeviceTransformation declaration
- const basegfx::B2DHomMatrix aFullTransform(ImplGetDeviceTransformation() * rTransformation);
-
if(DrawTransformBitmapExDirect(aFullTransform, bitmapEx, fAlpha))
{
// we are done
@@ -1292,6 +1291,9 @@ void OutputDevice::DrawTransformedBitmapEx(
if(rtl::math::approxEqual( fAlpha, 1.0 ))
fAlpha = 1.0; // avoid the need for approxEqual in backends
+ if(bTryDirectPaint && mpGraphics->HasFastDrawTransformedBitmap() && DrawTransformBitmapExDirect(aFullTransform, bitmapEx))
+ return;
+
// decompose matrix to check rotation and shear
basegfx::B2DVector aScale, aTranslate;
double fRotate, fShearX;
@@ -1326,18 +1328,10 @@ void OutputDevice::DrawTransformedBitmapEx(
return;
}
- if(bTryDirectPaint)
+ if(bTryDirectPaint && DrawTransformBitmapExDirect(aFullTransform, bitmapEx))
{
- // tdf#130768 CAUTION(!) using GetViewTransformation() is *not* enough here, it may
- // be that mnOutOffX/mnOutOffY is used - see AOO bug 75163, mentioned at
- // ImplGetDeviceTransformation declaration
- const basegfx::B2DHomMatrix aFullTransform(ImplGetDeviceTransformation() * rTransformation);
-
- if(DrawTransformBitmapExDirect(aFullTransform, bitmapEx))
- {
- // we are done
- return;
- }
+ // we are done
+ return;
}
// take the fallback when no rotate and shear, but mirror (else we would have done this above)
@@ -1370,10 +1364,6 @@ void OutputDevice::DrawTransformedBitmapEx(
const double fOrigArea(rOriginalSizePixel.Width() * rOriginalSizePixel.Height() * 0.5);
const double fOrigAreaScaled(fOrigArea * 1.44);
double fMaximumArea(std::clamp(fOrigAreaScaled, 1000000.0, 4500000.0));
- // tdf#130768 CAUTION(!) using GetViewTransformation() is *not* enough here, it may
- // be that mnOutOffX/mnOutOffY is used - see AOO bug 75163, mentioned at
- // ImplGetDeviceTransformation declaration
- basegfx::B2DHomMatrix aFullTransform(ImplGetDeviceTransformation() * rTransformation);
if(!bMetafile)
{
More information about the Libreoffice-commits
mailing list