tdf#125670 check graphics before output cliprect

Brown paperbag fix. Caolan and me were so concerned about performance
that we actually forgot about the intention of the original fix to
ensure a valid graphics before checking the output clip rect, so in
the end we re-introduced the bug.

This basically reverts commit aeead1782ff1 ("Related: tdf#125670
avoid possible performance issues for the general case"). The output
clip rect is not needed for the metafile, as it is ignored.

Reviewed-on: https://gerrit.libreoffice.org/74550
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
(cherry picked from commit 24c21375f9983428cabf46407943a2b2daa5a8f0)

Change-Id: I68f4367cc3afbd659f691999b675a81a21258106
Reviewed-on: https://gerrit.libreoffice.org/74561
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index cfc3f4a..7fc37b3 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -50,12 +50,6 @@
{
    assert(!is_double_buffered_window());

    if ( mbInitClipRegion )
        InitClipRegion();

    if (mbOutputClipped && !mpMetaFile)
        return;

    if ( rPolyPoly.Count() && rPolyPoly[ 0 ].GetSize() )
    {
        if ( mnDrawMode & ( DrawModeFlags::BlackGradient | DrawModeFlags::WhiteGradient | DrawModeFlags::SettingsGradient) )
@@ -100,23 +94,20 @@
                if( !mpGraphics && !AcquireGraphics() )
                    return;

                // secure clip region
                Push( PushFlags::CLIPREGION );
                IntersectClipRegion( aBoundRect );

                if( mbInitClipRegion )
                    InitClipRegion();

                if (mbOutputClipped)
                {
                    Pop();
                    return;
                }

                // secure clip region
                Push( PushFlags::CLIPREGION );
                IntersectClipRegion( aBoundRect );

                // try to draw gradient natively
                bDrawn = mpGraphics->DrawGradient( aClixPolyPoly, aGradient );

                if( !bDrawn && !mbOutputClipped )
                if (!bDrawn)
                {
                    // draw gradients without border
                    if( mbLineColor || mbInitLineColor )