diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-03-03 14:00:06 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-03-03 12:07:29 +0000 |
commit | ebee2930a3558c5eb8921e1b5f3e275702f8a64f (patch) | |
tree | 12dfb27698bb2b92b4cbe1fb8cd7c0d85549cc10 /vcl/skia/gdiimpl.cxx | |
parent | 1c257c862df04d69486170bbfc7a17e6367dc950 (diff) |
Fix SAL_INFO dereferencing optionals
Change-Id: I6d8ec4cd481284a42db33bf85ec7770fbb89cf83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148168
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/skia/gdiimpl.cxx')
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 0ffafb040a46..f26b2d26711b 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -41,6 +41,8 @@ #include <SkRSXform.h> #include <numeric> +#include <sstream> + #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolypolygoncutter.hxx> @@ -216,6 +218,17 @@ bool checkInvalidSourceOrDestination(SalTwoRect const& rPosAry) || rPosAry.mnDestHeight <= 0; } +std::string dumpOptionalColor(const std::optional<Color>& c) +{ + std::ostringstream oss; + if (c) + oss << *c; + else + oss << "no color"; + + return std::move(oss).str(); // optimized in C++20 +} + } // end anonymous namespace // Class that triggers flushing the backing buffer when idle. @@ -738,8 +751,8 @@ void SkiaSalGraphicsImpl::privateDrawAlphaRect(tools::Long nX, tools::Long nY, t preDraw(); SAL_INFO("vcl.skia.trace", "privatedrawrect(" << this << "): " << SkIRect::MakeXYWH(nX, nY, nWidth, nHeight) - << ":" << *moLineColor << ":" << *moFillColor << ":" - << fTransparency); + << ":" << dumpOptionalColor(moLineColor) << ":" + << dumpOptionalColor(moFillColor) << ":" << fTransparency); addUpdateRegion(SkRect::MakeXYWH(nX, nY, nWidth, nHeight)); SkCanvas* canvas = getDrawCanvas(); if (moFillColor) @@ -840,7 +853,8 @@ bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectTo aPolyPolygon.transform(rObjectToDevice); SAL_INFO("vcl.skia.trace", "drawpolypolygon(" << this << "): " << aPolyPolygon << ":" - << *moLineColor << ":" << *moFillColor); + << dumpOptionalColor(moLineColor) << ":" + << dumpOptionalColor(moFillColor)); if (delayDrawPolyPolygon(aPolyPolygon, fTransparency)) { |