From f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 15 Jun 2018 12:46:15 +0200 Subject: =?UTF-8?q?Run=20clang-tidy=E2=80=99s=20modernize-use-nullptr=20pa?= =?UTF-8?q?ss.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replaces all NULL or 0 with nullptr when assigned to or returned as a pointer. --- src/display/drawing-image.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/display/drawing-image.cpp') diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp index 4be3099bf..2a3777e36 100644 --- a/src/display/drawing-image.cpp +++ b/src/display/drawing-image.cpp @@ -22,7 +22,7 @@ namespace Inkscape { DrawingImage::DrawingImage(Drawing &drawing) : DrawingItem(drawing) - , _pixbuf(NULL) + , _pixbuf(nullptr) {} DrawingImage::~DrawingImage() @@ -184,7 +184,7 @@ distance_to_segment (Geom::Point const &p, Geom::Point const &a1, Geom::Point co DrawingItem * DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) { - if (!_pixbuf) return NULL; + if (!_pixbuf) return nullptr; bool outline = _drawing.outline(); @@ -201,7 +201,7 @@ DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) } } } - return NULL; + return nullptr; } else { unsigned char *const pixels = _pixbuf->pixels(); @@ -213,7 +213,7 @@ DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) Geom::Rect r = bounds(); if (!r.contains(tp)) - return NULL; + return nullptr; double vw = width * _scale[Geom::X]; double vh = height * _scale[Geom::Y]; @@ -221,7 +221,7 @@ DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) int iy = floor((tp[Geom::Y] - _origin[Geom::Y]) / vh * height); if ((ix < 0) || (iy < 0) || (ix >= width) || (iy >= height)) - return NULL; + return nullptr; unsigned char *pix_ptr = pixels + iy * rowstride + ix * 4; // pick if the image is less than 99% transparent @@ -235,7 +235,7 @@ DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) throw std::runtime_error("Unrecognized pixel format"); } float alpha_f = (alpha / 255.0f) * _opacity; - return alpha_f > 0.01 ? this : NULL; + return alpha_f > 0.01 ? this : nullptr; } } -- cgit v1.2.3