diff options
| author | MenTaLguY <mental@rydia.net> | 2006-05-28 19:51:13 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2006-05-28 19:51:13 +0000 |
| commit | 2d08a9d98d19a0581eeae687bb0322dc98806d40 (patch) | |
| tree | 3adec19e80f170b623e41454aae370cb7c75dade /src/display | |
| parent | okay, that looked better in the icon preview than it did in practice; putting... (diff) | |
| download | inkscape-2d08a9d98d19a0581eeae687bb0322dc98806d40.tar.gz inkscape-2d08a9d98d19a0581eeae687bb0322dc98806d40.zip | |
replace nr_new() with g_new(), and try to converge on using the glib allocator a little more instead of the others (aside from libgc)
(bzr r1044)
Diffstat (limited to 'src/display')
| -rw-r--r-- | src/display/curve.cpp | 17 | ||||
| -rw-r--r-- | src/display/sp-canvas.cpp | 8 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/display/curve.cpp b/src/display/curve.cpp index bbbba09f0..9e571fdd0 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -16,6 +16,7 @@ */ +#include <glib/gmem.h> #include <display/curve.h> #include <libnr/n-art-bpath.h> #include <libnr/nr-point-matrix-ops.h> @@ -56,7 +57,7 @@ sp_curve_new_sized(gint length) SPCurve *curve = g_new(SPCurve, 1); curve->refcount = 1; - curve->_bpath = nr_new(NArtBpath, length); + curve->_bpath = g_new(NArtBpath, length); curve->_bpath->code = NR_END; curve->end = 0; curve->length = length; @@ -80,7 +81,7 @@ sp_curve_new_from_bpath(NArtBpath *bpath) g_return_val_if_fail(bpath != NULL, NULL); SPCurve *curve = sp_curve_new_from_foreign_bpath(bpath); - nr_free(bpath); + g_free(bpath); return curve; } @@ -99,7 +100,7 @@ SPCurve *sp_curve_new_from_foreign_bpath(NArtBpath const bpath[]) g_return_val_if_fail(new_bpath != NULL, NULL); } else { unsigned const len = sp_bpath_length(bpath); - new_bpath = nr_new(NArtBpath, len); + new_bpath = g_new(NArtBpath, len); memcpy(new_bpath, bpath, len * sizeof(NArtBpath)); } @@ -152,7 +153,7 @@ sp_curve_unref(SPCurve *curve) if (curve->refcount < 1) { if (curve->_bpath) { - nr_free(curve->_bpath); + g_free(curve->_bpath); } g_free(curve); } @@ -175,7 +176,7 @@ sp_curve_ensure_space(SPCurve *curve, gint space) if (space < SP_CURVE_LENSTEP) space = SP_CURVE_LENSTEP; - curve->_bpath = nr_renew(curve->_bpath, NArtBpath, curve->length + space); + curve->_bpath = g_renew(NArtBpath, curve->_bpath, curve->length + space); curve->length += space; } @@ -936,7 +937,7 @@ static bool sp_bpath_good(NArtBpath const bpath[]) */ static NArtBpath *sp_bpath_clean(NArtBpath const bpath[]) { - NArtBpath *new_bpath = nr_new(NArtBpath, sp_bpath_length(bpath)); + NArtBpath *new_bpath = g_new(NArtBpath, sp_bpath_length(bpath)); NArtBpath const *bp = bpath; NArtBpath *np = new_bpath; @@ -956,14 +957,14 @@ static NArtBpath *sp_bpath_clean(NArtBpath const bpath[]) } if (np == new_bpath) { - nr_free(new_bpath); + g_free(new_bpath); return NULL; } np->code = NR_END; np += 1; - new_bpath = nr_renew(new_bpath, NArtBpath, np - new_bpath); + new_bpath = g_renew(NArtBpath, new_bpath, np - new_bpath); return new_bpath; } diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index edd429f0d..8ce4a35b4 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -994,7 +994,7 @@ shutdown_transients (SPCanvas *canvas) if (canvas->need_redraw) { canvas->need_redraw = FALSE; } - if ( canvas->tiles ) free(canvas->tiles); + if ( canvas->tiles ) g_free(canvas->tiles); canvas->tiles=NULL; canvas->tLeft=canvas->tTop=canvas->tRight=canvas->tBottom=0; canvas->tileH=canvas->tileV=0; @@ -2029,7 +2029,7 @@ inline int sp_canvas_tile_ceil(int x) void sp_canvas_resize_tiles(SPCanvas* canvas,int nl,int nt,int nr,int nb) { if ( nl >= nr || nt >= nb ) { - if ( canvas->tiles ) free(canvas->tiles); + if ( canvas->tiles ) g_free(canvas->tiles); canvas->tLeft=canvas->tTop=canvas->tRight=canvas->tBottom=0; canvas->tileH=canvas->tileV=0; canvas->tiles=NULL; @@ -2041,7 +2041,7 @@ void sp_canvas_resize_tiles(SPCanvas* canvas,int nl,int nt,int nr,int nb) int tb=sp_canvas_tile_ceil(nb); int nh=tr-tl,nv=tb-tt; - uint8_t* ntiles=(uint8_t*)malloc(nh*nv*sizeof(uint8_t)); + uint8_t* ntiles=(uint8_t*)g_malloc(nh*nv*sizeof(uint8_t)); for (int i=tl;i<tr;i++) { for (int j=tt;j<tb;j++) { int ind=(i-tl)+(j-tt)*nh; @@ -2052,7 +2052,7 @@ void sp_canvas_resize_tiles(SPCanvas* canvas,int nl,int nt,int nr,int nb) } } } - if ( canvas->tiles ) free(canvas->tiles); + if ( canvas->tiles ) g_free(canvas->tiles); canvas->tiles=ntiles; canvas->tLeft=tl; canvas->tTop=tt; |
