summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-04-11 20:18:18 +0900
committerTomaž Vajngerl <quikee@gmail.com>2022-04-11 16:43:04 +0200
commit538166da779e13197411cade8bd7dedb94778525 (patch)
tree2f0af4daa3a5c01ae56b376079ca2876a7a2649a /sc/source/ui
parent5e28945bd4cbd31856ccd6ce894693ceafea4144 (diff)
sc: fix rendering when sparkline doesn't have a data range
Change-Id: I945594d93c893043cea1758b3ad9c4e7692ef27e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132815 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/inc/SparklineRenderer.hxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sc/source/ui/inc/SparklineRenderer.hxx b/sc/source/ui/inc/SparklineRenderer.hxx
index e69ba51e8afa..616d667ecb48 100644
--- a/sc/source/ui/inc/SparklineRenderer.hxx
+++ b/sc/source/ui/inc/SparklineRenderer.hxx
@@ -15,6 +15,7 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <comphelper/scopeguard.hxx>
#include <Sparkline.hxx>
#include <SparklineGroup.hxx>
@@ -494,6 +495,8 @@ public:
tools::Long nOneX, tools::Long nOneY, double fScaleX, double fScaleY)
{
rRenderContext.Push();
+ comphelper::ScopeGuard aPushPopGuard([&rRenderContext]() { rRenderContext.Pop(); });
+
rRenderContext.SetAntialiasing(AntialiasingFlags::Enable);
rRenderContext.SetClipRegion(vcl::Region(rRectangle));
@@ -508,7 +511,9 @@ public:
auto const& rRangeList = pSparkline->getInputRange();
if (rRangeList.empty())
+ {
return;
+ }
auto pSparklineGroup = pSparkline->getSparklineGroup();
auto const& rAttributes = pSparklineGroup->getAttributes();
@@ -564,7 +569,6 @@ public:
drawLine(rRenderContext, aOutputRectangle, aSparklineValues,
pSparklineGroup->getAttributes());
}
- rRenderContext.Pop();
}
};
}