Revert "Re-Enable DrawTransformBitmapExDirect for render backends"
This reverts commit 7e5af164b7.
Reason for revert: Not the best/effective way to clear out the stuff remaining to be done, would need additional stuff
Change-Id: Ia6ab90384da29a5e34eff0ab8881bad2ab49c58c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126601
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
This commit is contained in:
@@ -2750,8 +2750,8 @@ SalGraphics::DrawTransformedBitmap(basegfx::B2DPoint const&, basegfx::B2DPoint c
|
||||
SalGraphics::FillFontSubsetInfo(vcl::TTGlobalFontInfo_ const&, rtl::OUString const&, FontSubsetInfo&)
|
||||
SalGraphics::GetBitmap(long, long, long, long, OutputDevice const&)
|
||||
SalGraphics::GetNativeControlRegion(ControlType, ControlPart, tools::Rectangle const&, ControlState, ImplControlValue const&, tools::Rectangle&, tools::Rectangle&, OutputDevice const&)
|
||||
SalGraphics::ImplementsFastDrawTransformedBitmap(bool) const
|
||||
SalGraphics::GetPixel(long, long, OutputDevice const&)
|
||||
SalGraphics::HasFastDrawTransformedBitmap() const
|
||||
SalGraphics::HitTestNativeScrollbar(ControlPart, tools::Rectangle const&, Point const&, bool&, OutputDevice const&)
|
||||
SalGraphics::Invert(long, long, long, long, SalInvert, OutputDevice const&)
|
||||
SalGraphics::Invert(unsigned int, Point const*, SalInvert, OutputDevice const&)
|
||||
|
||||
@@ -721,7 +721,7 @@ namespace vclcanvas
|
||||
// itself serves this purpose
|
||||
return uno::Reference< rendering::XCachedPrimitive >(nullptr);
|
||||
}
|
||||
else if( mpOutDevProvider->getOutDev().ImplementsFastDrawTransformedBitmap())
|
||||
else if( mpOutDevProvider->getOutDev().HasFastDrawTransformedBitmap())
|
||||
{
|
||||
::basegfx::B2DHomMatrix aSizeTransform;
|
||||
aSizeTransform.scale( aBmpEx.GetSizePixel().Width(), aBmpEx.GetSizePixel().Height() );
|
||||
|
||||
@@ -1381,11 +1381,11 @@ public:
|
||||
const BitmapEx& rBitmapEx,
|
||||
double fAlpha = 1.0);
|
||||
|
||||
/** Return true if DrawTransformedBitmapEx() is implemented. It may still fail,
|
||||
e.g when fAlpha != 1.0 and that aspect is not implemented. This is a hint
|
||||
that calling it is worth a try
|
||||
/** Return true if DrawTransformedBitmapEx() is fast.
|
||||
|
||||
@since 7.2
|
||||
*/
|
||||
bool ImplementsFastDrawTransformedBitmap() const;
|
||||
bool HasFastDrawTransformedBitmap() const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -830,6 +830,11 @@ bool SvpSalGraphics::drawTransformedBitmap(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SvpSalGraphics::hasFastDrawTransformedBitmap() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void SvpSalGraphics::clipRegion(cairo_t* cr, const vcl::Region& rClipRegion)
|
||||
{
|
||||
RectangleVector aRectangles;
|
||||
|
||||
@@ -147,6 +147,7 @@ protected:
|
||||
const SalBitmap& rSourceBitmap,
|
||||
const SalBitmap* pAlphaBitmap,
|
||||
double fAlpha) override;
|
||||
virtual bool hasFastDrawTransformedBitmap() const override;
|
||||
virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) override;
|
||||
|
||||
cairo_t* createTmpCompatibleCairoContext() const;
|
||||
|
||||
@@ -149,6 +149,8 @@ public:
|
||||
const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
|
||||
const SalBitmap* pAlphaBitmap, double fAlpha) override;
|
||||
|
||||
bool hasFastDrawTransformedBitmap() const override;
|
||||
|
||||
bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
|
||||
sal_uInt8 nTransparency) override;
|
||||
|
||||
|
||||
@@ -431,6 +431,8 @@ public:
|
||||
const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
|
||||
const SalBitmap* pAlphaBitmap, double fAlpha) override;
|
||||
|
||||
bool hasFastDrawTransformedBitmap() const override;
|
||||
|
||||
bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
|
||||
sal_uInt8 nTransparency) override;
|
||||
|
||||
|
||||
+10
-5
@@ -430,7 +430,7 @@ public:
|
||||
double fAlpha,
|
||||
const OutputDevice& rOutDev );
|
||||
|
||||
bool ImplementsFastDrawTransformedBitmap(bool bTestAllowed) const;
|
||||
bool HasFastDrawTransformedBitmap() const;
|
||||
|
||||
bool DrawAlphaRect(
|
||||
tools::Long nX, tools::Long nY,
|
||||
@@ -600,6 +600,10 @@ protected:
|
||||
const SalBitmap* pAlphaBitmap,
|
||||
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
|
||||
*
|
||||
* @param nX Top left coordinate of rectangle
|
||||
@@ -625,10 +629,6 @@ private:
|
||||
bool m_bLastMirrorDeviceLTRButBiDiRtlSet;
|
||||
|
||||
protected:
|
||||
/// check/remember if FastDraw is implemented for this SalGraphics
|
||||
bool m_bFastDrawTransformedBitmapChecked;
|
||||
bool m_bFastDrawTransformedBitmap;
|
||||
|
||||
/// flags which hold the SetAntialiasing() value from OutputDevice
|
||||
bool m_bAntiAlias : 1;
|
||||
|
||||
@@ -894,6 +894,11 @@ public:
|
||||
return GetImpl()->drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha);
|
||||
}
|
||||
|
||||
bool hasFastDrawTransformedBitmap() const override
|
||||
{
|
||||
return GetImpl()->hasFastDrawTransformedBitmap();
|
||||
}
|
||||
|
||||
bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth,
|
||||
tools::Long nHeight, sal_uInt8 nTransparency) override
|
||||
{
|
||||
|
||||
@@ -212,6 +212,10 @@ public:
|
||||
const SalBitmap* pAlphaBitmap,
|
||||
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(
|
||||
tools::Long nX, tools::Long nY,
|
||||
tools::Long nWidth, tools::Long nHeight,
|
||||
|
||||
@@ -173,6 +173,8 @@ public:
|
||||
const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
|
||||
const SalBitmap* pAlphaBitmap, double fAlpha) override;
|
||||
|
||||
virtual bool hasFastDrawTransformedBitmap() const override;
|
||||
|
||||
/** Render solid rectangle with given transparency
|
||||
|
||||
@param nX Top left coordinate of rectangle
|
||||
|
||||
@@ -111,6 +111,8 @@ public:
|
||||
const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
|
||||
const SalBitmap* pAlphaBitmap, double fAlpha) override;
|
||||
|
||||
bool hasFastDrawTransformedBitmap() const override;
|
||||
|
||||
bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
|
||||
sal_uInt8 nTransparency) override;
|
||||
|
||||
|
||||
@@ -253,6 +253,8 @@ public:
|
||||
const SalBitmap* pAlphaBitmap,
|
||||
double fAlpha) override;
|
||||
|
||||
virtual bool hasFastDrawTransformedBitmap() const override;
|
||||
|
||||
virtual bool drawAlphaRect(
|
||||
tools::Long nX, tools::Long nY, tools::Long nWidth,
|
||||
tools::Long nHeight, sal_uInt8 nTransparency ) override;
|
||||
|
||||
@@ -309,6 +309,8 @@ public:
|
||||
const SalBitmap* pAlphaBitmap,
|
||||
double fAlpha) override;
|
||||
|
||||
virtual bool hasFastDrawTransformedBitmap() const override;
|
||||
|
||||
virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -661,7 +661,6 @@ bool QtGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
|
||||
{
|
||||
if (fAlpha != 1.0)
|
||||
return false;
|
||||
|
||||
QImage aImage;
|
||||
if (pAlphaBitmap && !getAlphaImage(rSourceBitmap, *pAlphaBitmap, aImage))
|
||||
return false;
|
||||
@@ -682,6 +681,8 @@ bool QtGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QtGraphicsBackend::hasFastDrawTransformedBitmap() const { return false; }
|
||||
|
||||
bool QtGraphicsBackend::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth,
|
||||
tools::Long nHeight, sal_uInt8 nTransparency)
|
||||
{
|
||||
|
||||
@@ -1299,6 +1299,8 @@ bool AquaGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AquaGraphicsBackend::hasFastDrawTransformedBitmap() const { return false; }
|
||||
|
||||
bool AquaGraphicsBackend::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth,
|
||||
tools::Long nHeight, sal_uInt8 nTransparency)
|
||||
{
|
||||
|
||||
@@ -1829,6 +1829,13 @@ void SkiaSalGraphicsImpl::drawShader(const SalTwoRect& rPosAry, const sk_sp<SkSh
|
||||
postDraw();
|
||||
}
|
||||
|
||||
bool SkiaSalGraphicsImpl::hasFastDrawTransformedBitmap() const
|
||||
{
|
||||
// Return true even in raster mode, even that way Skia is faster than e.g. GraphicObject
|
||||
// trying to handle stuff manually.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Whether applying matrix needs image smoothing for the transformation.
|
||||
static bool matrixNeedsHighQuality(const SkMatrix& matrix)
|
||||
{
|
||||
|
||||
@@ -54,8 +54,6 @@ SalGraphics::SalGraphics()
|
||||
m_aLastMirrorW(0),
|
||||
m_nLastMirrorDeviceLTRButBiDiRtlTranslate(0),
|
||||
m_bLastMirrorDeviceLTRButBiDiRtlSet(false),
|
||||
m_bFastDrawTransformedBitmapChecked(false),
|
||||
m_bFastDrawTransformedBitmap(false),
|
||||
m_bAntiAlias(false)
|
||||
{
|
||||
// read global RTL settings
|
||||
@@ -844,9 +842,6 @@ bool SalGraphics::DrawTransformedBitmap(
|
||||
double fAlpha,
|
||||
const OutputDevice& rOutDev)
|
||||
{
|
||||
bool bRetval(false);
|
||||
bool bDone(false);
|
||||
|
||||
if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
|
||||
{
|
||||
// mirroring set
|
||||
@@ -861,49 +856,16 @@ bool SalGraphics::DrawTransformedBitmap(
|
||||
basegfx::B2DPoint aX = aTranslateToMirroredBounds * rX;
|
||||
basegfx::B2DPoint aY = aTranslateToMirroredBounds * rY;
|
||||
|
||||
bRetval = drawTransformedBitmap(aNull, aX, aY, rSourceBitmap, pAlphaBitmap, fAlpha);
|
||||
bDone = true;
|
||||
return drawTransformedBitmap(aNull, aX, aY, rSourceBitmap, pAlphaBitmap, fAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
if(!bDone)
|
||||
{
|
||||
bRetval = drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha);
|
||||
}
|
||||
|
||||
if(bRetval && !m_bFastDrawTransformedBitmap)
|
||||
{
|
||||
// we had a sucessful call, note it for this SalGraphics
|
||||
m_bFastDrawTransformedBitmap = true;
|
||||
}
|
||||
|
||||
return bRetval;
|
||||
return drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha);
|
||||
}
|
||||
|
||||
bool SalGraphics::ImplementsFastDrawTransformedBitmap(bool bTestAllowed) const
|
||||
bool SalGraphics::HasFastDrawTransformedBitmap() const
|
||||
{
|
||||
// do not check when we already had a sucessful usage of drawTransformedBitmap (see above)
|
||||
// only check if calling OutputDevice is not empty (bTestAllowed)
|
||||
// check only once using the direct check method (see below)
|
||||
if(!m_bFastDrawTransformedBitmap && bTestAllowed && !m_bFastDrawTransformedBitmapChecked)
|
||||
{
|
||||
// for check and to not change anything, get the top-left pixel as SalBitmap
|
||||
// and try to paint it again. This avoids an extra virtual method hat would need
|
||||
// to be implemened at all backends and cald all the time (virual calls).
|
||||
// Nothing simpler came to my mind, maybe there is something...
|
||||
SalGraphics* that(const_cast<SalGraphics*>(this));
|
||||
std::shared_ptr<SalBitmap> aTest(that->getBitmap(0, 0, 1, 1));
|
||||
that->m_bFastDrawTransformedBitmapChecked = true;
|
||||
that->m_bFastDrawTransformedBitmap = that->drawTransformedBitmap(
|
||||
basegfx::B2DPoint::getEmptyPoint(),
|
||||
basegfx::B2DPoint(1.0, 0.0),
|
||||
basegfx::B2DPoint(0.0, 1.0),
|
||||
*aTest,
|
||||
nullptr,
|
||||
1.0);
|
||||
}
|
||||
|
||||
return m_bFastDrawTransformedBitmap;
|
||||
return hasFastDrawTransformedBitmap();
|
||||
}
|
||||
|
||||
bool SalGraphics::DrawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
|
||||
|
||||
@@ -691,6 +691,18 @@ void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const Bitmap& rBitmap,
|
||||
mpMetaFile = pOldMetaFile;
|
||||
}
|
||||
|
||||
bool OutputDevice::HasFastDrawTransformedBitmap() const
|
||||
{
|
||||
if( ImplIsRecordLayout() )
|
||||
return false;
|
||||
|
||||
if (!mpGraphics && !AcquireGraphics())
|
||||
return false;
|
||||
assert(mpGraphics);
|
||||
|
||||
return mpGraphics->HasFastDrawTransformedBitmap();
|
||||
}
|
||||
|
||||
void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageFlags nStyle )
|
||||
{
|
||||
assert(!is_double_buffered_window());
|
||||
|
||||
@@ -525,7 +525,7 @@ void OutputDevice::DrawTransformedBitmapEx(
|
||||
if(rtl::math::approxEqual( fAlpha, 1.0 ))
|
||||
fAlpha = 1.0; // avoid the need for approxEqual in backends
|
||||
|
||||
if(bTryDirectPaint && DrawTransformBitmapExDirect(aFullTransform, bitmapEx))
|
||||
if(bTryDirectPaint && mpGraphics->HasFastDrawTransformedBitmap() && DrawTransformBitmapExDirect(aFullTransform, bitmapEx))
|
||||
return;
|
||||
|
||||
// decompose matrix to check rotation and shear
|
||||
@@ -689,9 +689,4 @@ void OutputDevice::DrawTransformedBitmapEx(
|
||||
DrawBitmapEx(aDestPt, aDestSize, aTransformed);
|
||||
}
|
||||
|
||||
bool OutputDevice::ImplementsFastDrawTransformedBitmap() const
|
||||
{
|
||||
return mpGraphics->ImplementsFastDrawTransformedBitmap(!GetOutputSizePixel().IsEmpty());
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
|
||||
@@ -852,6 +852,11 @@ bool X11SalGraphicsImpl::drawTransformedBitmap(
|
||||
return false;
|
||||
}
|
||||
|
||||
bool X11SalGraphicsImpl::hasFastDrawTransformedBitmap() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool X11SalGraphicsImpl::drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth,
|
||||
tools::Long nHeight, sal_uInt8 nTransparency )
|
||||
{
|
||||
|
||||
@@ -272,6 +272,8 @@ public:
|
||||
const SalBitmap* pAlphaBitmap,
|
||||
double fAlpha) override;
|
||||
|
||||
virtual bool hasFastDrawTransformedBitmap() const override;
|
||||
|
||||
/** Render solid rectangle with given transparency
|
||||
|
||||
@param nTransparency
|
||||
|
||||
@@ -139,13 +139,14 @@ bool X11SalGraphics::drawTransformedBitmap(
|
||||
const SalBitmap* pAlphaBitmap,
|
||||
double fAlpha)
|
||||
{
|
||||
// called mxImpl->drawTransformedBitmap anyways returns false, but spares a call
|
||||
if( fAlpha != 1.0 )
|
||||
return false;
|
||||
|
||||
return mxImpl->drawTransformedBitmap( rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha );
|
||||
}
|
||||
|
||||
bool X11SalGraphics::hasFastDrawTransformedBitmap() const
|
||||
{
|
||||
return mxImpl->hasFastDrawTransformedBitmap();
|
||||
}
|
||||
|
||||
bool X11SalGraphics::drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth,
|
||||
tools::Long nHeight, sal_uInt8 nTransparency )
|
||||
{
|
||||
|
||||
@@ -387,6 +387,8 @@ bool GenPspGfxBackend::drawTransformedBitmap(const basegfx::B2DPoint& /*rNull*/,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GenPspGfxBackend::hasFastDrawTransformedBitmap() const { return false; }
|
||||
|
||||
bool GenPspGfxBackend::drawAlphaRect(tools::Long /*nX*/, tools::Long /*nY*/, tools::Long /*nWidth*/,
|
||||
tools::Long /*nHeight*/, sal_uInt8 /*nTransparency*/)
|
||||
{
|
||||
|
||||
@@ -2714,6 +2714,11 @@ bool WinSalGraphicsImpl::drawTransformedBitmap(
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WinSalGraphicsImpl::hasFastDrawTransformedBitmap() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WinSalGraphicsImpl::drawGradient(const tools::PolyPolygon& /*rPolygon*/,
|
||||
const Gradient& /*rGradient*/)
|
||||
{
|
||||
|
||||
@@ -228,6 +228,8 @@ public:
|
||||
const SalBitmap* pAlphaBitmap,
|
||||
double fAlpha) override;
|
||||
|
||||
virtual bool hasFastDrawTransformedBitmap() const override;
|
||||
|
||||
/** Render solid rectangle with given transparency
|
||||
|
||||
@param nTransparency
|
||||
|
||||
@@ -92,12 +92,13 @@ bool WinSalGraphics::drawTransformedBitmap(
|
||||
const SalBitmap* pAlphaBitmap,
|
||||
double fAlpha)
|
||||
{
|
||||
// called mpImpl->drawTransformedBitmap also checks this, but spares a call
|
||||
if( fAlpha != 1.0 )
|
||||
return false;
|
||||
|
||||
return mpImpl->drawTransformedBitmap(rNull, rX, rY,
|
||||
rSourceBitmap, pAlphaBitmap, fAlpha);
|
||||
}
|
||||
|
||||
bool WinSalGraphics::hasFastDrawTransformedBitmap() const
|
||||
{
|
||||
return mpImpl->hasFastDrawTransformedBitmap();
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
Reference in New Issue
Block a user