summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-11-11 16:23:53 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-11-12 18:49:19 +0100
commit754697f0dcd63e1f0ce2edd70ab8b42b1b4d4484 (patch)
tree8fa052a38315843b2e784f2396b4cc701fba8e46
parenta4d4286a6ae5ad7f57db4f34380ed170b92ced06 (diff)
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.lunak@collabora.com>
-rw-r--r--vcl/skia/gdiimpl.cxx62
1 files changed, 30 insertions, 32 deletions
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);
+ }
}
}