summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-02-19 18:50:29 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-02-24 12:40:38 +0100
commit5d2faf94c2f0ac59223a84410979d57ba477ebf6 (patch)
tree987e946ff12ed626f091522d3956338ea061f713 /vcl
parent5ba5ac948db1092712ffeaef41983ea5f5dcb5cc (diff)
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@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/salgdi.hxx1
-rw-r--r--vcl/inc/salgdiimpl.hxx1
-rw-r--r--vcl/source/outdev/bitmap.cxx30
3 files changed, 12 insertions, 20 deletions
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)
{