summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-06-15 10:46:15 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2018-06-18 12:27:01 +0000
commitf4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 (patch)
tree7c6044fd3a17a2665841959dac9b3b2110b27924 /src/display
parentRun clang-tidy’s modernize-use-override pass. (diff)
downloadinkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.tar.gz
inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.zip
Run clang-tidy’s modernize-use-nullptr pass.
This replaces all NULL or 0 with nullptr when assigned to or returned as a pointer.
Diffstat (limited to 'src/display')
-rw-r--r--src/display/cairo-utils.cpp92
-rw-r--r--src/display/canvas-arena.cpp14
-rw-r--r--src/display/canvas-axonomgrid.cpp12
-rw-r--r--src/display/canvas-bpath.cpp12
-rw-r--r--src/display/canvas-debug.cpp2
-rw-r--r--src/display/canvas-grid.cpp38
-rw-r--r--src/display/canvas-rotate.cpp26
-rw-r--r--src/display/canvas-text.cpp16
-rw-r--r--src/display/curve.cpp20
-rw-r--r--src/display/drawing-context.cpp4
-rw-r--r--src/display/drawing-group.cpp10
-rw-r--r--src/display/drawing-image.cpp12
-rw-r--r--src/display/drawing-item.cpp70
-rw-r--r--src/display/drawing-item.h6
-rw-r--r--src/display/drawing-pattern.cpp8
-rw-r--r--src/display/drawing-shape.cpp20
-rw-r--r--src/display/drawing-shape.h2
-rw-r--r--src/display/drawing-surface.cpp8
-rw-r--r--src/display/drawing-text.cpp8
-rw-r--r--src/display/drawing-text.h4
-rw-r--r--src/display/drawing.cpp4
-rw-r--r--src/display/drawing.h2
-rw-r--r--src/display/gnome-canvas-acetate.cpp2
-rw-r--r--src/display/guideline.cpp8
-rw-r--r--src/display/nr-filter-colormatrix.cpp2
-rw-r--r--src/display/nr-filter-gaussian.cpp2
-rw-r--r--src/display/nr-filter-image.cpp12
-rw-r--r--src/display/nr-filter-merge.cpp2
-rw-r--r--src/display/nr-filter-primitive.cpp2
-rw-r--r--src/display/nr-filter-slot.cpp4
-rw-r--r--src/display/nr-filter.cpp2
-rw-r--r--src/display/nr-style.cpp36
-rw-r--r--src/display/nr-style.h4
-rw-r--r--src/display/nr-svgfonts.cpp16
-rw-r--r--src/display/snap-indicator.cpp28
-rw-r--r--src/display/sodipodi-ctrl.cpp10
-rw-r--r--src/display/sp-canvas-util.cpp10
-rw-r--r--src/display/sp-canvas.cpp138
-rw-r--r--src/display/sp-ctrlcurve.cpp6
-rw-r--r--src/display/sp-ctrlline.cpp6
-rw-r--r--src/display/sp-ctrlquadr.cpp6
41 files changed, 343 insertions, 343 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp
index eae6b0d19..e34e4cd6b 100644
--- a/src/display/cairo-utils.cpp
+++ b/src/display/cairo-utils.cpp
@@ -162,7 +162,7 @@ Pixbuf::Pixbuf(cairo_surface_t *s)
: _pixbuf(gdk_pixbuf_new_from_data(
cairo_image_surface_get_data(s), GDK_COLORSPACE_RGB, TRUE, 8,
cairo_image_surface_get_width(s), cairo_image_surface_get_height(s),
- cairo_image_surface_get_stride(s), NULL, NULL))
+ cairo_image_surface_get_stride(s), nullptr, nullptr))
, _surface(s)
, _mod_time(0)
, _pixel_format(PF_CAIRO)
@@ -174,7 +174,7 @@ Pixbuf::Pixbuf(cairo_surface_t *s)
* so it should not be unrefed. */
Pixbuf::Pixbuf(GdkPixbuf *pb)
: _pixbuf(pb)
- , _surface(0)
+ , _surface(nullptr)
, _mod_time(0)
, _pixel_format(PF_GDK)
, _cairo_store(false)
@@ -209,7 +209,7 @@ Pixbuf::~Pixbuf()
Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data)
{
- Pixbuf *pixbuf = NULL;
+ Pixbuf *pixbuf = nullptr;
bool data_is_image = false;
bool data_is_svg = false;
@@ -271,13 +271,13 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data)
if ((*data) && data_is_image && !data_is_svg && data_is_base64) {
GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
- if (!loader) return NULL;
+ if (!loader) return nullptr;
gsize decoded_len = 0;
guchar *decoded = g_base64_decode(data, &decoded_len);
- if (gdk_pixbuf_loader_write(loader, decoded, decoded_len, NULL)) {
- gdk_pixbuf_loader_close(loader, NULL);
+ if (gdk_pixbuf_loader_write(loader, decoded, decoded_len, nullptr)) {
+ gdk_pixbuf_loader_close(loader, nullptr);
GdkPixbuf *buf = gdk_pixbuf_loader_get_pixbuf(loader);
if (buf) {
g_object_ref(buf);
@@ -301,13 +301,13 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data)
guchar *decoded = g_base64_decode(data, &decoded_len);
SPDocument *svgDoc = SPDocument::createNewDocFromMem (reinterpret_cast<gchar const *>(decoded), decoded_len, false);
// Check the document loaded properly
- if (svgDoc == NULL) {
- return NULL;
+ if (svgDoc == nullptr) {
+ return nullptr;
}
- if (svgDoc->getRoot() == NULL)
+ if (svgDoc->getRoot() == nullptr)
{
svgDoc->doUnref();
- return NULL;
+ return nullptr;
}
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
const double dpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", 96.0);
@@ -321,13 +321,13 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data)
const int scaledSvgWidth = round(svgWidth_px/(96.0/dpi));
const int scaledSvgHeight = round(svgHeight_px/(96.0/dpi));
- GdkPixbuf *buf = sp_generate_internal_bitmap(svgDoc, NULL, 0, 0, svgWidth_px, svgHeight_px, scaledSvgWidth, scaledSvgHeight, dpi, dpi, (guint32) 0xffffff00, NULL)->getPixbufRaw();
+ GdkPixbuf *buf = sp_generate_internal_bitmap(svgDoc, nullptr, 0, 0, svgWidth_px, svgHeight_px, scaledSvgWidth, scaledSvgHeight, dpi, dpi, (guint32) 0xffffff00, nullptr)->getPixbufRaw();
// Tidy up
svgDoc->doUnref();
- if (buf == NULL) {
+ if (buf == nullptr) {
std::cerr << "Pixbuf::create_from_data: failed to load contents: " << std::endl;
g_free(decoded);
- return NULL;
+ return nullptr;
} else {
g_object_ref(buf);
pixbuf = new Pixbuf(buf);
@@ -340,32 +340,32 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data)
Pixbuf *Pixbuf::create_from_file(std::string const &fn)
{
- Pixbuf *pb = NULL;
+ Pixbuf *pb = nullptr;
// test correctness of filename
if (!g_file_test(fn.c_str(), G_FILE_TEST_EXISTS)) {
- return NULL;
+ return nullptr;
}
GStatBuf stdir;
int val = g_stat(fn.c_str(), &stdir);
if (val == 0 && stdir.st_mode & S_IFDIR){
- return NULL;
+ return nullptr;
}
// we need to load the entire file into memory,
// since we'll store it as MIME data
- gchar *data = NULL;
+ gchar *data = nullptr;
gsize len = 0;
- GError *error = NULL;
+ GError *error = nullptr;
if (g_file_get_contents(fn.c_str(), &data, &len, &error)) {
- if (error != NULL) {
+ if (error != nullptr) {
std::cerr << "Pixbuf::create_from_file: " << error->message << std::endl;
std::cerr << " (" << fn << ")" << std::endl;
- return NULL;
+ return nullptr;
}
- GdkPixbuf *buf = NULL;
- GdkPixbufLoader *loader = NULL;
+ GdkPixbuf *buf = nullptr;
+ GdkPixbufLoader *loader = nullptr;
std::string::size_type idx;
idx = fn.rfind('.');
bool is_svg = false;
@@ -374,13 +374,13 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn)
if (boost::iequals(fn.substr(idx+1).c_str(), "svg")) {
SPDocument *svgDoc = SPDocument::createNewDoc(fn.c_str(), TRUE);
// Check the document loaded properly
- if (svgDoc == NULL) {
- return NULL;
+ if (svgDoc == nullptr) {
+ return nullptr;
}
- if (svgDoc->getRoot() == NULL)
+ if (svgDoc->getRoot() == nullptr)
{
svgDoc->doUnref();
- return NULL;
+ return nullptr;
}
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
const double dpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", 96.0);
@@ -394,12 +394,12 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn)
const int scaledSvgWidth = round(svgWidth_px/(96.0/dpi));
const int scaledSvgHeight = round(svgHeight_px/(96.0/dpi));
- buf = sp_generate_internal_bitmap(svgDoc, NULL, 0, 0, svgWidth_px, svgHeight_px, scaledSvgWidth, scaledSvgHeight, dpi, dpi, (guint32) 0xffffff00, NULL)->getPixbufRaw();
+ buf = sp_generate_internal_bitmap(svgDoc, nullptr, 0, 0, svgWidth_px, svgHeight_px, scaledSvgWidth, scaledSvgHeight, dpi, dpi, (guint32) 0xffffff00, nullptr)->getPixbufRaw();
// Tidy up
svgDoc->doUnref();
- if (buf == NULL) {
- return NULL;
+ if (buf == nullptr) {
+ return nullptr;
}
is_svg = true;
}
@@ -407,21 +407,21 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn)
if (!is_svg) {
loader = gdk_pixbuf_loader_new();
gdk_pixbuf_loader_write(loader, (guchar *) data, len, &error);
- if (error != NULL) {
+ if (error != nullptr) {
std::cerr << "Pixbuf::create_from_file: " << error->message << std::endl;
std::cerr << " (" << fn << ")" << std::endl;
g_free(data);
g_object_unref(loader);
- return NULL;
+ return nullptr;
}
gdk_pixbuf_loader_close(loader, &error);
- if (error != NULL) {
+ if (error != nullptr) {
std::cerr << "Pixbuf::create_from_file: " << error->message << std::endl;
std::cerr << " (" << fn << ")" << std::endl;
g_free(data);
g_object_unref(loader);
- return NULL;
+ return nullptr;
}
buf = gdk_pixbuf_loader_get_pixbuf(loader);
@@ -449,7 +449,7 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn)
// from the file. This can be done by using format-specific libraries e.g. libpng.
} else {
std::cerr << "Pixbuf::create_from_file: failed to get contents: " << fn << std::endl;
- return NULL;
+ return nullptr;
}
return pb;
@@ -512,15 +512,15 @@ Cairo::RefPtr<Cairo::Surface> Pixbuf::getSurface(bool convert_format)
guchar const *Pixbuf::getMimeData(gsize &len, std::string &mimetype) const
{
static gchar const *mimetypes[] = {
- CAIRO_MIME_TYPE_JPEG, CAIRO_MIME_TYPE_JP2, CAIRO_MIME_TYPE_PNG, NULL };
+ CAIRO_MIME_TYPE_JPEG, CAIRO_MIME_TYPE_JP2, CAIRO_MIME_TYPE_PNG, nullptr };
static guint mimetypes_len = g_strv_length(const_cast<gchar**>(mimetypes));
- guchar const *data = NULL;
+ guchar const *data = nullptr;
for (guint i = 0; i < mimetypes_len; ++i) {
unsigned long len_long = 0;
cairo_surface_get_mime_data(const_cast<cairo_surface_t*>(_surface), mimetypes[i], &data, &len_long);
- if (data != NULL) {
+ if (data != nullptr) {
len = len_long;
mimetype = mimetypes[i];
break;
@@ -560,7 +560,7 @@ void Pixbuf::_forceAlpha()
void Pixbuf::_setMimeData(guchar *data, gsize len, Glib::ustring const &format)
{
- gchar const *mimetype = NULL;
+ gchar const *mimetype = nullptr;
if (format == "jpeg") {
mimetype = CAIRO_MIME_TYPE_JPEG;
@@ -570,7 +570,7 @@ void Pixbuf::_setMimeData(guchar *data, gsize len, Glib::ustring const &format)
mimetype = CAIRO_MIME_TYPE_PNG;
}
- if (mimetype != NULL) {
+ if (mimetype != nullptr) {
cairo_surface_set_mime_data(_surface, mimetype, data, len, g_free, data);
//g_message("Setting Cairo MIME data: %s", mimetype);
} else {
@@ -837,7 +837,7 @@ feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv)
SPColorInterpolation
get_cairo_surface_ci(cairo_surface_t *surface) {
void* data = cairo_surface_get_user_data( surface, &ink_color_interpolation_key );
- if( data != NULL ) {
+ if( data != nullptr ) {
return (SPColorInterpolation)GPOINTER_TO_INT( data );
} else {
return SP_CSS_COLOR_INTERPOLATION_AUTO;
@@ -862,13 +862,13 @@ set_cairo_surface_ci(cairo_surface_t *surface, SPColorInterpolation ci) {
ink_cairo_surface_linear_to_srgb( surface );
}
- cairo_surface_set_user_data(surface, &ink_color_interpolation_key, GINT_TO_POINTER (ci), NULL);
+ cairo_surface_set_user_data(surface, &ink_color_interpolation_key, GINT_TO_POINTER (ci), nullptr);
}
}
void
copy_cairo_surface_ci(cairo_surface_t *in, cairo_surface_t *out) {
- cairo_surface_set_user_data(out, &ink_color_interpolation_key, cairo_surface_get_user_data(in, &ink_color_interpolation_key), NULL);
+ cairo_surface_set_user_data(out, &ink_color_interpolation_key, cairo_surface_get_user_data(in, &ink_color_interpolation_key), nullptr);
}
void
@@ -957,7 +957,7 @@ cairo_surface_t *
ink_cairo_surface_create_identical(cairo_surface_t *s)
{
cairo_surface_t *ns = ink_cairo_surface_create_same_size(s, cairo_surface_get_content(s));
- cairo_surface_set_user_data(ns, &ink_color_interpolation_key, cairo_surface_get_user_data(s, &ink_color_interpolation_key), NULL);
+ cairo_surface_set_user_data(ns, &ink_color_interpolation_key, cairo_surface_get_user_data(s, &ink_color_interpolation_key), nullptr);
return ns;
}
@@ -1004,7 +1004,7 @@ ink_cairo_surface_create_output(cairo_surface_t *image, cairo_surface_t *bg)
{
cairo_content_t imgt = cairo_surface_get_content(image);
cairo_content_t bgt = cairo_surface_get_content(bg);
- cairo_surface_t *out = NULL;
+ cairo_surface_t *out = nullptr;
if (bgt == CAIRO_CONTENT_ALPHA && imgt == CAIRO_CONTENT_ALPHA) {
out = ink_cairo_surface_create_identical(bg);
@@ -1416,7 +1416,7 @@ void
ink_pixbuf_ensure_argb32(GdkPixbuf *pb)
{
gchar *pixel_format = reinterpret_cast<gchar*>(g_object_get_data(G_OBJECT(pb), "pixel_format"));
- if (pixel_format != NULL && strcmp(pixel_format, "argb32") == 0) {
+ if (pixel_format != nullptr && strcmp(pixel_format, "argb32") == 0) {
// nothing to do
return;
}
@@ -1437,7 +1437,7 @@ void
ink_pixbuf_ensure_normal(GdkPixbuf *pb)
{
gchar *pixel_format = reinterpret_cast<gchar*>(g_object_get_data(G_OBJECT(pb), "pixel_format"));
- if (pixel_format == NULL || strcmp(pixel_format, "pixbuf") == 0) {
+ if (pixel_format == nullptr || strcmp(pixel_format, "pixbuf") == 0) {
// nothing to do
return;
}
diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp
index 8271a6ad9..72415d82d 100644
--- a/src/display/canvas-arena.cpp
+++ b/src/display/canvas-arena.cpp
@@ -78,7 +78,7 @@ sp_canvas_arena_class_init (SPCanvasArenaClass *klass)
G_TYPE_FROM_CLASS(item_class),
G_SIGNAL_RUN_LAST,
((glong)((guint8*)&(klass->arena_event) - (guint8*)klass)),
- NULL, NULL,
+ nullptr, nullptr,
sp_marshal_INT__POINTER_POINTER,
G_TYPE_INT, 2, G_TYPE_POINTER, G_TYPE_POINTER);
@@ -116,7 +116,7 @@ sp_canvas_arena_init (SPCanvasArena *arena)
sigc::ptr_fun(&sp_canvas_arena_item_deleted),
arena));
- arena->active = NULL;
+ arena->active = nullptr;
}
static void sp_canvas_arena_destroy(SPCanvasItem *object)
@@ -180,7 +180,7 @@ static void
sp_canvas_arena_item_deleted(SPCanvasArena *arena, Inkscape::DrawingItem *item)
{
if (arena->active == item) {
- arena->active = NULL;
+ arena->active = nullptr;
}
}
@@ -260,7 +260,7 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event)
case GDK_LEAVE_NOTIFY:
if (arena->cursor) {
ret = sp_canvas_arena_send_event (arena, event);
- arena->active = NULL;
+ arena->active = nullptr;
arena->cursor = FALSE;
}
break;
@@ -342,7 +342,7 @@ static void sp_canvas_arena_request_render(SPCanvasArena *ca, Geom::IntRect cons
void
sp_canvas_arena_set_pick_delta (SPCanvasArena *ca, gdouble delta)
{
- g_return_if_fail (ca != NULL);
+ g_return_if_fail (ca != nullptr);
g_return_if_fail (SP_IS_CANVAS_ARENA (ca));
/* fixme: repick? */
@@ -352,7 +352,7 @@ sp_canvas_arena_set_pick_delta (SPCanvasArena *ca, gdouble delta)
void
sp_canvas_arena_set_sticky (SPCanvasArena *ca, gboolean sticky)
{
- g_return_if_fail (ca != NULL);
+ g_return_if_fail (ca != nullptr);
g_return_if_fail (SP_IS_CANVAS_ARENA (ca));
/* fixme: repick? */
@@ -362,7 +362,7 @@ sp_canvas_arena_set_sticky (SPCanvasArena *ca, gboolean sticky)
void
sp_canvas_arena_render_surface (SPCanvasArena *ca, cairo_surface_t *surface, Geom::IntRect const &r)
{
- g_return_if_fail (ca != NULL);
+ g_return_if_fail (ca != nullptr);
g_return_if_fail (SP_IS_CANVAS_ARENA (ca));
Inkscape::DrawingContext dc(surface, r.min());
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp
index 66231b7dd..8d9cb7d0a 100644
--- a/src/display/canvas-axonomgrid.cpp
+++ b/src/display/canvas-axonomgrid.cpp
@@ -191,7 +191,7 @@ CanvasAxonomGrid::readRepr()
}
if ( (value = repr->attribute("gridanglex")) ) {
- angle_deg[X] = g_ascii_strtod(value, NULL);
+ angle_deg[X] = g_ascii_strtod(value, nullptr);
if (angle_deg[X] < 0.) angle_deg[X] = 0.;
if (angle_deg[X] > 89.0) angle_deg[X] = 89.0;
angle_rad[X] = Geom::rad_from_deg(angle_deg[X]);
@@ -199,7 +199,7 @@ CanvasAxonomGrid::readRepr()
}
if ( (value = repr->attribute("gridanglez")) ) {
- angle_deg[Z] = g_ascii_strtod(value, NULL);
+ angle_deg[Z] = g_ascii_strtod(value, nullptr);
if (angle_deg[Z] < 0.) angle_deg[Z] = 0.;
if (angle_deg[Z] > 89.0) angle_deg[Z] = 89.0;
angle_rad[Z] = Geom::rad_from_deg(angle_deg[Z]);
@@ -230,12 +230,12 @@ CanvasAxonomGrid::readRepr()
}
if ( (value = repr->attribute("enabled")) ) {
- g_assert(snapper != NULL);
+ g_assert(snapper != nullptr);
snapper->setEnabled(strcmp(value,"false") != 0 && strcmp(value, "0") != 0);
}
if ( (value = repr->attribute("snapvisiblegridlinesonly")) ) {
- g_assert(snapper != NULL);
+ g_assert(snapper != nullptr);
snapper->setSnapVisibleOnly(strcmp(value,"false") != 0 && strcmp(value, "0") != 0);
}
@@ -358,7 +358,7 @@ CanvasAxonomGrid::updateWidgets()
_wr.setUpdating (true);
_rcb_visible->setActive(visible);
- if (snapper != NULL) {
+ if (snapper != nullptr) {
_rcb_enabled->setActive(snapper->getEnabled());
_rcb_snap_visible_only->setActive(snapper->getSnapVisibleOnly());
}
@@ -590,7 +590,7 @@ CanvasAxonomGridSnapper::_getSnapLines(Geom::Point const &p) const
{
LineList s;
- if ( grid == NULL ) {
+ if ( grid == nullptr ) {
return s;
}
diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp
index fc6b79b43..35f46e2ae 100644
--- a/src/display/canvas-bpath.cpp
+++ b/src/display/canvas-bpath.cpp
@@ -172,7 +172,7 @@ sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_
Geom::Rect viewbox = item->canvas->getViewbox();
viewbox.expandBy (width);
double dist = Geom::infinity();
- pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), cbp->affine, p, NULL, NULL, &dist, 0.5, &viewbox);
+ pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), cbp->affine, p, nullptr, nullptr, &dist, 0.5, &viewbox);
if (dist <= 1.0) {
*actual_item = item;
@@ -184,10 +184,10 @@ sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_
SPCanvasItem *
sp_canvas_bpath_new (SPCanvasGroup *parent, SPCurve *curve, bool phantom_line)
{
- g_return_val_if_fail (parent != NULL, NULL);
+ g_return_val_if_fail (parent != nullptr, NULL);
g_return_val_if_fail (SP_IS_CANVAS_GROUP (parent), NULL);
- SPCanvasItem *item = sp_canvas_item_new (parent, SP_TYPE_CANVAS_BPATH, NULL);
+ SPCanvasItem *item = sp_canvas_item_new (parent, SP_TYPE_CANVAS_BPATH, nullptr);
sp_canvas_bpath_set_bpath (SP_CANVAS_BPATH (item), curve, phantom_line);
@@ -197,7 +197,7 @@ sp_canvas_bpath_new (SPCanvasGroup *parent, SPCurve *curve, bool phantom_line)
void
sp_canvas_bpath_set_bpath (SPCanvasBPath *cbp, SPCurve *curve, bool phantom_line)
{
- g_return_if_fail (cbp != NULL);
+ g_return_if_fail (cbp != nullptr);
g_return_if_fail (SP_IS_CANVAS_BPATH (cbp));
cbp->phantom_line = phantom_line;
@@ -215,7 +215,7 @@ sp_canvas_bpath_set_bpath (SPCanvasBPath *cbp, SPCurve *curve, bool phantom_line
void
sp_canvas_bpath_set_fill (SPCanvasBPath *cbp, guint32 rgba, SPWindRule rule)
{
- g_return_if_fail (cbp != NULL);
+ g_return_if_fail (cbp != nullptr);
g_return_if_fail (SP_IS_CANVAS_BPATH (cbp));
cbp->fill_rgba = rgba;
@@ -227,7 +227,7 @@ sp_canvas_bpath_set_fill (SPCanvasBPath *cbp, guint32 rgba, SPWindRule rule)
void
sp_canvas_bpath_set_stroke (SPCanvasBPath *cbp, guint32 rgba, gdouble width, SPStrokeJoinType join, SPStrokeCapType cap, double dash, double gap)
{
- g_return_if_fail (cbp != NULL);
+ g_return_if_fail (cbp != nullptr);
g_return_if_fail (SP_IS_CANVAS_BPATH (cbp));
cbp->stroke_rgba = rgba;
diff --git a/src/display/canvas-debug.cpp b/src/display/canvas-debug.cpp
index 00a4f3fee..a4ca19673 100644
--- a/src/display/canvas-debug.cpp
+++ b/src/display/canvas-debug.cpp
@@ -41,7 +41,7 @@ static void sp_canvas_debug_init (SPCanvasDebug *debug)
namespace {
static void sp_canvas_debug_destroy (SPCanvasItem *object)
{
- g_return_if_fail (object != NULL);
+ g_return_if_fail (object != nullptr);
g_return_if_fail (SP_IS_CANVAS_DEBUG (object));
if (SP_CANVAS_ITEM_CLASS(sp_canvas_debug_parent_class)->destroy) {
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 6d646f39d..42769e1b1 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -81,12 +81,12 @@ static void grid_canvasitem_class_init(GridCanvasItemClass *klass)
static void
grid_canvasitem_init (GridCanvasItem *griditem)
{
- griditem->grid = NULL;
+ griditem->grid = nullptr;
}
static void grid_canvasitem_destroy(SPCanvasItem *object)
{
- g_return_if_fail (object != NULL);
+ g_return_if_fail (object != nullptr);
g_return_if_fail (INKSCAPE_IS_GRID_CANVASITEM (object));
if (SP_CANVAS_ITEM_CLASS(grid_canvasitem_parent_class)->destroy)
@@ -131,11 +131,11 @@ grid_canvasitem_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned
// CanvasGrid
static Inkscape::XML::NodeEventVector const _repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
+ nullptr, /* child_added */
+ nullptr, /* child_removed */
CanvasGrid::on_repr_attr_changed,
- NULL, /* content_changed */
- NULL /* order_changed */
+ nullptr, /* content_changed */
+ nullptr /* order_changed */
};
CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type)
@@ -244,10 +244,10 @@ CanvasGrid::writeNewGridToRepr(Inkscape::XML::Node * repr, SPDocument * doc, Gri
CanvasGrid*
CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument * doc, GridType gridtype)
{
- if (!repr) return NULL;
+ if (!repr) return nullptr;
if (!doc) {
g_error("CanvasGrid::NewGrid - doc==NULL");
- return NULL;
+ return nullptr;
}
switch (gridtype) {
@@ -257,7 +257,7 @@ CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument * d
return dynamic_cast<CanvasGrid*>(new CanvasAxonomGrid(nv, repr, doc));
}
- return NULL;
+ return nullptr;
}
@@ -267,18 +267,18 @@ CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument * d
GridCanvasItem *
CanvasGrid::createCanvasItem(SPDesktop * desktop)
{
- if (!desktop) return NULL;
+ if (!desktop) return nullptr;
// Johan: I think for multiple desktops it is best if each has their own canvasitem,
// but share the same CanvasGrid object; that is what this function is for.
// check if there is already a canvasitem on this desktop linking to this grid
for (auto i:canvasitems) {
if ( desktop->getGridGroup() == SP_CANVAS_GROUP(i->parent) ) {
- return NULL;
+ return nullptr;
}
}
- GridCanvasItem * item = INKSCAPE_GRID_CANVASITEM( sp_canvas_item_new(desktop->getGridGroup(), INKSCAPE_TYPE_GRID_CANVASITEM, NULL) );
+ GridCanvasItem * item = INKSCAPE_GRID_CANVASITEM( sp_canvas_item_new(desktop->getGridGroup(), INKSCAPE_TYPE_GRID_CANVASITEM, nullptr) );
item->grid = this;
sp_canvas_item_show(SP_CANVAS_ITEM(item));
@@ -340,7 +340,7 @@ CanvasGrid::newWidget()
// set widget values
_wr.setUpdating (true);
_rcb_visible->setActive(visible);
- if (snapper != NULL) {
+ if (snapper != nullptr) {
_rcb_enabled->setActive(snapper->getEnabled());
_rcb_snap_visible_only->setActive(snapper->getSnapVisibleOnly());
}
@@ -359,7 +359,7 @@ CanvasGrid::on_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gc
bool CanvasGrid::isEnabled() const
{
- if (snapper == NULL) {
+ if (snapper == nullptr) {
return false;
}
@@ -454,7 +454,7 @@ static void validateInt(gint oldVal,
gint* pTarget)
{
// Avoid nullness.
- if ( pTarget == NULL )
+ if ( pTarget == nullptr )
return;
// Invalid new value?
@@ -600,12 +600,12 @@ CanvasXYGrid::readRepr()
}
if ( (value = repr->attribute("enabled")) ) {
- g_assert(snapper != NULL);
+ g_assert(snapper != nullptr);
snapper->setEnabled(strcmp(value,"false") != 0 && strcmp(value, "0") != 0);
}
if ( (value = repr->attribute("snapvisiblegridlinesonly")) ) {
- g_assert(snapper != NULL);
+ g_assert(snapper != nullptr);
snapper->setSnapVisibleOnly(strcmp(value,"false") != 0 && strcmp(value, "0") != 0);
}
@@ -735,7 +735,7 @@ CanvasXYGrid::updateWidgets()
_wr.setUpdating (true);
_rcb_visible->setActive(visible);
- if (snapper != NULL) {
+ if (snapper != nullptr) {
_rcb_enabled->setActive(snapper->getEnabled());
_rcb_snap_visible_only->setActive(snapper->getSnapVisibleOnly());
}
@@ -1022,7 +1022,7 @@ CanvasXYGridSnapper::_getSnapLines(Geom::Point const &p) const
{
LineList s;
- if ( grid == NULL ) {
+ if ( grid == nullptr ) {
return s;
}
diff --git a/src/display/canvas-rotate.cpp b/src/display/canvas-rotate.cpp
index 1d917a677..61728ca50 100644
--- a/src/display/canvas-rotate.cpp
+++ b/src/display/canvas-rotate.cpp
@@ -48,14 +48,14 @@ static void sp_canvas_rotate_init (SPCanvasRotate *rotate)
rotate->pickable = true; // So we can receive events.
rotate->angle = 0.0;
rotate->start_angle = -1000;
- rotate->surface_copy = NULL;
- rotate->surface_rotated = NULL;
+ rotate->surface_copy = nullptr;
+ rotate->surface_rotated = nullptr;
}
namespace {
static void sp_canvas_rotate_destroy (SPCanvasItem *object)
{
- g_return_if_fail (object != NULL);
+ g_return_if_fail (object != nullptr);
g_return_if_fail (SP_IS_CANVAS_ROTATE (object));
if (SP_CANVAS_ITEM_CLASS(sp_canvas_rotate_parent_class)->destroy) {
@@ -68,15 +68,15 @@ static void sp_canvas_rotate_update( SPCanvasItem *item, Geom::Affine const &/*a
{
SPCanvasRotate *cr = SP_CANVAS_ROTATE(item);
- if (cr->surface_copy == NULL) {
+ if (cr->surface_copy == nullptr) {
// std::cout << "sp_canvas_rotate_update: surface_copy is NULL" << std::endl;
return;
}
// Destroy surface_rotated if it already exists.
- if (cr->surface_rotated != NULL) {
+ if (cr->surface_rotated != nullptr) {
cairo_surface_destroy (cr->surface_rotated);
- cr->surface_rotated = NULL;
+ cr->surface_rotated = nullptr;
}
// Create rotated surface
@@ -114,7 +114,7 @@ static void sp_canvas_rotate_render( SPCanvasItem *item, SPCanvasBuf *buf)
return;
}
- if (cr->surface_rotated == NULL ) {
+ if (cr->surface_rotated == nullptr ) {
// std::cout << " surface_rotated is NULL" << std::endl;
return;
}
@@ -206,13 +206,13 @@ static int sp_canvas_rotate_event (SPCanvasItem *item, GdkEvent *event)
sp_canvas_item_hide (item);
cr->start_angle = -1000;
- if (cr->surface_copy != NULL) {
+ if (cr->surface_copy != nullptr) {
cairo_surface_destroy( cr->surface_copy );
- cr->surface_copy = NULL;
+ cr->surface_copy = nullptr;
}
- if (cr->surface_rotated != NULL) {
+ if (cr->surface_rotated != nullptr) {
cairo_surface_destroy( cr->surface_rotated );
- cr->surface_rotated = NULL;
+ cr->surface_rotated = nullptr;
}
// sp_canvas_item_show (desktop->drawing);
@@ -237,7 +237,7 @@ static int sp_canvas_rotate_event (SPCanvasItem *item, GdkEvent *event)
void sp_canvas_rotate_start (SPCanvasRotate *canvas_rotate, cairo_surface_t *background)
{
- if (background == NULL) {
+ if (background == nullptr) {
std::cerr << "sp_canvas_rotate_start: background is NULL!" << std::endl;
return;
}
@@ -254,7 +254,7 @@ void sp_canvas_rotate_start (SPCanvasRotate *canvas_rotate, cairo_surface_t *bac
// Paint the canvas ourselves for speed....
void sp_canvas_rotate_paint (SPCanvasRotate *canvas_rotate, cairo_surface_t *background)
{
- if (background == NULL) {
+ if (background == nullptr) {
std::cerr << "sp_canvas_rotate_paint: background is NULL!" << std::endl;
return;
}
diff --git a/src/display/canvas-text.cpp b/src/display/canvas-text.cpp
index 4117825e3..9df002f7f 100644
--- a/src/display/canvas-text.cpp
+++ b/src/display/canvas-text.cpp
@@ -52,9 +52,9 @@ sp_canvastext_init (SPCanvasText *canvastext)
canvastext->s[Geom::X] = canvastext->s[Geom::Y] = 0.0;
canvastext->affine = Geom::identity();
canvastext->fontsize = 10.0;
- canvastext->item = NULL;
- canvastext->desktop = NULL;
- canvastext->text = NULL;
+ canvastext->item = nullptr;
+ canvastext->desktop = nullptr;
+ canvastext->text = nullptr;
canvastext->outline = false;
canvastext->background = false;
canvastext->border = 3; // must be a constant, and not proportional to any width, height, or fontsize to allow alignment with other text boxes
@@ -62,14 +62,14 @@ sp_canvastext_init (SPCanvasText *canvastext)
static void sp_canvastext_destroy(SPCanvasItem *object)
{
- g_return_if_fail (object != NULL);
+ g_return_if_fail (object != nullptr);
g_return_if_fail (SP_IS_CANVASTEXT (object));
SPCanvasText *canvastext = SP_CANVASTEXT (object);
g_free(canvastext->text);
- canvastext->text = NULL;
- canvastext->item = NULL;
+ canvastext->text = nullptr;
+ canvastext->item = nullptr;
if (SP_CANVAS_ITEM_CLASS(sp_canvastext_parent_class)->destroy)
SP_CANVAS_ITEM_CLASS(sp_canvastext_parent_class)->destroy(object);
@@ -227,7 +227,7 @@ SPCanvasText *sp_canvastext_new(SPCanvasGroup *parent, SPDesktop *desktop, Geom:
{
// Pos specifies the position of the anchor, which is at the bounding box of the text itself (i.e. not at the border of the filled background rectangle)
// The relative position of the anchor can be set using e.g. anchor_position = TEXT_ANCHOR_LEFT
- SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_CANVASTEXT, NULL);
+ SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_CANVASTEXT, nullptr);
SPCanvasText *ct = SP_CANVASTEXT(item);
@@ -244,7 +244,7 @@ SPCanvasText *sp_canvastext_new(SPCanvasGroup *parent, SPDesktop *desktop, Geom:
void
sp_canvastext_set_rgba32 (SPCanvasText *ct, guint32 rgba, guint32 rgba_stroke)
{
- g_return_if_fail (ct != NULL);
+ g_return_if_fail (ct != nullptr);
g_return_if_fail (SP_IS_CANVASTEXT (ct));
if (rgba != ct->rgba || rgba_stroke != ct->rgba_stroke) {
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 1115978e9..e424fee05 100644
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
@@ -127,7 +127,7 @@ SPCurve::unref()
delete this;
}
- return NULL;
+ return nullptr;
}
/**
@@ -341,7 +341,7 @@ SPCurve::is_closed() const
bool
SPCurve::is_equal(SPCurve * other) const
{
- if(other == NULL) {
+ if(other == nullptr) {
return false;
} else if(_pathv == other->get_pathvector()){
return true;
@@ -357,10 +357,10 @@ Geom::Curve const *
SPCurve::last_segment() const
{
if (is_empty()) {
- return NULL;
+ return nullptr;
}
if (_pathv.back().empty()) {
- return NULL;
+ return nullptr;
}
return &_pathv.back().back_default();
@@ -373,7 +373,7 @@ Geom::Path const *
SPCurve::last_path() const
{
if (is_empty()) {
- return NULL;
+ return nullptr;
}
return &_pathv.back();
@@ -387,10 +387,10 @@ Geom::Curve const *
SPCurve::first_segment() const
{
if (is_empty()) {
- return NULL;
+ return nullptr;
}
if (_pathv.front().empty()) {
- return NULL;
+ return nullptr;
}
return &_pathv.front().front();
@@ -403,7 +403,7 @@ Geom::Path const *
SPCurve::first_path() const
{
if (is_empty()) {
- return NULL;
+ return nullptr;
}
return &_pathv.front();
@@ -545,9 +545,9 @@ SPCurve::append_continuous(SPCurve const *c1, double tolerance)
using Geom::X;
using Geom::Y;
- g_return_val_if_fail(c1 != NULL, NULL);
+ g_return_val_if_fail(c1 != nullptr, NULL);
if ( this->is_closed() || c1->is_closed() ) {
- return NULL;
+ return nullptr;
}
if (c1->is_empty()) {
diff --git a/src/display/drawing-context.cpp b/src/display/drawing-context.cpp
index ffd60ef9f..16263b607 100644
--- a/src/display/drawing-context.cpp
+++ b/src/display/drawing-context.cpp
@@ -24,7 +24,7 @@ using Geom::Y;
*/
DrawingContext::Save::Save()
- : _dc(NULL)
+ : _dc(nullptr)
{}
DrawingContext::Save::Save(DrawingContext &dc)
: _dc(&dc)
@@ -70,7 +70,7 @@ DrawingContext::DrawingContext(cairo_t *ct, Geom::Point const &origin)
}
DrawingContext::DrawingContext(cairo_surface_t *surface, Geom::Point const &origin)
- : _ct(NULL)
+ : _ct(nullptr)
, _surface(new DrawingSurface(surface, origin))
, _delete_surface(true)
, _restore_context(false)
diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp
index 6abce34a2..22a6c42ed 100644
--- a/src/display/drawing-group.cpp
+++ b/src/display/drawing-group.cpp
@@ -18,7 +18,7 @@ namespace Inkscape {
DrawingGroup::DrawingGroup(Drawing &drawing)
: DrawingItem(drawing)
- , _child_transform(NULL)
+ , _child_transform(nullptr)
{}
DrawingGroup::~DrawingGroup()
@@ -54,7 +54,7 @@ DrawingGroup::setChildTransform(Geom::Affine const &new_trans)
_markForRendering();
if (new_trans.isIdentity()) {
delete _child_transform; // delete NULL; is safe
- _child_transform = NULL;
+ _child_transform = nullptr;
} else {
_child_transform = new Geom::Affine(new_trans);
}
@@ -89,7 +89,7 @@ DrawingGroup::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, u
unsigned
DrawingGroup::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at)
{
- if (stop_at == NULL) {
+ if (stop_at == nullptr) {
// normal rendering
for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) {
i->setAntialiasing(_antialias);
@@ -131,7 +131,7 @@ DrawingGroup::_pickItem(Geom::Point const &p, double delta, unsigned flags)
return _pick_children ? picked : this;
}
}
- return NULL;
+ return nullptr;
}
bool
@@ -142,7 +142,7 @@ DrawingGroup::_canClip()
bool is_drawing_group(DrawingItem *item)
{
- return dynamic_cast<DrawingGroup *>(item) != NULL;
+ return dynamic_cast<DrawingGroup *>(item) != nullptr;
}
} // end namespace Inkscape
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;
}
}
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp
index cc4673bc8..4f2f50ddd 100644
--- a/src/display/drawing-item.cpp
+++ b/src/display/drawing-item.cpp
@@ -107,19 +107,19 @@ void set_cairo_blend_operator( DrawingContext &dc, unsigned blend_mode ) {
DrawingItem::DrawingItem(Drawing &drawing)
: _drawing(drawing)
- , _parent(NULL)
+ , _parent(nullptr)
, _key(0)
- , _style(NULL)
- , _context_style(NULL)
+ , _style(nullptr)
+ , _context_style(nullptr)
, _opacity(1.0)
- , _transform(NULL)
- , _clip(NULL)
- , _mask(NULL)
- , _fill_pattern(NULL)
- , _stroke_pattern(NULL)
- , _filter(NULL)
- , _user_data(NULL)
- , _cache(NULL)
+ , _transform(nullptr)
+ , _clip(nullptr)
+ , _mask(nullptr)
+ , _fill_pattern(nullptr)
+ , _stroke_pattern(nullptr)
+ , _filter(nullptr)
+ , _user_data(nullptr)
+ , _cache(nullptr)
, _state(0)
, _child_type(CHILD_ORPHAN)
, _background_new(0)
@@ -163,19 +163,19 @@ DrawingItem::~DrawingItem()
case CHILD_CLIP:
// we cannot call setClip(NULL) or setMask(NULL),
// because that would be an endless loop
- _parent->_clip = NULL;
+ _parent->_clip = nullptr;
break;
case CHILD_MASK:
- _parent->_mask = NULL;
+ _parent->_mask = nullptr;
break;
case CHILD_ROOT:
- _drawing._root = NULL;
+ _drawing._root = nullptr;
break;
case CHILD_FILL_PATTERN:
- _parent->_fill_pattern = NULL;
+ _parent->_fill_pattern = nullptr;
break;
case CHILD_STROKE_PATTERN:
- _parent->_stroke_pattern = NULL;
+ _parent->_stroke_pattern = nullptr;
break;
default: ;
}
@@ -273,7 +273,7 @@ DrawingItem::setTransform(Geom::Affine const &new_trans)
_markForRendering();
if (new_trans.isIdentity()) {
delete _transform; // delete NULL; is safe
- _transform = NULL;
+ _transform = nullptr;
} else {
_transform = new Geom::Affine(new_trans);
}
@@ -351,7 +351,7 @@ DrawingItem::setCached(bool cached, bool persistent)
} else {
_drawing._cached_items.erase(this);
delete _cache;
- _cache = NULL;
+ _cache = nullptr;
}
}
@@ -381,7 +381,7 @@ DrawingItem::setStyle(SPStyle *style, SPStyle *context_style)
} else {
// no filter set for this group
delete _filter;
- _filter = NULL;
+ _filter = nullptr;
}
if (style && style->enable_background.set) {
@@ -394,9 +394,9 @@ DrawingItem::setStyle(SPStyle *style, SPStyle *context_style)
}
}
- if (context_style != NULL) {
+ if (context_style != nullptr) {
_context_style = context_style;
- } else if (_parent != NULL) {
+ } else if (_parent != nullptr) {
_context_style = _parent->_context_style;
}
@@ -633,7 +633,7 @@ DrawingItem::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigne
// The opposite transition (invisible -> visible or object
// entering the canvas) is handled during the render phase
delete _cache;
- _cache = NULL;
+ _cache = nullptr;
}
}
}
@@ -748,11 +748,11 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag
bool needs_opacity = (_opacity < 0.995);
// this item needs an intermediate rendering if:
- nir |= (_clip != NULL); // 1. it has a clipping path
- nir |= (_mask != NULL); // 2. it has a mask
- nir |= (_filter != NULL && render_filters); // 3. it has a filter
+ nir |= (_clip != nullptr); // 1. it has a clipping path
+ nir |= (_mask != nullptr); // 2. it has a mask
+ nir |= (_filter != nullptr && render_filters); // 3. it has a filter
nir |= needs_opacity; // 4. it is non-opaque
- nir |= (_cache != NULL); // 5. it is cached
+ nir |= (_cache != nullptr); // 5. it is cached
nir |= (_mix_blend_mode != SP_CSS_BLEND_NORMAL); // 6. Blend mode not normal
nir |= (_isolation == SP_CSS_ISOLATION_ISOLATE); // 7. Explicit isolatiom
@@ -843,7 +843,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag
}
}
if (!rendered) {
- _filter->render(this, ict, NULL);
+ _filter->render(this, ict, nullptr);
}
// Note that because the object was rendered to a group,
// the internals of the filter need to use cairo_get_group_target()
@@ -884,7 +884,7 @@ DrawingItem::_renderOutline(DrawingContext &dc, Geom::IntRect const &area, unsig
// just render everything: item, clip, mask
// First, render the object itself
- _renderItem(dc, *carea, flags, NULL);
+ _renderItem(dc, *carea, flags, nullptr);
// render clip and mask, if any
guint32 saved_rgba = _drawing.outlinecolor; // save current outline color
@@ -957,11 +957,11 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags)
if (!(_state & STATE_BBOX) || !(_state & STATE_PICK)) {
g_warning("Invalid state when picking: STATE_BBOX = %d, STATE_PICK = %d",
_state & STATE_BBOX, _state & STATE_PICK);
- return NULL;
+ return nullptr;
}
// ignore invisible and insensitive items unless sticky
if (!(flags & PICK_STICKY) && !(_visible && _sensitive))
- return NULL;
+ return nullptr;
bool outline = _drawing.outline();
@@ -969,18 +969,18 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags)
// pick inside clipping path; if NULL, it means the object is clipped away there
if (_clip) {
DrawingItem *cpick = _clip->pick(p, delta, flags | PICK_AS_CLIP);
- if (!cpick) return NULL;
+ if (!cpick) return nullptr;
}
// same for mask
if (_mask) {
DrawingItem *mpick = _mask->pick(p, delta, flags);
- if (!mpick) return NULL;
+ if (!mpick) return nullptr;
}
}
Geom::OptIntRect box = (outline || (flags & PICK_AS_CLIP)) ? _bbox : _drawbox;
if (!box) {
- return NULL;
+ return nullptr;
}
Geom::Rect expanded = *box;
@@ -989,7 +989,7 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags)
if (expanded.contains(p)) {
return _pickItem(p, delta, flags);
}
- return NULL;
+ return nullptr;
}
// For debugging
@@ -1042,7 +1042,7 @@ DrawingItem::_markForRendering()
if (!dirty) return;
// dirty the caches of all parents
- DrawingItem *bkg_root = NULL;
+ DrawingItem *bkg_root = nullptr;
for (DrawingItem *i = this; i; i = i->_parent) {
if (i != this && i->_filter) {
diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h
index 43015c263..b688b467c 100644
--- a/src/display/drawing-item.h
+++ b/src/display/drawing-item.h
@@ -112,7 +112,7 @@ public:
bool cached() const { return _cached; }
void setCached(bool c, bool persistent = false);
- virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL);
+ virtual void setStyle(SPStyle *style, SPStyle *context_style = nullptr);
virtual void setChildrenStyle(SPStyle *context_style);
void setOpacity(float opacity);
void setAntialiasing(unsigned a);
@@ -133,7 +133,7 @@ public:
void *data() const { return _user_data; }
void update(Geom::IntRect const &area = Geom::IntRect::infinite(), UpdateContext const &ctx = UpdateContext(), unsigned flags = STATE_ALL, unsigned reset = 0);
- unsigned render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0, DrawingItem *stop_at = NULL);
+ unsigned render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0, DrawingItem *stop_at = nullptr);
void clip(DrawingContext &dc, Geom::IntRect const &area);
DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags = 0);
@@ -165,7 +165,7 @@ protected:
virtual unsigned _renderItem(DrawingContext &/*dc*/, Geom::IntRect const &/*area*/, unsigned /*flags*/,
DrawingItem * /*stop_at*/) { return RENDER_OK; }
virtual void _clipItem(DrawingContext &/*dc*/, Geom::IntRect const &/*area*/) {}
- virtual DrawingItem *_pickItem(Geom::Point const &/*p*/, double /*delta*/, unsigned /*flags*/) { return NULL; }
+ virtual DrawingItem *_pickItem(Geom::Point const &/*p*/, double /*delta*/, unsigned /*flags*/) { return nullptr; }
virtual bool _canClip() { return false; }
// member variables start here
diff --git a/src/display/drawing-pattern.cpp b/src/display/drawing-pattern.cpp
index b590a59c5..2cb86440e 100644
--- a/src/display/drawing-pattern.cpp
+++ b/src/display/drawing-pattern.cpp
@@ -18,7 +18,7 @@ namespace Inkscape {
DrawingPattern::DrawingPattern(Drawing &drawing, bool debug)
: DrawingGroup(drawing)
- , _pattern_to_user(NULL)
+ , _pattern_to_user(nullptr)
, _overflow_steps(1)
, _debug(debug)
{
@@ -41,7 +41,7 @@ DrawingPattern::setPatternToUserTransform(Geom::Affine const &new_trans) {
_markForRendering();
if (new_trans.isIdentity()) {
delete _pattern_to_user; // delete NULL; is safe
- _pattern_to_user = NULL;
+ _pattern_to_user = nullptr;
} else {
_pattern_to_user = new Geom::Affine(new_trans);
}
@@ -67,11 +67,11 @@ DrawingPattern::renderPattern(float opacity) {
bool visible = opacity >= 1e-3;
if (!visible) {
- return NULL;
+ return nullptr;
}
if (!_tile_rect || (_tile_rect->area() == 0)) {
- return NULL;
+ return nullptr;
}
Geom::Rect pattern_tile = *_tile_rect;
diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp
index d7329e670..63db9475d 100644
--- a/src/display/drawing-shape.cpp
+++ b/src/display/drawing-shape.cpp
@@ -33,8 +33,8 @@ namespace Inkscape {
DrawingShape::DrawingShape(Drawing &drawing)
: DrawingItem(drawing)
- , _curve(NULL)
- , _last_pick(NULL)
+ , _curve(nullptr)
+ , _last_pick(nullptr)
, _repick_after(0)
{}
@@ -51,7 +51,7 @@ DrawingShape::setPath(SPCurve *curve)
if (_curve) {
_curve->unref();
- _curve = NULL;
+ _curve = nullptr;
}
if (curve) {
_curve = curve;
@@ -312,15 +312,15 @@ DrawingShape::_pickItem(Geom::Point const &p, double delta, unsigned flags)
if (_repick_after > 0) // we are a slow, huge path
return _last_pick; // skip this pick, returning what was returned last time
- if (!_curve) return NULL;
- if (!_style) return NULL;
+ if (!_curve) return nullptr;
+ if (!_style) return nullptr;
bool outline = _drawing.outline();
bool pick_as_clip = flags & PICK_AS_CLIP;
if (SP_SCALE24_TO_FLOAT(_style->opacity.value) == 0 && !outline && !pick_as_clip)
// fully transparent, no pick unless outline mode
- return NULL;
+ return nullptr;
GTimeVal tstart, tfinish;
g_get_current_time (&tstart);
@@ -351,9 +351,9 @@ DrawingShape::_pickItem(Geom::Point const &p, double delta, unsigned flags)
if (_drawing.arena()) {
Geom::Rect viewbox = _drawing.arena()->item.canvas->getViewbox();
viewbox.expandBy (width);
- pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox);
+ pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, nullptr, needfill? &wind : nullptr, &dist, 0.5, &viewbox);
} else {
- pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, NULL);
+ pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, nullptr, needfill? &wind : nullptr, &dist, 0.5, nullptr);
}
g_get_current_time (&tfinish);
@@ -397,8 +397,8 @@ DrawingShape::_pickItem(Geom::Point const &p, double delta, unsigned flags)
}
}
- _last_pick = NULL;
- return NULL;
+ _last_pick = nullptr;
+ return nullptr;
}
bool
diff --git a/src/display/drawing-shape.h b/src/display/drawing-shape.h
index 20da54239..8b0d1b082 100644
--- a/src/display/drawing-shape.h
+++ b/src/display/drawing-shape.h
@@ -28,7 +28,7 @@ public:
~DrawingShape() override;
void setPath(SPCurve *curve);
- void setStyle(SPStyle *style, SPStyle *context_style = NULL) override;
+ void setStyle(SPStyle *style, SPStyle *context_style = nullptr) override;
void setChildrenStyle(SPStyle *context_style) override;
protected:
diff --git a/src/display/drawing-surface.cpp b/src/display/drawing-surface.cpp
index 2752789e2..061641015 100644
--- a/src/display/drawing-surface.cpp
+++ b/src/display/drawing-surface.cpp
@@ -42,7 +42,7 @@ using Geom::Y;
* will cover the area under the given rectangle.
*/
DrawingSurface::DrawingSurface(Geom::IntRect const &area, int device_scale)
- : _surface(NULL)
+ : _surface(nullptr)
, _origin(area.min())
, _scale(1, 1)
, _pixels(area.dimensions())
@@ -60,7 +60,7 @@ DrawingSurface::DrawingSurface(Geom::IntRect const &area, int device_scale)
* @param pixdims Pixel dimensions of the surface.
*/
DrawingSurface::DrawingSurface(Geom::Rect const &logbox, Geom::IntPoint const &pixdims, int device_scale)
- : _surface(NULL)
+ : _surface(nullptr)
, _origin(logbox.min())
, _scale(pixdims[X] / logbox.width(), pixdims[Y] / logbox.height())
, _pixels(pixdims)
@@ -163,7 +163,7 @@ DrawingSurface::dropContents()
{
if (_surface) {
cairo_surface_destroy(_surface);
- _surface = NULL;
+ _surface = nullptr;
}
}
@@ -263,7 +263,7 @@ DrawingCache::prepare()
// the area has changed, so the cache content needs to be copied
Geom::IntPoint old_origin = old_area.min();
cairo_surface_t *old_surface = _surface;
- _surface = NULL;
+ _surface = nullptr;
_pixels = _pending_area.dimensions();
_origin = _pending_area.min();
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp
index aa2a744c8..a51e00606 100644
--- a/src/display/drawing-text.cpp
+++ b/src/display/drawing-text.cpp
@@ -28,7 +28,7 @@ namespace Inkscape {
DrawingGlyphs::DrawingGlyphs(Drawing &drawing)
: DrawingItem(drawing)
- , _font(NULL)
+ , _font(nullptr)
, _glyph(0)
{}
@@ -36,7 +36,7 @@ DrawingGlyphs::~DrawingGlyphs()
{
if (_font) {
_font->Unref();
- _font = NULL;
+ _font = nullptr;
}
}
@@ -182,7 +182,7 @@ DrawingItem *DrawingGlyphs::_pickItem(Geom::Point const &p, double /*delta*/, un
if (!ggroup) {
throw InvalidItemException();
}
- DrawingItem *result = NULL;
+ DrawingItem *result = nullptr;
bool invisible = (ggroup->_nrstyle.fill.type == NRStyle::PAINT_NONE) &&
(ggroup->_nrstyle.stroke.type == NRStyle::PAINT_NONE);
@@ -684,7 +684,7 @@ void DrawingText::_clipItem(DrawingContext &dc, Geom::IntRect const &/*area*/)
DrawingItem *
DrawingText::_pickItem(Geom::Point const &p, double delta, unsigned flags)
{
- return DrawingGroup::_pickItem(p, delta, flags) ? this : NULL;
+ return DrawingGroup::_pickItem(p, delta, flags) ? this : nullptr;
}
bool
diff --git a/src/display/drawing-text.h b/src/display/drawing-text.h
index 376182d4e..fdfab122f 100644
--- a/src/display/drawing-text.h
+++ b/src/display/drawing-text.h
@@ -28,7 +28,7 @@ public:
~DrawingGlyphs() override;
void setGlyph(font_instance *font, int glyph, Geom::Affine const &trans);
- void setStyle(SPStyle *style, SPStyle *context_style = NULL) override; // Not to be used
+ void setStyle(SPStyle *style, SPStyle *context_style = nullptr) override; // Not to be used
protected:
unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx,
@@ -57,7 +57,7 @@ public:
void clear();
bool addComponent(font_instance *font, int glyph, Geom::Affine const &trans,
float width, float ascent, float descent, float phase_length);
- void setStyle(SPStyle *style, SPStyle *context_style = NULL) override;
+ void setStyle(SPStyle *style, SPStyle *context_style = nullptr) override;
void setChildrenStyle(SPStyle *context_style) override;
protected:
diff --git a/src/display/drawing.cpp b/src/display/drawing.cpp
index 71fb94be0..18c2d98e8 100644
--- a/src/display/drawing.cpp
+++ b/src/display/drawing.cpp
@@ -31,7 +31,7 @@ static const gdouble grayscale_value_matrix[20] = {
};
Drawing::Drawing(SPCanvasArena *arena)
- : _root(NULL)
+ : _root(nullptr)
, outlinecolor(0x000000ff)
, delta(0)
, _exact(false)
@@ -198,7 +198,7 @@ Drawing::pick(Geom::Point const &p, double delta, unsigned flags)
if (_root) {
return _root->pick(p, delta, flags);
}
- return NULL;
+ return nullptr;
}
void
diff --git a/src/display/drawing.h b/src/display/drawing.h
index e472c8f5b..1348f02af 100644
--- a/src/display/drawing.h
+++ b/src/display/drawing.h
@@ -40,7 +40,7 @@ public:
guint32 images;
};
- Drawing(SPCanvasArena *arena = NULL);
+ Drawing(SPCanvasArena *arena = nullptr);
~Drawing();
DrawingItem *root() { return _root; }
diff --git a/src/display/gnome-canvas-acetate.cpp b/src/display/gnome-canvas-acetate.cpp
index 297d69068..50d26a068 100644
--- a/src/display/gnome-canvas-acetate.cpp
+++ b/src/display/gnome-canvas-acetate.cpp
@@ -41,7 +41,7 @@ static void sp_canvas_acetate_init (SPCanvasAcetate */*acetate*/)
static void sp_canvas_acetate_destroy(SPCanvasItem *object)
{
- g_return_if_fail (object != NULL);
+ g_return_if_fail (object != nullptr);
g_return_if_fail (GNOME_IS_CANVAS_ACETATE (object));
if (SP_CANVAS_ITEM_CLASS(sp_canvas_acetate_parent_class)->destroy)
diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp
index cde10f6c2..8091f8369 100644
--- a/src/display/guideline.cpp
+++ b/src/display/guideline.cpp
@@ -53,13 +53,13 @@ static void sp_guideline_init(SPGuideLine *gl)
gl->point_on_line = Geom::Point(0,0);
gl->sensitive = 0;
- gl->origin = NULL;
- gl->label = NULL;
+ gl->origin = nullptr;
+ gl->label = nullptr;
}
static void sp_guideline_destroy(SPCanvasItem *object)
{
- g_return_if_fail (object != NULL);
+ g_return_if_fail (object != nullptr);
g_return_if_fail (SP_IS_GUIDELINE (object));
SPGuideLine *gl = SP_GUIDELINE(object);
@@ -200,7 +200,7 @@ static double sp_guideline_point(SPCanvasItem *item, Geom::Point p, SPCanvasItem
SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, char* label, Geom::Point point_on_line, Geom::Point normal)
{
- SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_GUIDELINE, NULL);
+ SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_GUIDELINE, nullptr);
SPGuideLine *gl = SP_GUIDELINE(item);
normal.normalize();
diff --git a/src/display/nr-filter-colormatrix.cpp b/src/display/nr-filter-colormatrix.cpp
index 77873d523..5f477ae9b 100644
--- a/src/display/nr-filter-colormatrix.cpp
+++ b/src/display/nr-filter-colormatrix.cpp
@@ -151,7 +151,7 @@ struct ColorMatrixLuminanceToAlpha {
void FilterColorMatrix::render_cairo(FilterSlot &slot)
{
cairo_surface_t *input = slot.getcairo(_input);
- cairo_surface_t *out = NULL;
+ cairo_surface_t *out = nullptr;
// We may need to transform input surface to correct color interpolation space. The input surface
// might be used as input to another primitive but it is likely that all the primitives in a given
diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp
index 2227edfef..5cc8f74fd 100644
--- a/src/display/nr-filter-gaussian.cpp
+++ b/src/display/nr-filter-gaussian.cpp
@@ -637,7 +637,7 @@ void FilterGaussian::render_cairo(FilterSlot &slot)
}
}
- cairo_surface_t *downsampled = NULL;
+ cairo_surface_t *downsampled = nullptr;
if (resampling) {
// Divide by device scale as w_downsampled is in pixels while
// cairo_surface_create_similar() uses device units.
diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp
index 551a86cbf..b8b45b40b 100644
--- a/src/display/nr-filter-image.cpp
+++ b/src/display/nr-filter-image.cpp
@@ -27,10 +27,10 @@ namespace Inkscape {
namespace Filters {
FilterImage::FilterImage()
- : SVGElem(0)
- , document(0)
- , feImageHref(0)
- , image(0)
+ : SVGElem(nullptr)
+ , document(nullptr)
+ , feImageHref(nullptr)
+ , image(nullptr)
, broken_ref(false)
{ }
@@ -309,10 +309,10 @@ double FilterImage::complexity(Geom::Affine const &)
void FilterImage::set_href(const gchar *href){
if (feImageHref) g_free (feImageHref);
- feImageHref = (href) ? g_strdup (href) : NULL;
+ feImageHref = (href) ? g_strdup (href) : nullptr;
delete image;
- image = NULL;
+ image = nullptr;
broken_ref = false;
}
diff --git a/src/display/nr-filter-merge.cpp b/src/display/nr-filter-merge.cpp
index fc2ce408f..316df84f0 100644
--- a/src/display/nr-filter-merge.cpp
+++ b/src/display/nr-filter-merge.cpp
@@ -43,7 +43,7 @@ void FilterMerge::render_cairo(FilterSlot &slot)
// output is RGBA if at least one input is RGBA
bool rgba32 = false;
- cairo_surface_t *out = NULL;
+ cairo_surface_t *out = nullptr;
for (std::vector<int>::iterator i = _input_image.begin(); i != _input_image.end(); ++i) {
cairo_surface_t *in = slot.getcairo(*i);
if (cairo_surface_get_content(in) == CAIRO_CONTENT_COLOR_ALPHA) {
diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp
index ec392ea06..c6be75e16 100644
--- a/src/display/nr-filter-primitive.cpp
+++ b/src/display/nr-filter-primitive.cpp
@@ -46,7 +46,7 @@ FilterPrimitive::FilterPrimitive()
_subregion_width.unset(SVGLength::PERCENT, 1, 0);
_subregion_height.unset(SVGLength::PERCENT, 1, 0);
- _style = NULL;
+ _style = nullptr;
}
FilterPrimitive::~FilterPrimitive()
diff --git a/src/display/nr-filter-slot.cpp b/src/display/nr-filter-slot.cpp
index 9d76462c0..1358530b8 100644
--- a/src/display/nr-filter-slot.cpp
+++ b/src/display/nr-filter-slot.cpp
@@ -29,7 +29,7 @@ FilterSlot::FilterSlot(DrawingItem *item, DrawingContext *bgdc,
DrawingContext &graphic, FilterUnits const &u)
: _item(item)
, _source_graphic(graphic.rawTarget())
- , _background_ct(bgdc ? bgdc->raw() : NULL)
+ , _background_ct(bgdc ? bgdc->raw() : nullptr)
, _source_graphic_area(graphic.targetLogicalBounds().roundOutwards()) // fixme
, _background_area(bgdc ? bgdc->targetLogicalBounds().roundOutwards() : Geom::IntRect()) // fixme
, _units(u)
@@ -223,7 +223,7 @@ void FilterSlot::_set_internal(int slot_nr, cairo_surface_t *surface)
void FilterSlot::set(int slot_nr, cairo_surface_t *surface)
{
- g_return_if_fail(surface != NULL);
+ g_return_if_fail(surface != nullptr);
if (slot_nr == NR_FILTER_SLOT_NOT_SET)
slot_nr = NR_FILTER_UNNAMED_SLOT;
diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp
index 4782f3f54..6f8798a2a 100644
--- a/src/display/nr-filter.cpp
+++ b/src/display/nr-filter.cpp
@@ -367,7 +367,7 @@ int Filter::replace_primitive(int target, FilterPrimitiveType type)
}
FilterPrimitive *Filter::get_primitive(int handle) {
- if (handle < 0 || handle >= static_cast<int>(_primitive.size())) return NULL;
+ if (handle < 0 || handle >= static_cast<int>(_primitive.size())) return nullptr;
return _primitive[handle];
}
diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp
index 31bb27755..cec6de4d3 100644
--- a/src/display/nr-style.cpp
+++ b/src/display/nr-style.cpp
@@ -19,8 +19,8 @@
void NRStyle::Paint::clear()
{
if (server) {
- sp_object_unref(server, NULL);
- server = NULL;
+ sp_object_unref(server, nullptr);
+ server = nullptr;
}
type = PAINT_NONE;
}
@@ -38,7 +38,7 @@ void NRStyle::Paint::set(SPPaintServer *ps)
if (ps) {
type = PAINT_SERVER;
server = ps;
- sp_object_ref(server, NULL);
+ sp_object_ref(server, nullptr);
}
}
@@ -48,15 +48,15 @@ NRStyle::NRStyle()
, stroke_width(0.0)
, miter_limit(0.0)
, n_dash(0)
- , dash(NULL)
+ , dash(nullptr)
, dash_offset(0.0)
, fill_rule(CAIRO_FILL_RULE_EVEN_ODD)
, line_cap(CAIRO_LINE_CAP_BUTT)
, line_join(CAIRO_LINE_JOIN_MITER)
- , fill_pattern(NULL)
- , stroke_pattern(NULL)
- , text_decoration_fill_pattern(NULL)
- , text_decoration_stroke_pattern(NULL)
+ , fill_pattern(nullptr)
+ , stroke_pattern(nullptr)
+ , text_decoration_fill_pattern(nullptr)
+ , text_decoration_stroke_pattern(nullptr)
, text_decoration_line(TEXT_DECORATION_LINE_CLEAR)
, text_decoration_style(TEXT_DECORATION_STYLE_CLEAR)
, text_decoration_fill()
@@ -97,14 +97,14 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style)
// Handle 'context-fill' and 'context-stroke': Work in progress
const SPIPaint *style_fill = &(style->fill);
if( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) {
- if( context_style != NULL ) {
+ if( context_style != nullptr ) {
style_fill = &(context_style->fill);
} else {
// A marker in the defs section will result in ending up here.
//std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl;
}
} else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) {
- if( context_style != NULL ) {
+ if( context_style != nullptr ) {
style_fill = &(context_style->stroke);
} else {
//std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl;
@@ -148,13 +148,13 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style)
const SPIPaint *style_stroke = &(style->stroke);
if( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) {
- if( context_style != NULL ) {
+ if( context_style != nullptr ) {
style_stroke = &(context_style->fill);
} else {
//std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl;
}
} else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) {
- if( context_style != NULL ) {
+ if( context_style != nullptr ) {
style_stroke = &(context_style->stroke);
} else {
//std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl;
@@ -225,7 +225,7 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style)
}
} else {
dash_offset = 0.0;
- dash = NULL;
+ dash = nullptr;
}
@@ -472,7 +472,7 @@ void NRStyle::applyTextDecorationStroke(Inkscape::DrawingContext &dc)
dc.setLineCap(CAIRO_LINE_CAP_BUTT);
dc.setLineJoin(CAIRO_LINE_JOIN_MITER);
dc.setMiterLimit(miter_limit);
- cairo_set_dash(dc.raw(), 0, 0, 0.0); // fixme (no dash)
+ cairo_set_dash(dc.raw(), nullptr, 0, 0.0); // fixme (no dash)
}
void NRStyle::update()
@@ -482,10 +482,10 @@ void NRStyle::update()
if (stroke_pattern) cairo_pattern_destroy(stroke_pattern);
if (text_decoration_fill_pattern) cairo_pattern_destroy(text_decoration_fill_pattern);
if (text_decoration_stroke_pattern) cairo_pattern_destroy(text_decoration_stroke_pattern);
- fill_pattern = NULL;
- stroke_pattern = NULL;
- text_decoration_fill_pattern = NULL;
- text_decoration_stroke_pattern = NULL;
+ fill_pattern = nullptr;
+ stroke_pattern = nullptr;
+ text_decoration_fill_pattern = nullptr;
+ text_decoration_stroke_pattern = nullptr;
}
/*
diff --git a/src/display/nr-style.h b/src/display/nr-style.h
index 6c652311a..354b9dd8b 100644
--- a/src/display/nr-style.h
+++ b/src/display/nr-style.h
@@ -29,7 +29,7 @@ struct NRStyle {
NRStyle();
~NRStyle();
- void set(SPStyle *style, SPStyle *context_style = NULL);
+ void set(SPStyle *style, SPStyle *context_style = nullptr);
bool prepareFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern);
bool prepareStroke(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern);
bool prepareTextDecorationFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern);
@@ -47,7 +47,7 @@ struct NRStyle {
};
struct Paint {
- Paint() : type(PAINT_NONE), color(0), server(NULL), opacity(1.0) {}
+ Paint() : type(PAINT_NONE), color(0), server(nullptr), opacity(1.0) {}
~Paint() { clear(); }
PaintType type;
diff --git a/src/display/nr-svgfonts.cpp b/src/display/nr-svgfonts.cpp
index c3354bc0b..e2b112c1b 100644
--- a/src/display/nr-svgfonts.cpp
+++ b/src/display/nr-svgfonts.cpp
@@ -79,7 +79,7 @@ UserFont::UserFont(SvgFont* instance){
cairo_user_font_face_set_render_glyph_func (this->face, font_render_glyph_cb);
cairo_user_font_face_set_text_to_glyphs_func(this->face, font_text_to_glyphs_cb);
- cairo_font_face_set_user_data (this->face, &key, (void*)instance, (cairo_destroy_func_t) NULL);
+ cairo_font_face_set_user_data (this->face, &key, (void*)instance, (cairo_destroy_func_t) nullptr);
}
//******************************//
@@ -87,8 +87,8 @@ UserFont::UserFont(SvgFont* instance){
//******************************//
SvgFont::SvgFont(SPFont* spfont){
this->font = spfont;
- this->missingglyph = NULL;
- this->userfont = NULL;
+ this->missingglyph = nullptr;
+ this->userfont = nullptr;
}
cairo_status_t
@@ -191,8 +191,8 @@ SvgFont::scaled_font_text_to_glyphs (cairo_scaled_font_t */*scaled_font*/,
//We use that info to allocate memory for the glyphs
*glyphs = (cairo_glyph_t*) malloc(count*sizeof(cairo_glyph_t));
- char* previous_unicode = NULL; //This is used for kerning
- gchar* previous_glyph_name = NULL; //This is used for kerning
+ char* previous_unicode = nullptr; //This is used for kerning
+ gchar* previous_glyph_name = nullptr; //This is used for kerning
count=0;
double x=0, y=0;//These vars store the position of the glyph within the rendered string
@@ -312,7 +312,7 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/,
if (glyph > this->glyphs.size()) return CAIRO_STATUS_SUCCESS;//TODO: this is an error!
- SPObject *node = NULL;
+ SPObject *node = nullptr;
if (glyph == glyphs.size()){
if (!missingglyph) {
return CAIRO_STATUS_SUCCESS;
@@ -370,7 +370,7 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/,
SPPath *path = dynamic_cast<SPPath *>(item);
if (path) {
SPShape *shape = dynamic_cast<SPShape *>(item);
- g_assert(shape != NULL);
+ g_assert(shape != nullptr);
pathv = shape->_curve->get_pathvector();
pathv = flip_coordinate_system(spfont, pathv);
this->render_glyph_path(cr, &pathv);
@@ -405,7 +405,7 @@ SvgFont::get_font_face(){
void SvgFont::refresh(){
this->glyphs.clear();
delete this->userfont;
- this->userfont = NULL;
+ this->userfont = nullptr;
}
double SvgFont::units_per_em() {
diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp
index f2271e0c6..2e329c4aa 100644
--- a/src/display/snap-indicator.cpp
+++ b/src/display/snap-indicator.cpp
@@ -29,10 +29,10 @@ namespace Inkscape {
namespace Display {
SnapIndicator::SnapIndicator(SPDesktop * desktop)
- : _snaptarget(NULL),
- _snaptarget_tooltip(NULL),
- _snaptarget_bbox(NULL),
- _snapsource(NULL),
+ : _snaptarget(nullptr),
+ _snaptarget_tooltip(nullptr),
+ _snaptarget_bbox(nullptr),
+ _snapsource(nullptr),
_snaptarget_is_presnap(false),
_desktop(desktop)
{
@@ -50,7 +50,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
{
remove_snaptarget(); //only display one snaptarget at a time
- g_assert(_desktop != NULL);
+ g_assert(_desktop != nullptr);
if (!p.getSnapped()) {
return; // If we haven't snapped, then it is of no use to draw a snapindicator
@@ -245,7 +245,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
remove_snapsource(); // Don't set both the source and target indicators, as these will overlap
// Display the snap indicator (i.e. the cross)
- SPCanvasItem * canvasitem = NULL;
+ SPCanvasItem * canvasitem = nullptr;
canvasitem = sp_canvas_item_new(_desktop->getTempGroup(),
SP_TYPE_CTRL,
"anchor", SP_ANCHOR_CENTER,
@@ -281,7 +281,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
_snaptarget_is_presnap = pre_snap;
// Display the tooltip, which reveals the type of snap source and the type of snap target
- gchar *tooltip_str = NULL;
+ gchar *tooltip_str = nullptr;
if ( (p.getSource() != SNAPSOURCE_GRID_PITCH) && (p.getTarget() != SNAPTARGET_UNDEFINED) ) {
tooltip_str = g_strconcat(source_name, _(" to "), target_name, NULL);
} else if (p.getSource() != SNAPSOURCE_UNDEFINED) {
@@ -320,7 +320,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
if (bbox) {
SPCanvasItem* box = sp_canvas_item_new(_desktop->getTempGroup(),
SP_TYPE_CTRLRECT,
- NULL);
+ nullptr);
SP_CTRLRECT(box)->setRectangle(*bbox);
SP_CTRLRECT(box)->setColor(pre_snap ? 0x7f7f7fff : 0xff0000ff, 0, 0);
@@ -341,18 +341,18 @@ SnapIndicator::remove_snaptarget(bool only_if_presnap)
if (_snaptarget) {
_desktop->remove_temporary_canvasitem(_snaptarget);
- _snaptarget = NULL;
+ _snaptarget = nullptr;
_snaptarget_is_presnap = false;
}
if (_snaptarget_tooltip) {
_desktop->remove_temporary_canvasitem(_snaptarget_tooltip);
- _snaptarget_tooltip = NULL;
+ _snaptarget_tooltip = nullptr;
}
if (_snaptarget_bbox) {
_desktop->remove_temporary_canvasitem(_snaptarget_bbox);
- _snaptarget_bbox = NULL;
+ _snaptarget_bbox = nullptr;
}
}
@@ -362,7 +362,7 @@ SnapIndicator::set_new_snapsource(Inkscape::SnapCandidatePoint const &p)
{
remove_snapsource();
- g_assert(_desktop != NULL); // If this fails, then likely setup() has not been called on the snap manager (see snap.cpp -> setup())
+ g_assert(_desktop != nullptr); // If this fails, then likely setup() has not been called on the snap manager (see snap.cpp -> setup())
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool value = prefs->getBool("/options/snapindicator/value", true);
@@ -386,7 +386,7 @@ SnapIndicator::set_new_snapsource(Inkscape::SnapCandidatePoint const &p)
void
SnapIndicator::set_new_debugging_point(Geom::Point const &p)
{
- g_assert(_desktop != NULL);
+ g_assert(_desktop != nullptr);
SPCanvasItem * canvasitem = sp_canvas_item_new( _desktop->getTempGroup(),
SP_TYPE_CTRL,
"anchor", SP_ANCHOR_CENTER,
@@ -407,7 +407,7 @@ SnapIndicator::remove_snapsource()
{
if (_snapsource) {
_desktop->remove_temporary_canvasitem(_snapsource);
- _snapsource = NULL;
+ _snapsource = nullptr;
}
}
diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp
index 04ec947f6..45db82a93 100644
--- a/src/display/sodipodi-ctrl.cpp
+++ b/src/display/sodipodi-ctrl.cpp
@@ -79,7 +79,7 @@ sp_ctrl_set_property(GObject *object, guint prop_id, const GValue *value, GParam
SPCanvasItem *item;
SPCtrl *ctrl;
- GdkPixbuf * pixbuf = NULL;
+ GdkPixbuf * pixbuf = nullptr;
item = SP_CANVAS_ITEM (object);
ctrl = SP_CTRL (object);
@@ -206,22 +206,22 @@ sp_ctrl_init (SPCtrl *ctrl)
ctrl->angle = 0.0;
new (&ctrl->box) Geom::IntRect(0,0,0,0);
- ctrl->cache = NULL;
- ctrl->pixbuf = NULL;
+ ctrl->cache = nullptr;
+ ctrl->pixbuf = nullptr;
ctrl->_point = Geom::Point(0,0);
}
static void sp_ctrl_destroy(SPCanvasItem *object)
{
- g_return_if_fail (object != NULL);
+ g_return_if_fail (object != nullptr);
g_return_if_fail (SP_IS_CTRL (object));
SPCtrl *ctrl = SP_CTRL (object);
if (ctrl->cache) {
delete[] ctrl->cache;
- ctrl->cache = NULL;
+ ctrl->cache = nullptr;
}
if (SP_CANVAS_ITEM_CLASS(sp_ctrl_parent_class)->destroy)
diff --git a/src/display/sp-canvas-util.cpp b/src/display/sp-canvas-util.cpp
index 25b70824b..e6c6ea839 100644
--- a/src/display/sp-canvas-util.cpp
+++ b/src/display/sp-canvas-util.cpp
@@ -42,7 +42,7 @@ void sp_canvas_prepare_buffer(SPCanvasBuf *)
Geom::Affine sp_canvas_item_i2p_affine (SPCanvasItem * item)
{
- g_assert (item != NULL); /* this may be overly zealous - it is
+ g_assert (item != nullptr); /* this may be overly zealous - it is
* plausible that this gets called
* with item == 0. */
@@ -51,22 +51,22 @@ Geom::Affine sp_canvas_item_i2p_affine (SPCanvasItem * item)
Geom::Affine sp_canvas_item_i2i_affine (SPCanvasItem * from, SPCanvasItem * to)
{
- g_assert (from != NULL);
- g_assert (to != NULL);
+ g_assert (from != nullptr);
+ g_assert (to != nullptr);
return sp_canvas_item_i2w_affine(from) * sp_canvas_item_i2w_affine(to).inverse();
}
void sp_canvas_item_set_i2w_affine (SPCanvasItem * item, Geom::Affine const &i2w)
{
- g_assert (item != NULL);
+ g_assert (item != nullptr);
sp_canvas_item_affine_absolute(item, i2w * sp_canvas_item_i2w_affine(item->parent).inverse());
}
void sp_canvas_item_move_to_z (SPCanvasItem * item, gint z)
{
- g_assert (item != NULL);
+ g_assert (item != nullptr);
if (z == 0)
return sp_canvas_item_lower_to_bottom(item);
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index c717bc7ae..6a38ae3e7 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -49,7 +49,7 @@ using Inkscape::Debug::GdkEventLatencyTracker;
// gtk_check_version returns non-NULL on failure
static bool const HAS_BROKEN_MOTION_HINTS =
- true || gtk_check_version(2, 12, 0) != NULL;
+ true || gtk_check_version(2, 12, 0) != nullptr;
// Define this to visualize the regions to be redrawn
//#define DEBUG_REDRAW 1;
@@ -209,7 +209,7 @@ sp_canvas_item_class_init(SPCanvasItemClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
((glong)((guint8*)&(klass->event) - (guint8*)klass)),
- NULL, NULL,
+ nullptr, nullptr,
sp_marshal_BOOLEAN__POINTER,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT);
@@ -223,7 +223,7 @@ sp_canvas_item_class_init(SPCanvasItemClass *klass)
G_TYPE_FROM_CLASS (gobject_class),
(GSignalFlags)(G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS),
G_STRUCT_OFFSET (SPCanvasItemClass, destroy),
- NULL, NULL,
+ nullptr, nullptr,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
@@ -248,11 +248,11 @@ SPCanvasItem *sp_canvas_item_new(SPCanvasGroup *parent, GType type, gchar const
{
va_list args;
- g_return_val_if_fail(parent != NULL, NULL);
+ g_return_val_if_fail(parent != nullptr, NULL);
g_return_val_if_fail(SP_IS_CANVAS_GROUP(parent), NULL);
g_return_val_if_fail(g_type_is_a(type, SP_TYPE_CANVAS_ITEM), NULL);
- SPCanvasItem *item = SP_CANVAS_ITEM(g_object_new(type, NULL));
+ SPCanvasItem *item = SP_CANVAS_ITEM(g_object_new(type, nullptr));
va_start(args, first_arg_name);
sp_canvas_item_construct(item, parent, first_arg_name, args);
@@ -329,22 +329,22 @@ void sp_canvas_item_dispose(GObject *object)
item->visible = FALSE;
if (item == item->canvas->_current_item) {
- item->canvas->_current_item = NULL;
+ item->canvas->_current_item = nullptr;
item->canvas->_need_repick = TRUE;
}
if (item == item->canvas->_new_current_item) {
- item->canvas->_new_current_item = NULL;
+ item->canvas->_new_current_item = nullptr;
item->canvas->_need_repick = TRUE;
}
if (item == item->canvas->_grabbed_item) {
- item->canvas->_grabbed_item = NULL;
+ item->canvas->_grabbed_item = nullptr;
ungrab_default_client_pointer();
}
if (item == item->canvas->_focused_item) {
- item->canvas->_focused_item = NULL;
+ item->canvas->_focused_item = nullptr;
}
if (item->parent) {
@@ -439,7 +439,7 @@ void sp_canvas_item_affine_absolute(SPCanvasItem *item, Geom::Affine const &affi
if (!item->need_affine) {
item->need_affine = TRUE;
- if (item->parent != NULL) {
+ if (item->parent != nullptr) {
sp_canvas_item_request_update (item->parent);
} else {
item->canvas->requestUpdate();
@@ -460,7 +460,7 @@ void sp_canvas_item_affine_absolute(SPCanvasItem *item, Geom::Affine const &affi
*/
void sp_canvas_item_raise(SPCanvasItem *item, int positions)
{
- g_return_if_fail (item != NULL);
+ g_return_if_fail (item != nullptr);
g_return_if_fail (SP_IS_CANVAS_ITEM (item));
g_return_if_fail (positions >= 0);
@@ -484,7 +484,7 @@ void sp_canvas_item_raise(SPCanvasItem *item, int positions)
void sp_canvas_item_raise_to_top(SPCanvasItem *item)
{
- g_return_if_fail (item != NULL);
+ g_return_if_fail (item != nullptr);
g_return_if_fail (SP_IS_CANVAS_ITEM (item));
if (!item->parent)
return;
@@ -508,7 +508,7 @@ void sp_canvas_item_raise_to_top(SPCanvasItem *item)
*/
void sp_canvas_item_lower(SPCanvasItem *item, int positions)
{
- g_return_if_fail (item != NULL);
+ g_return_if_fail (item != nullptr);
g_return_if_fail (SP_IS_CANVAS_ITEM (item));
g_return_if_fail (positions >= 1);
@@ -533,7 +533,7 @@ void sp_canvas_item_lower(SPCanvasItem *item, int positions)
void sp_canvas_item_lower_to_bottom(SPCanvasItem *item)
{
- g_return_if_fail (item != NULL);
+ g_return_if_fail (item != nullptr);
g_return_if_fail (SP_IS_CANVAS_ITEM (item));
if (!item->parent)
return;
@@ -554,7 +554,7 @@ bool sp_canvas_item_is_visible(SPCanvasItem *item)
*/
void sp_canvas_item_show(SPCanvasItem *item)
{
- g_return_if_fail (item != NULL);
+ g_return_if_fail (item != nullptr);
g_return_if_fail (SP_IS_CANVAS_ITEM (item));
if (item->visible) {
@@ -579,7 +579,7 @@ void sp_canvas_item_show(SPCanvasItem *item)
*/
void sp_canvas_item_hide(SPCanvasItem *item)
{
- g_return_if_fail (item != NULL);
+ g_return_if_fail (item != nullptr);
g_return_if_fail (SP_IS_CANVAS_ITEM (item));
if (!item->visible) {
@@ -606,7 +606,7 @@ void sp_canvas_item_hide(SPCanvasItem *item)
*/
int sp_canvas_item_grab(SPCanvasItem *item, guint event_mask, GdkCursor *cursor, guint32 etime)
{
- g_return_val_if_fail (item != NULL, -1);
+ g_return_val_if_fail (item != nullptr, -1);
g_return_val_if_fail (SP_IS_CANVAS_ITEM (item), -1);
g_return_val_if_fail (gtk_widget_get_mapped (GTK_WIDGET (item->canvas)), -1);
@@ -637,9 +637,9 @@ int sp_canvas_item_grab(SPCanvasItem *item, guint event_mask, GdkCursor *cursor,
GDK_SEAT_CAPABILITY_ALL_POINTING,
FALSE,
cursor,
- NULL,
- NULL,
- NULL);
+ nullptr,
+ nullptr,
+ nullptr);
#else
auto dm = gdk_display_get_device_manager(display);
auto device = gdk_device_manager_get_client_pointer(dm);
@@ -669,14 +669,14 @@ int sp_canvas_item_grab(SPCanvasItem *item, guint event_mask, GdkCursor *cursor,
*/
void sp_canvas_item_ungrab(SPCanvasItem *item, guint32 etime)
{
- g_return_if_fail (item != NULL);
+ g_return_if_fail (item != nullptr);
g_return_if_fail (SP_IS_CANVAS_ITEM (item));
if (item->canvas->_grabbed_item != item) {
return;
}
- item->canvas->_grabbed_item = NULL;
+ item->canvas->_grabbed_item = nullptr;
ungrab_default_client_pointer(etime);
}
@@ -726,7 +726,7 @@ void sp_canvas_item_request_update(SPCanvasItem *item)
item->need_update = TRUE;
- if (item->parent != NULL) {
+ if (item->parent != nullptr) {
// Recurse up the tree
sp_canvas_item_request_update (item->parent);
} else {
@@ -772,7 +772,7 @@ static void sp_canvas_group_init(SPCanvasGroup * group)
void SPCanvasGroup::destroy(SPCanvasItem *object)
{
- g_return_if_fail(object != NULL);
+ g_return_if_fail(object != nullptr);
g_return_if_fail(SP_IS_CANVAS_GROUP(object));
SPCanvasGroup *group = SP_CANVAS_GROUP(object);
@@ -827,14 +827,14 @@ double SPCanvasGroup::point(SPCanvasItem *item, Geom::Point p, SPCanvasItem **ac
int y2 = (int)(y + item->canvas->_close_enough);
double best = 0.0;
- *actual_item = NULL;
+ *actual_item = nullptr;
double dist = 0.0;
for (std::list<SPCanvasItem *>::const_iterator it = group->items.begin(); it != group->items.end(); ++it) {
SPCanvasItem *child = *it;
if ((child->x1 <= x2) && (child->y1 <= y2) && (child->x2 >= x1) && (child->y2 >= y1)) {
- SPCanvasItem *point_item = NULL; // cater for incomplete item implementations
+ SPCanvasItem *point_item = nullptr; // cater for incomplete item implementations
int pickable;
if (child->visible && child->pickable && SP_CANVAS_ITEM_GET_CLASS(child)->point) {
@@ -905,7 +905,7 @@ void SPCanvasGroup::add(SPCanvasItem *item)
void SPCanvasGroup::remove(SPCanvasItem *item)
{
- g_return_if_fail(item != NULL);
+ g_return_if_fail(item != nullptr);
auto position = std::find(items.begin(), items.end(), item);
if (position != items.end()) {
@@ -913,7 +913,7 @@ void SPCanvasGroup::remove(SPCanvasItem *item)
}
// Unparent the child
- item->parent = NULL;
+ item->parent = nullptr;
g_object_unref(item);
}
@@ -955,7 +955,7 @@ static void sp_canvas_init(SPCanvas *canvas)
canvas->_pick_event.crossing.y = 0;
// Create the root item as a special case
- canvas->_root = SP_CANVAS_ITEM(g_object_new(SP_TYPE_CANVAS_GROUP, NULL));
+ canvas->_root = SP_CANVAS_ITEM(g_object_new(SP_TYPE_CANVAS_GROUP, nullptr));
canvas->_root->canvas = canvas;
g_object_ref (canvas->_root);
@@ -968,9 +968,9 @@ static void sp_canvas_init(SPCanvas *canvas)
canvas->_drawing_disabled = false;
- canvas->_backing_store = NULL;
+ canvas->_backing_store = nullptr;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
- canvas->_surface_for_similar = NULL;
+ canvas->_surface_for_similar = nullptr;
#endif
canvas->_clean_region = cairo_region_create();
canvas->_background = cairo_pattern_create_rgb(1, 1, 1);
@@ -991,7 +991,7 @@ void SPCanvas::shutdownTransients()
dirtyAll();
if (_grabbed_item) {
- _grabbed_item = NULL;
+ _grabbed_item = nullptr;
ungrab_default_client_pointer();
}
removeIdle();
@@ -1003,25 +1003,25 @@ void SPCanvas::dispose(GObject *object)
if (canvas->_root) {
g_object_unref (canvas->_root);
- canvas->_root = NULL;
+ canvas->_root = nullptr;
}
if (canvas->_backing_store) {
cairo_surface_destroy(canvas->_backing_store);
- canvas->_backing_store = NULL;
+ canvas->_backing_store = nullptr;
}
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
if (canvas->_surface_for_similar) {
cairo_surface_destroy(canvas->_surface_for_similar);
- canvas->_surface_for_similar = NULL;
+ canvas->_surface_for_similar = nullptr;
}
#endif
if (canvas->_clean_region) {
cairo_region_destroy(canvas->_clean_region);
- canvas->_clean_region = NULL;
+ canvas->_clean_region = nullptr;
}
if (canvas->_background) {
cairo_pattern_destroy(canvas->_background);
- canvas->_background = NULL;
+ canvas->_background = nullptr;
}
canvas->shutdownTransients();
@@ -1048,7 +1048,7 @@ void trackLatency(GdkEvent const *event)
GtkWidget *SPCanvas::createAA()
{
- SPCanvas *canvas = SP_CANVAS(g_object_new(SP_TYPE_CANVAS, NULL));
+ SPCanvas *canvas = SP_CANVAS(g_object_new(SP_TYPE_CANVAS, nullptr));
return GTK_WIDGET(canvas);
}
@@ -1099,9 +1099,9 @@ void SPCanvas::handle_unrealize(GtkWidget *widget)
{
SPCanvas *canvas = SP_CANVAS (widget);
- canvas->_current_item = NULL;
- canvas->_grabbed_item = NULL;
- canvas->_focused_item = NULL;
+ canvas->_current_item = nullptr;
+ canvas->_grabbed_item = nullptr;
+ canvas->_focused_item = nullptr;
canvas->shutdownTransients();
@@ -1138,9 +1138,9 @@ void SPCanvas::handle_size_allocate(GtkWidget *widget, GtkAllocation *allocation
allocation->width, allocation->height);
// Resize backing store.
- cairo_surface_t *new_backing_store = NULL;
+ cairo_surface_t *new_backing_store = nullptr;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
- if (canvas->_surface_for_similar != NULL) {
+ if (canvas->_surface_for_similar != nullptr) {
// Size in device pixels. Does not set device scale.
new_backing_store =
@@ -1150,7 +1150,7 @@ void SPCanvas::handle_size_allocate(GtkWidget *widget, GtkAllocation *allocation
allocation->height * canvas->_device_scale);
}
#endif
- if (new_backing_store == NULL) {
+ if (new_backing_store == nullptr) {
// Size in device pixels. Does not set device scale.
new_backing_store =
@@ -1268,7 +1268,7 @@ int SPCanvas::emitEvent(GdkEvent *event)
// (e.g. if the pointer leaves the window). So this is a hack that
// Lauris applied to SP to get around the problem.
//
- SPCanvasItem* item = NULL;
+ SPCanvasItem* item = nullptr;
if (_grabbed_item && !is_descendant(_current_item, _grabbed_item)) {
item = _grabbed_item;
} else {
@@ -1333,7 +1333,7 @@ int SPCanvas::pickCurrentItem(GdkEvent *event)
_pick_event.crossing.type = GDK_ENTER_NOTIFY;
_pick_event.crossing.window = event->motion.window;
_pick_event.crossing.send_event = event->motion.send_event;
- _pick_event.crossing.subwindow = NULL;
+ _pick_event.crossing.subwindow = nullptr;
_pick_event.crossing.x = event->motion.x;
_pick_event.crossing.y = event->motion.y;
_pick_event.crossing.mode = GDK_CROSSING_NORMAL;
@@ -1381,10 +1381,10 @@ int SPCanvas::pickCurrentItem(GdkEvent *event)
if (_root->visible) {
sp_canvas_item_invoke_point (_root, Geom::Point(x, y), &_new_current_item);
} else {
- _new_current_item = NULL;
+ _new_current_item = nullptr;
}
} else {
- _new_current_item = NULL;
+ _new_current_item = nullptr;
}
if ((_new_current_item == _current_item) && !_left_grabbed_item) {
@@ -1394,7 +1394,7 @@ int SPCanvas::pickCurrentItem(GdkEvent *event)
// Synthesize events for old and new current items
if ((_new_current_item != _current_item) &&
- _current_item != NULL && !_left_grabbed_item)
+ _current_item != nullptr && !_left_grabbed_item)
{
GdkEvent new_event;
@@ -1402,7 +1402,7 @@ int SPCanvas::pickCurrentItem(GdkEvent *event)
new_event.type = GDK_LEAVE_NOTIFY;
new_event.crossing.detail = GDK_NOTIFY_ANCESTOR;
- new_event.crossing.subwindow = NULL;
+ new_event.crossing.subwindow = nullptr;
_in_repick = TRUE;
retval = emitEvent(&new_event);
_in_repick = FALSE;
@@ -1421,13 +1421,13 @@ int SPCanvas::pickCurrentItem(GdkEvent *event)
_left_grabbed_item = FALSE;
_current_item = _new_current_item;
- if (_current_item != NULL) {
+ if (_current_item != nullptr) {
GdkEvent new_event;
new_event = _pick_event;
new_event.type = GDK_ENTER_NOTIFY;
new_event.crossing.detail = GDK_NOTIFY_ANCESTOR;
- new_event.crossing.subwindow = NULL;
+ new_event.crossing.subwindow = nullptr;
retval = emitEvent(&new_event);
}
@@ -1508,7 +1508,7 @@ gint SPCanvas::handle_scroll(GtkWidget *widget, GdkEventScroll *event)
static inline void request_motions(GdkWindow *w, GdkEventMotion *event) {
gdk_window_get_device_position(w,
gdk_event_get_device((GdkEvent *)(event)),
- NULL, NULL, NULL);
+ nullptr, nullptr, nullptr);
gdk_event_request_motions(event);
}
@@ -1523,7 +1523,7 @@ int SPCanvas::handle_motion(GtkWidget *widget, GdkEventMotion *event)
return FALSE;
}
- if (canvas->_root == NULL) // canvas being deleted
+ if (canvas->_root == nullptr) // canvas being deleted
return FALSE;
canvas->_state = event->state;
@@ -1541,11 +1541,11 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect
// Prevent crash if paintSingleBuffer is called before _backing_store is
// initialized.
- if (_backing_store == NULL)
+ if (_backing_store == nullptr)
return;
SPCanvasBuf buf;
- buf.buf = NULL;
+ buf.buf = nullptr;
buf.buf_rowstride = 0;
buf.rect = paint_rect;
buf.canvas_rect = canvas_rect;
@@ -1604,7 +1604,7 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
if (_enable_cms_display_adj) {
- cmsHTRANSFORM transf = 0;
+ cmsHTRANSFORM transf = nullptr;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool fromDisplay = prefs->getBool( "/options/displayprofile/from_display");
if ( fromDisplay ) {
@@ -1788,7 +1788,7 @@ bool SPCanvas::paintRect(int xx0, int yy0, int xx1, int yy1)
gdk_window_get_device_position(gtk_widget_get_window(GTK_WIDGET(this)),
device->gobj(),
- &x, &y, NULL);
+ &x, &y, nullptr);
setup.mouse_loc = sp_canvas_window_to_world(this, Geom::Point(x,y));
@@ -1828,7 +1828,7 @@ gboolean SPCanvas::handle_draw(GtkWidget *widget, cairo_t *cr) {
SPCanvas *canvas = SP_CANVAS(widget);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
- if (canvas->_surface_for_similar == NULL && canvas->_backing_store != NULL) {
+ if (canvas->_surface_for_similar == nullptr && canvas->_backing_store != nullptr) {
// Device scale is copied but since this is only created one time, we'll
// need to check/set device scale anytime it is used in case window moved
@@ -2011,7 +2011,7 @@ gint SPCanvas::idle_handler(gpointer data)
void SPCanvas::addIdle()
{
if (_idle_id == 0) {
- _idle_id = gdk_threads_add_idle_full(UPDATE_PRIORITY, idle_handler, this, NULL);
+ _idle_id = gdk_threads_add_idle_full(UPDATE_PRIORITY, idle_handler, this, nullptr);
}
}
void SPCanvas::removeIdle()
@@ -2055,9 +2055,9 @@ void SPCanvas::scrollTo( Geom::Point const &c, unsigned int clear, bool is_scrol
// Adjust backing store contents
assert(_backing_store);
- cairo_surface_t *new_backing_store = NULL;
+ cairo_surface_t *new_backing_store = nullptr;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
- if (_surface_for_similar != NULL)
+ if (_surface_for_similar != nullptr)
// Size in device pixels. Does not set device scale.
new_backing_store =
@@ -2066,7 +2066,7 @@ void SPCanvas::scrollTo( Geom::Point const &c, unsigned int clear, bool is_scrol
allocation.width * _device_scale,
allocation.height * _device_scale);
#endif
- if (new_backing_store == NULL)
+ if (new_backing_store == nullptr)
// Size in device pixels. Does not set device scale.
new_backing_store =
@@ -2158,7 +2158,7 @@ void SPCanvas::setBackgroundColor(guint32 rgba) {
double new_b = SP_RGBA32_B_F(rgba);
if (!_background_is_checkerboard) {
double old_r, old_g, old_b;
- cairo_pattern_get_rgba(_background, &old_r, &old_g, &old_b, NULL);
+ cairo_pattern_get_rgba(_background, &old_r, &old_g, &old_b, nullptr);
if (new_r == old_r && new_g == old_g && new_b == old_b) return;
}
if (_background) {
@@ -2186,7 +2186,7 @@ void SPCanvas::setBackgroundCheckerboard() {
*/
void sp_canvas_window_to_world(SPCanvas const *canvas, double winx, double winy, double *worldx, double *worldy)
{
- g_return_if_fail (canvas != NULL);
+ g_return_if_fail (canvas != nullptr);
g_return_if_fail (SP_IS_CANVAS (canvas));
if (worldx) *worldx = canvas->_x0 + winx;
@@ -2198,7 +2198,7 @@ void sp_canvas_window_to_world(SPCanvas const *canvas, double winx, double winy,
*/
void sp_canvas_world_to_window(SPCanvas const *canvas, double worldx, double worldy, double *winx, double *winy)
{
- g_return_if_fail (canvas != NULL);
+ g_return_if_fail (canvas != nullptr);
g_return_if_fail (SP_IS_CANVAS (canvas));
if (winx) *winx = worldx - canvas->_x0;
@@ -2210,7 +2210,7 @@ void sp_canvas_world_to_window(SPCanvas const *canvas, double worldx, double wor
*/
Geom::Point sp_canvas_window_to_world(SPCanvas const *canvas, Geom::Point const win)
{
- g_assert (canvas != NULL);
+ g_assert (canvas != nullptr);
g_assert (SP_IS_CANVAS (canvas));
return Geom::Point(canvas->_x0 + win[0], canvas->_y0 + win[1]);
@@ -2221,7 +2221,7 @@ Geom::Point sp_canvas_window_to_world(SPCanvas const *canvas, Geom::Point const
*/
Geom::Point sp_canvas_world_to_window(SPCanvas const *canvas, Geom::Point const world)
{
- g_assert (canvas != NULL);
+ g_assert (canvas != nullptr);
g_assert (SP_IS_CANVAS (canvas));
return Geom::Point(world[0] - canvas->_x0, world[1] - canvas->_y0);
@@ -2234,7 +2234,7 @@ bool sp_canvas_world_pt_inside_window(SPCanvas const *canvas, Geom::Point const
{
GtkAllocation allocation;
- g_assert( canvas != NULL );
+ g_assert( canvas != nullptr );
g_assert(SP_IS_CANVAS(canvas));
GtkWidget *w = GTK_WIDGET(canvas);
diff --git a/src/display/sp-ctrlcurve.cpp b/src/display/sp-ctrlcurve.cpp
index 79ef20d6c..26a3c2055 100644
--- a/src/display/sp-ctrlcurve.cpp
+++ b/src/display/sp-ctrlcurve.cpp
@@ -46,7 +46,7 @@ sp_ctrlcurve_init(SPCtrlCurve *ctrlcurve)
{
// Points are initialized to 0,0
ctrlcurve->rgba = 0x0000ff7f;
- ctrlcurve->item=NULL;
+ ctrlcurve->item=nullptr;
ctrlcurve->corner0 = -1;
ctrlcurve->corner1 = -1;
}
@@ -55,12 +55,12 @@ namespace {
static void
sp_ctrlcurve_destroy(SPCanvasItem *object)
{
- g_return_if_fail (object != NULL);
+ g_return_if_fail (object != nullptr);
g_return_if_fail (SP_IS_CTRLCURVE (object));
SPCtrlCurve *ctrlcurve = SP_CTRLCURVE (object);
- ctrlcurve->item=NULL;
+ ctrlcurve->item=nullptr;
if (SP_CANVAS_ITEM_CLASS(sp_ctrlcurve_parent_class)->destroy)
SP_CANVAS_ITEM_CLASS(sp_ctrlcurve_parent_class)->destroy(object);
diff --git a/src/display/sp-ctrlline.cpp b/src/display/sp-ctrlline.cpp
index c4ced2a33..709f85e54 100644
--- a/src/display/sp-ctrlline.cpp
+++ b/src/display/sp-ctrlline.cpp
@@ -51,19 +51,19 @@ static void sp_ctrlline_init(SPCtrlLine *ctrlline)
{
ctrlline->rgba = 0x0000ff7f;
ctrlline->s[Geom::X] = ctrlline->s[Geom::Y] = ctrlline->e[Geom::X] = ctrlline->e[Geom::Y] = 0.0;
- ctrlline->item=NULL;
+ ctrlline->item=nullptr;
ctrlline->is_fill = true;
}
namespace {
void sp_ctrlline_destroy(SPCanvasItem *object)
{
- g_return_if_fail(object != NULL);
+ g_return_if_fail(object != nullptr);
g_return_if_fail(SP_IS_CTRLLINE(object));
SPCtrlLine *ctrlline = SP_CTRLLINE(object);
- ctrlline->item = NULL;
+ ctrlline->item = nullptr;
if(SP_CANVAS_ITEM_CLASS (sp_ctrlline_parent_class)->destroy) {
SP_CANVAS_ITEM_CLASS (sp_ctrlline_parent_class)->destroy(object);
diff --git a/src/display/sp-ctrlquadr.cpp b/src/display/sp-ctrlquadr.cpp
index 760e93a6d..40c011e26 100644
--- a/src/display/sp-ctrlquadr.cpp
+++ b/src/display/sp-ctrlquadr.cpp
@@ -58,7 +58,7 @@ sp_ctrlquadr_init (SPCtrlQuadr *ctrlquadr)
static void sp_ctrlquadr_destroy(SPCanvasItem *object)
{
- g_return_if_fail (object != NULL);
+ g_return_if_fail (object != nullptr);
g_return_if_fail (SP_IS_CTRLQUADR (object));
if (SP_CANVAS_ITEM_CLASS(sp_ctrlquadr_parent_class)->destroy)
@@ -139,7 +139,7 @@ static void sp_ctrlquadr_update(SPCanvasItem *item, Geom::Affine const &affine,
void
sp_ctrlquadr_set_rgba32 (SPCtrlQuadr *cl, guint32 rgba)
{
- g_return_if_fail (cl != NULL);
+ g_return_if_fail (cl != nullptr);
g_return_if_fail (SP_IS_CTRLQUADR (cl));
if (rgba != cl->rgba) {
@@ -153,7 +153,7 @@ sp_ctrlquadr_set_rgba32 (SPCtrlQuadr *cl, guint32 rgba)
void
sp_ctrlquadr_set_coords (SPCtrlQuadr *cl, Geom::Point p1, Geom::Point p2, Geom::Point p3, Geom::Point p4)
{
- g_return_if_fail (cl != NULL);
+ g_return_if_fail (cl != nullptr);
g_return_if_fail (SP_IS_CTRLQUADR (cl));
if (p1 != cl->p1 || p2 != cl->p2 || p3 != cl->p3 || p4 != cl->p4) {