vcl/skia/gdiimpl.cxx |   62 ++++++++++++++++++++++++---------------------------
 1 file changed, 30 insertions(+), 32 deletions(-)

New commits:
commit 754697f0dcd63e1f0ce2edd70ab8b42b1b4d4484
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Nov 11 16:23:53 2021 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Fri Nov 12 18:49:19 2021 +0100

    revert part of 'loplugin:flatten' in Skia code
    
    The automated code flattening may make sense in old spaghetti code,
    but this is new code, and it's structured the way it makes sense.
    Both those if's are logically just a part of a larger function
    and bailing out sooner is at least conceptually wrong (and the moment
    I add more code there, I'd need to revert anyway).
    
    Change-Id: Iddbd22166159429636196eb1545b008ef576036b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125054
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 1fb1518386d0..9e2da70323de 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -455,23 +455,22 @@ void SkiaSalGraphicsImpl::postDraw()
     }
     SkiaZone::leave(); // matched in preDraw()
     // If there's a problem with the GPU context, abort.
-    GrDirectContext* context = 
GrAsDirectContext(mSurface->getCanvas()->recordingContext());
-    if (!context)
-        return;
-
-    // Running out of memory on the GPU technically could be possibly 
recoverable,
-    // but we don't know the exact status of the surface (and what has or has 
not been drawn to it),
-    // so in practice this is unrecoverable without possible data loss.
-    if (context->oomed())
-    {
-        SAL_WARN("vcl.skia", "GPU context has run out of memory, aborting.");
-        abort();
-    }
-    // Unrecoverable problem.
-    if (context->abandoned())
+    if (GrDirectContext* context = 
GrAsDirectContext(mSurface->getCanvas()->recordingContext()))
     {
-        SAL_WARN("vcl.skia", "GPU context has been abandoned, aborting.");
-        abort();
+        // Running out of memory on the GPU technically could be possibly 
recoverable,
+        // but we don't know the exact status of the surface (and what has or 
has not been drawn to it),
+        // so in practice this is unrecoverable without possible data loss.
+        if (context->oomed())
+        {
+            SAL_WARN("vcl.skia", "GPU context has run out of memory, 
aborting.");
+            abort();
+        }
+        // Unrecoverable problem.
+        if (context->abandoned())
+        {
+            SAL_WARN("vcl.skia", "GPU context has been abandoned, aborting.");
+            abort();
+        }
     }
 }
 
@@ -1061,22 +1060,21 @@ static void roundPolygonPoints(basegfx::B2DPolyPolygon& 
polyPolygon)
 
 void SkiaSalGraphicsImpl::checkPendingDrawing()
 {
-    if (mLastPolyPolygonInfo.polygons.size() == 0)
-        return;
-
-    // Flush any pending polygon drawing.
-    basegfx::B2DPolyPolygonVector polygons;
-    std::swap(polygons, mLastPolyPolygonInfo.polygons);
-    double transparency = mLastPolyPolygonInfo.transparency;
-    mLastPolyPolygonInfo.bounds.reset();
-    if (polygons.size() == 1)
-        performDrawPolyPolygon(polygons.front(), transparency, true);
-    else
-    {
-        for (basegfx::B2DPolyPolygon& p : polygons)
-            roundPolygonPoints(p);
-        
performDrawPolyPolygon(basegfx::utils::mergeToSinglePolyPolygon(polygons), 
transparency,
-                               true);
+    if (mLastPolyPolygonInfo.polygons.size() != 0)
+    { // Flush any pending polygon drawing.
+        basegfx::B2DPolyPolygonVector polygons;
+        std::swap(polygons, mLastPolyPolygonInfo.polygons);
+        double transparency = mLastPolyPolygonInfo.transparency;
+        mLastPolyPolygonInfo.bounds.reset();
+        if (polygons.size() == 1)
+            performDrawPolyPolygon(polygons.front(), transparency, true);
+        else
+        {
+            for (basegfx::B2DPolyPolygon& p : polygons)
+                roundPolygonPoints(p);
+            
performDrawPolyPolygon(basegfx::utils::mergeToSinglePolyPolygon(polygons), 
transparency,
+                                   true);
+        }
     }
 }
 

Reply via email to