diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-12-08 09:43:13 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-12-11 10:14:53 +0100 |
commit | b9e1d9fac994754e775899889cf601d303dba688 (patch) | |
tree | 59a5bb505d8fc9c3d5c15e09ac091b6763d33dc1 /vcl | |
parent | 68ad2dd46dd42d81b576b3e61659c39f381790b6 (diff) |
explain the intent of HasDrawTransformedBitmap() better
Change-Id: I32d6cfb7358dae25109de4db3332797763abc7d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126506
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salgdi.hxx | 7 | ||||
-rw-r--r-- | vcl/source/outdev/bitmapex.cxx | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 716c9aa934a6..db3ed6806f7e 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -600,7 +600,12 @@ protected: const SalBitmap* pAlphaBitmap, double fAlpha) = 0; - /// Used e.g. by canvas to know whether to cache the drawing. + /// Returns true if the drawTransformedBitmap() call is fast, and so it should + /// be used directly without trying to optimize some calls e.g. by calling drawBitmap() + /// instead (which is faster for most VCL backends). These optimizations are not + /// done unconditionally because they may be counter-productive for some fast VCL backends + /// (for example, some OutputDevice optimizations could try access the pixels, which + /// would make performance worse for GPU-backed backends). /// See also tdf#138068. virtual bool hasFastDrawTransformedBitmap() const = 0; diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx index 7855d1ae5613..55a166c6e5ba 100644 --- a/vcl/source/outdev/bitmapex.cxx +++ b/vcl/source/outdev/bitmapex.cxx @@ -525,6 +525,8 @@ void OutputDevice::DrawTransformedBitmapEx( if(rtl::math::approxEqual( fAlpha, 1.0 )) fAlpha = 1.0; // avoid the need for approxEqual in backends + // If the backend's implementation is known to not need any optimizations here, pass to it directly. + // With most backends it's more performant to try to simplify to DrawBitmapEx() first. if(bTryDirectPaint && mpGraphics->HasFastDrawTransformedBitmap() && DrawTransformBitmapExDirect(aFullTransform, bitmapEx)) return; @@ -562,11 +564,9 @@ void OutputDevice::DrawTransformedBitmapEx( return; } + // Try the backend's implementation before resorting to the slower fallback here. if(bTryDirectPaint && DrawTransformBitmapExDirect(aFullTransform, bitmapEx)) - { - // we are done return; - } // take the fallback when no rotate and shear, but mirror (else we would have done this above) if(!bRotated && !bSheared) |