summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1c968bc)
raw | patch | inline | side by side (parent: 1c968bc)
author | mental <mental@users.sourceforge.net> | |
Sun, 28 May 2006 19:51:13 +0000 (19:51 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Sun, 28 May 2006 19:51:13 +0000 (19:51 +0000) |
28 files changed:
diff --git a/ChangeLog b/ChangeLog
index a5a4f63f308f3fd479037467b775322fd3004f15..b475a4c839052fd556c455083f15e844139633bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-05-28 MenTaLguY <mental@rydia.net>
+
+ * src/dialogs/clonetiler.cpp, src/dialogs/iconpreview.cpp,
+ src/dialogs/stroke-style.cpp, src/display/curve.cpp,
+ src/display/sp-canvas.cpp, src/dyna-draw-context.cpp,
+ src/extension/internal/gnome.cpp, src/extension/internal/pdf.cpp,
+ src/extension/internal/ps.cpp, src/extension/internal/win32.cpp,
+ src/file.cpp, src/inkview.cpp, src/libnr/nr-macros.h,
+ src/libnr/nr-object.cpp, src/libnr/nr-path.cpp,
+ src/libnr/nr-pixblock.cpp, src/libnr/nr-pixblock-pattern.cpp,
+ src/libnr/nr-svp.cpp, src/libnr/nr-svp-render.cpp,
+ src/libnrtype/FontFactory.cpp, src/libnrtype/Layout-TNG-Output.cpp,
+ src/libnrtype/nr-type-primitives.cpp, src/path-chemistry.cpp,
+ src/splivarot.cpp, src/sp-marker.cpp, src/ui/widget/icon-widget.cpp,
+ src/widgets/icon.cpp:
+
+ 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)
+
2006-05-28 MenTaLguY <mental@rydia.net>
* share/icons/icons.svg:
index 64edcbfd59e920fd9bec0d2369e2da44424ff981..e47437c724c61e0c86ebd2ff44bdd518164d02e8 100644 (file)
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include <glib/gmem.h>
#include <gtk/gtk.h>
#include <glibmm/i18n.h>
int height = ibox.y1 - ibox.y0;
/* Set up pixblock */
- guchar *px = nr_new(guchar, 4 * width * height);
+ guchar *px = g_new(guchar, 4 * width * height);
memset(px, 0x00, 4 * width * height);
/* Render */
index 6641b3bfb44c0b42fd7e3237cd70551ad06e84da..90f48a4a6f320963350484fb1bd0122d4d44db26 100644 (file)
#include <gtk/gtk.h>
+#include <glib/gmem.h>
#include <gtk/gtkdialog.h> //for GTK_RESPONSE* types
#include <glibmm/i18n.h>
#include <gtkmm/buttonbox.h>
pixMem[i] = new guchar[4 * sizes[i] * sizes[i]];
memset( pixMem[i], 0x00, 4 * sizes[i] * sizes[i] );
- GdkPixbuf *pb = gdk_pixbuf_new_from_data( pixMem[i], GDK_COLORSPACE_RGB, TRUE, 8, sizes[i], sizes[i], sizes[i] * 4, /*(GdkPixbufDestroyNotify)nr_free*/NULL, NULL );
+ GdkPixbuf *pb = gdk_pixbuf_new_from_data( pixMem[i], GDK_COLORSPACE_RGB, TRUE, 8, sizes[i], sizes[i], sizes[i] * 4, /*(GdkPixbufDestroyNotify)g_free*/NULL, NULL );
GtkImage* img = GTK_IMAGE( gtk_image_new_from_pixbuf( pb ) );
images[i] = Glib::wrap(img);
Glib::ustring label(*labels[i]);
index 5fefb8aa9d565eb58123de3a63ebed7125b0a34a..8f345d83797c46a34afb96065dd79939e55f0860 100644 (file)
+#include <glib/gmem.h>
#include <gtk/gtk.h>
#include <glibmm/i18n.h>
ua.y1 = MIN(ibox.y1, area.y1);
/* Set up pixblock */
- guchar *px = nr_new(guchar, 4 * size * size);
+ guchar *px = g_new(guchar, 4 * size * size);
memset(px, 0x00, 4 * size * size);
/* Render */
GDK_COLORSPACE_RGB,
TRUE,
8, size, size, size * 4,
- (GdkPixbufDestroyNotify)nr_free,
+ (GdkPixbufDestroyNotify)g_free,
NULL));
return pb;
}
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index bbbba09f0da72ceed33dfc917f882976a642cf94..9e571fdd0518305801b71b09c8a85f71ebd33919 100644 (file)
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
*/
+#include <glib/gmem.h>
#include <display/curve.h>
#include <libnr/n-art-bpath.h>
#include <libnr/nr-point-matrix-ops.h>
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;
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;
}
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));
}
if (curve->refcount < 1) {
if (curve->_bpath) {
- nr_free(curve->_bpath);
+ g_free(curve->_bpath);
}
g_free(curve);
}
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;
}
*/
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;
}
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;
}
index edd429f0d10b2a40cd4a2dc7aefef865172eaf68..8ce4a35b483991a24b3ee4b88df61daa292e211c 100644 (file)
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;
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;
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;
}
}
}
- if ( canvas->tiles ) free(canvas->tiles);
+ if ( canvas->tiles ) g_free(canvas->tiles);
canvas->tiles=ntiles;
canvas->tLeft=tl;
canvas->tTop=tt;
index acbd6ae80af7bd128d1e21e08ac0947af5d41206..ef0f47397dfc043391a5bbab72e61387db6a4dca 100644 (file)
#include "display/canvas-bpath.h"
#include "display/bezier-utils.h"
+#include <glib/gmem.h>
#include "macros.h"
#include "document.h"
#include "selection.h"
abp = nr_artpath_affine(sp_curve_first_bpath(dc->accumulated), sp_desktop_dt2root_affine(desktop));
str = sp_svg_write_path(abp);
g_assert( str != NULL );
- nr_free(abp);
+ g_free(abp);
dc->repr->setAttribute("d", str);
g_free(str);
} else {
index 6c6563e7ebd0f5ead2921cfc0214403e78c043c6..4bdec5f9818c59a05c0342a458c82706455d2bf6 100644 (file)
i = 0;
while (s[i].code != NR_END) i += 1;
- ArtBpath* d = nr_new (ArtBpath, i + 1);
+ ArtBpath* d = g_new (ArtBpath, i + 1);
i = 0;
while (s[i].code != NR_END) {
index ed98c4a2913477e4cc6e42d5391b19121dea9c52..938f570b79f1e01426a400171a1d8399ee35f00d 100644 (file)
#include <signal.h>\r
#include <errno.h>\r
\r
+#include <glib/gmem.h>\r
#include <libnr/n-art-bpath.h>\r
#include <libnr/nr-point-matrix-ops.h>\r
\r
\r
nr_arena_item_set_transform(mod->root, &affine);\r
\r
- guchar *const px = nr_new(guchar, 4 * width * 64);\r
+ guchar *const px = g_new(guchar, 4 * width * 64);\r
\r
for (int y = 0; y < height; y += 64) {\r
/* Set area of interest. */\r
print_image(_stream, px, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0, 4 * width, &imgt);\r
}\r
\r
- nr_free(px);\r
+ g_free(px);\r
}\r
\r
pdf_file->end_page(page_stream);\r
index c814637c6165983b7e3ce9bfe39a8576c21c00be..a72b88461804a76801932a9fe0a6c0cbc7ec869d 100644 (file)
#include <libnr/n-art-bpath.h>
+#include <glib/gmem.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkframe.h>
nr_arena_item_set_transform(mod->root, &affine);
- guchar *const px = nr_new(guchar, 4 * width * 64);
+ guchar *const px = g_new(guchar, 4 * width * 64);
for (int y = 0; y < height; y += 64) {
/* Set area of interest. */
print_image(_stream, px, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0, 4 * width, &imgt);
}
- nr_free(px);
+ g_free(px);
}
fprintf(_stream, "showpage\n");
index 335a77a09c1c18db71f14fdee6543174ecd4cfa6..51dbd3a00f09a8e66ff91cb943b4eb68dda40133 100644 (file)
# include "config.h"
#endif
+#include <glib/gmem.h>
#include <libnr/nr-macros.h>
#include <libnr/nr-matrix.h>
width = x1 - x0;
height = y1 - y0;
- px = nr_new (unsigned char, 4 * 64 * width);
+ px = g_new (unsigned char, 4 * 64 * width);
sheight = 64;
/* Printing goes here */
nr_pixblock_release (&pb);
}
- nr_free (px);
+ g_free (px);
res = EndPage (_hDC);
res = EndDoc (_hDC);
diff --git a/src/file.cpp b/src/file.cpp
index 4d96899da117579869922e3d0ff55e1db3d2d1d7..de9b615aad4ada7996f8344316f5b2910b367c74 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
# include "config.h"
#endif
+#include <glib/gmem.h>
#include <libnr/nr-pixops.h>
#include "document-private.h"
write_status = sp_png_write_rgba_striped(filename, width, height, sp_export_get_rows, &ebp);
nr_pixelstore_64K_free(ebp.px);
} else {
- ebp.px = nr_new(guchar, 4 * 64 * width);
+ ebp.px = g_new(guchar, 4 * 64 * width);
ebp.sheight = 64;
write_status = sp_png_write_rgba_striped(filename, width, height, sp_export_get_rows, &ebp);
- nr_free(ebp.px);
+ g_free(ebp.px);
}
// Hide items
diff --git a/src/inkview.cpp b/src/inkview.cpp
index 8be261dcdfc3273213cb352c1bbbfe49b1fe2e19..0e2179283e30be504534cb503c29f4d66757b10f 100644 (file)
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
#include <sys/stat.h>
#include <locale.h>
+#include <glib/gmem.h>
#include <libnr/nr-macros.h>
#include <libxml/tree.h>
ss.size = 32;
ss.length = 0;
ss.current = 0;
- ss.slides = nr_new (char *, ss.size);
+ ss.slides = g_new (char *, ss.size);
ss.current = 0;
ss.doc = NULL;
ss.view = NULL;
if (ss.length >= ss.size) {
/* Expand */
ss.size <<= 1;
- ss.slides = nr_renew (ss.slides, char *, ss.size);
+ ss.slides = g_renew (char *, ss.slides, ss.size);
}
ss.doc = sp_document_new_from_mem ((const gchar *)gba->data,
if (ss.length >= ss.size) {
/* Expand */
ss.size <<= 1;
- ss.slides = nr_renew (ss.slides, char *, ss.size);
+ ss.slides = g_renew (char *, ss.slides, ss.size);
}
diff --git a/src/libnr/nr-macros.h b/src/libnr/nr-macros.h
index 74a627ae7c2a1cc3ee4f6c3927aa0c3ab506afaa..616504c6f8674b2b7f8a07baa48b7b79b59d282d 100644 (file)
--- a/src/libnr/nr-macros.h
+++ b/src/libnr/nr-macros.h
#endif
#include <assert.h>
-#define nr_new(t,n) ((t *) malloc ((n) * sizeof (t)))
-#define nr_free free
-#define nr_renew(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
-
#ifndef TRUE
#define TRUE (!0)
#endif
index feffbd884d2f97cccd3218d34874e9c99d1af52b..12f57bd81f81deeecb40ee1a4c3643095b13f712 100644 (file)
--- a/src/libnr/nr-object.cpp
+++ b/src/libnr/nr-object.cpp
#include <typeinfo>
+#include <glib/gmem.h>
#include <libnr/nr-macros.h>
#include "nr-object.h"
{
if (classes_len >= classes_size) {
classes_size += 32;
- classes = nr_renew (classes, NRObjectClass *, classes_size);
+ classes = g_renew (NRObjectClass *, classes, classes_size);
if (classes_len == 0) {
classes[0] = NULL;
classes_len = 1;
listener->vector->dispose(object, listener->data);
}
}
- free (aobject->callbacks);
+ g_free (aobject->callbacks);
}
((NRObjectClass *) (parent_class))->finalize(object);
void *data)
{
if (!object->callbacks) {
- object->callbacks = (NRObjectCallbackBlock*) malloc(sizeof(NRObjectCallbackBlock));
+ object->callbacks = (NRObjectCallbackBlock*)g_malloc(sizeof(NRObjectCallbackBlock));
object->callbacks->size = 1;
object->callbacks->length = 0;
}
if (object->callbacks->length >= object->callbacks->size) {
int newsize = object->callbacks->size << 1;
object->callbacks = (NRObjectCallbackBlock *)
- realloc(object->callbacks, sizeof(NRObjectCallbackBlock) + (newsize - 1) * sizeof (NRObjectListener));
+ g_realloc(object->callbacks, sizeof(NRObjectCallbackBlock) + (newsize - 1) * sizeof (NRObjectListener));
object->callbacks->size = newsize;
}
@@ -293,7 +294,7 @@ void nr_active_object_remove_listener_by_data(NRActiveObject *object, void *data
if ( listener->data == data ) {
object->callbacks->length -= 1;
if ( object->callbacks->length < 1 ) {
- free(object->callbacks);
+ g_free(object->callbacks);
object->callbacks = NULL;
} else if ( object->callbacks->length != i ) {
*listener = object->callbacks->listeners[object->callbacks->length];
diff --git a/src/libnr/nr-path.cpp b/src/libnr/nr-path.cpp
index 6ce2f5f9922305d66d036eda8fe993b0f088576a..99adcb3e1d483400fe1127bcfe78871ff8a05f44 100644 (file)
--- a/src/libnr/nr-path.cpp
+++ b/src/libnr/nr-path.cpp
* This code is in public domain
*/
+#include <glib/gmem.h>
#include "n-art-bpath.h"
#include "nr-rect.h"
#include "nr-path.h"
i = 0;
while (s->path[i].code != NR_END) i += 1;
- d->path = nr_new (NArtBpath, i + 1);
+ d->path = g_new (NArtBpath, i + 1);
i = 0;
while (s->path[i].code != NR_END) {
index 03bd688ba0dbb62933eabb6bc8a737973365c057..b4e25638f383e2535f10e981deb4eb2d68ffd736 100644 (file)
*/
+#include <glib/gmem.h>
#include "nr-pixops.h"
#include "nr-pixblock-pattern.h"
if (!noise) {
int i;
- noise = nr_new (unsigned char, NR_NOISE_SIZE);
+ noise = g_new (unsigned char, NR_NOISE_SIZE);
for (i = 0; i < NR_NOISE_SIZE; i++) noise[i] = (rand () / (RAND_MAX >> 8)) & 0xff;
}
index 59e64b558e367d040a2c987a6ccfe3e818c82a72..079bca6cab61fd5e64940e24f8f8d12bf34824b8 100644 (file)
* This code is in the Public Domain
*/
+#include <glib/gmem.h>
#include "nr-pixblock.h"
/// Size of buffer that needs no allocation (default 4).
pb->data.px = nr_pixelstore_1M_new (clear, 0x0);
} else {
pb->size = NR_PIXBLOCK_SIZE_BIG;
- pb->data.px = nr_new (unsigned char, size);
+ pb->data.px = g_new (unsigned char, size);
if (clear) memset (pb->data.px, 0x0, size);
}
}
/**
- * Pixbuf initialisation using nr_new.
+ * Pixbuf initialisation using g_new.
*
* After allocating memory, the buffer is cleared if the clear flag is set.
* \param pb Pointer to the pixbuf struct.
if (clear) memset (pb->data.p, 0x0, size);
} else {
pb->size = NR_PIXBLOCK_SIZE_BIG;
- pb->data.px = nr_new (unsigned char, size);
+ pb->data.px = g_new (unsigned char, size);
if (clear) memset (pb->data.px, 0x0, size);
}
nr_pixelstore_1M_free (pb->data.px);
break;
case NR_PIXBLOCK_SIZE_BIG:
- nr_free (pb->data.px);
+ g_free (pb->data.px);
break;
case NR_PIXBLOCK_SIZE_STATIC:
break;
* Allocates NRPixBlock and sets it up.
*
* \return Pointer to fresh pixblock.
- * Calls nr_new() and nr_pixblock_setup().
+ * Calls g_new() and nr_pixblock_setup().
*/
NRPixBlock *
nr_pixblock_new (NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, bool clear)
{
NRPixBlock *pb;
- pb = nr_new (NRPixBlock, 1);
+ pb = g_new (NRPixBlock, 1);
nr_pixblock_setup (pb, mode, x0, y0, x1, y1, clear);
{
nr_pixblock_release (pb);
- nr_free (pb);
+ g_free (pb);
return NULL;
}
nr_4K_len -= 1;
px = nr_4K_px[nr_4K_len];
} else {
- px = nr_new (unsigned char, 4096);
+ px = g_new (unsigned char, 4096);
}
if (clear) memset (px, val, 4096);
{
if (nr_4K_len == nr_4K_size) {
nr_4K_size += NR_4K_BLOCK;
- nr_4K_px = nr_renew (nr_4K_px, unsigned char *, nr_4K_size);
+ nr_4K_px = g_renew (unsigned char *, nr_4K_px, nr_4K_size);
}
nr_4K_px[nr_4K_len] = px;
nr_16K_len -= 1;
px = nr_16K_px[nr_16K_len];
} else {
- px = nr_new (unsigned char, 16384);
+ px = g_new (unsigned char, 16384);
}
if (clear) memset (px, val, 16384);
{
if (nr_16K_len == nr_16K_size) {
nr_16K_size += NR_16K_BLOCK;
- nr_16K_px = nr_renew (nr_16K_px, unsigned char *, nr_16K_size);
+ nr_16K_px = g_renew (unsigned char *, nr_16K_px, nr_16K_size);
}
nr_16K_px[nr_16K_len] = px;
nr_64K_len -= 1;
px = nr_64K_px[nr_64K_len];
} else {
- px = nr_new (unsigned char, 65536);
+ px = g_new (unsigned char, 65536);
}
if (clear) memset (px, val, 65536);
{
if (nr_64K_len == nr_64K_size) {
nr_64K_size += NR_64K_BLOCK;
- nr_64K_px = nr_renew (nr_64K_px, unsigned char *, nr_64K_size);
+ nr_64K_px = g_renew (unsigned char *, nr_64K_px, nr_64K_size);
}
nr_64K_px[nr_64K_len] = px;
nr_256K_len -= 1;
px = nr_256K_px[nr_256K_len];
} else {
- px = nr_new (unsigned char, NR_256K);
+ px = g_new (unsigned char, NR_256K);
}
if (clear) memset (px, val, NR_256K);
{
if (nr_256K_len == nr_256K_size) {
nr_256K_size += NR_256K_BLOCK;
- nr_256K_px = nr_renew (nr_256K_px, unsigned char *, nr_256K_size);
+ nr_256K_px = g_renew (unsigned char *, nr_256K_px, nr_256K_size);
}
nr_256K_px[nr_256K_len] = px;
nr_1M_len -= 1;
px = nr_1M_px[nr_1M_len];
} else {
- px = nr_new (unsigned char, NR_1M);
+ px = g_new (unsigned char, NR_1M);
}
if (clear) memset (px, val, NR_1M);
{
if (nr_1M_len == nr_1M_size) {
nr_1M_size += NR_1M_BLOCK;
- nr_1M_px = nr_renew (nr_1M_px, unsigned char *, nr_1M_size);
+ nr_1M_px = g_renew (unsigned char *, nr_1M_px, nr_1M_size);
}
nr_1M_px[nr_1M_len] = px;
index 0c3b391d5261251622e487b706d91abeb7cea1b0..0ca73bc0e37cb2f7b310b35c21107ab2883b3755 100644 (file)
#define noNR_VERBOSE
+#include <glib/gmem.h>
#include "nr-svp-render.h"
static void nr_svp_render (NRSVP *svp, unsigned char *px, unsigned int bpp, unsigned int rs, int x0, int y0, int x1, int y1,
if (s == NULL) {
int i;
- s = nr_new (NRSlice, NR_SLICE_ALLOC_SIZE);
+ s = g_new (NRSlice, NR_SLICE_ALLOC_SIZE);
for (i = 1; i < (NR_SLICE_ALLOC_SIZE - 1); i++) s[i].next = &s[i + 1];
s[NR_SLICE_ALLOC_SIZE - 1].next = NULL;
ffslice = s + 1;
if (r == NULL) {
int i;
- r = nr_new (NRRun, NR_RUN_ALLOC_SIZE);
+ r = g_new (NRRun, NR_RUN_ALLOC_SIZE);
for (i = 1; i < (NR_RUN_ALLOC_SIZE - 1); i++) (r + i)->next = (r + i + 1);
(r + NR_RUN_ALLOC_SIZE - 1)->next = NULL;
ffrun = r + 1;
diff --git a/src/libnr/nr-svp.cpp b/src/libnr/nr-svp.cpp
index a1484397a269a13efb3becbdfac4fb7583fbbde0..7fa2cfd3690b16884681f0847cde0ae5fb2d4a00 100644 (file)
--- a/src/libnr/nr-svp.cpp
+++ b/src/libnr/nr-svp.cpp
# include <ieeefp.h>
#endif
+#include <glib/gmem.h>
#include "nr-rect.h"
#include "nr-svp-private.h"
void
nr_svp_free (NRSVP *svp)
{
- if (svp->points) nr_free (svp->points);
+ if (svp->points) g_free (svp->points);
free (svp);
}
if (v == NULL) {
int i;
- v = nr_new (NRVertex, NR_VERTEX_ALLOC_SIZE);
+ v = g_new (NRVertex, NR_VERTEX_ALLOC_SIZE);
for (i = 1; i < (NR_VERTEX_ALLOC_SIZE - 1); i++) v[i].next = &v[i + 1];
v[NR_VERTEX_ALLOC_SIZE - 1].next = NULL;
ffvertex = v + 1;
ffvertex = v->next;
}
#else
- v = nr_new (NRVertex, 1);
+ v = g_new (NRVertex, 1);
#endif
v->next = NULL;
v->next = ffvertex;
ffvertex = v;
#else
- nr_free (v);
+ g_free (v);
#endif
}
l = v;
while (l) {
n = l->next;
- nr_free (l);
+ g_free (l);
l = n;
}
#endif
index 5fc7e0b3b36b6ebb2bd69a52f16a6e5f49ede4c1..b55dc50c2c49b983e259174e1d6de08980a6379c 100644 (file)
# include "config.h"
#endif
+#include <glib/gmem.h>
#include <glibmm/i18n.h> // _()
/* Freetype2 */
static void font_factory_name_list_destructor(NRNameList *list)
{
for (unsigned int i = 0; i < list->length; i++)
- free(list->names[i]);
- if ( list->names ) nr_free(list->names);
+ g_free(list->names[i]);
+ if ( list->names ) g_free(list->names);
}
static void font_factory_style_list_destructor(NRStyleList *list)
{
for (unsigned int i = 0; i < list->length; i++) {
- free((void *) (list->records)[i].name);
- free((void *) (list->records)[i].descr);
+ g_free((void *) (list->records)[i].name);
+ g_free((void *) (list->records)[i].descr);
}
- if ( list->records ) nr_free(list->records);
+ if ( list->records ) g_free(list->records);
}
/**
fontSize = 512;
nbEnt = 0;
maxEnt = 32;
- ents = (font_entry*)malloc(maxEnt*sizeof(font_entry));
+ ents = (font_entry*)g_malloc(maxEnt*sizeof(font_entry));
#ifdef USE_PANGO_WIN32
hScreenDC = pango_win32_get_dc();
font_factory::~font_factory(void)
{
for (int i = 0;i < nbEnt;i++) ents[i].f->Unref();
- if ( ents ) free(ents);
+ if ( ents ) g_free(ents);
g_object_unref(fontServer);
#ifdef USE_PANGO_WIN32
if ( canFail ) {
char *tc = pango_font_description_to_string(descr);
PANGO_DEBUG("falling back from %s to Sans because InstallFace failed\n",tc);
- free(tc);
+ g_free(tc);
pango_font_description_set_family(descr,"Sans");
res = Face(descr,false);
}
// not found
char *tc = pango_font_description_to_string(who->descr);
g_warning("unrefFace %p=%s: failed\n",who,tc);
- free(tc);
+ g_free(tc);
} else {
loadedFaces.erase(loadedFaces.find(who->descr));
// printf("unrefFace %p: success\n",who);
PANGO_DEBUG("got %d families\n", nbFam);
flist->length = nbFam;
- flist->names = (guchar **)malloc(nbFam*sizeof(guchar*));
+ flist->names = (guchar **)g_malloc(nbFam*sizeof(guchar*));
flist->destructor = font_factory_name_list_destructor;
for (int i = 0;i < nbFam;i++) {
int nFaces = 0;
pango_font_family_list_faces(theFam, &faces, &nFaces);
- slist->records = (NRStyleRecord *) malloc(nFaces * sizeof(NRStyleRecord));
+ slist->records = (NRStyleRecord *) g_malloc(nFaces * sizeof(NRStyleRecord));
slist->destructor = font_factory_style_list_destructor;
int nr = 0;
index bdcc6cf3f099982e83a09967a86fbb8d5b531d4f..40bd71027f5f8b870b485facf0f010e2f8379a36 100755 (executable)
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#include <glib/gmem.h>
#include "Layout-TNG.h"
#include "display/nr-arena-glyphs.h"
#include "style.h"
sp_print_fill(ctx, &abp, &ctm, text_source->style, pbox, dbox, bbox);
if (text_source->style->stroke.type != SP_PAINT_TYPE_NONE)
sp_print_stroke(ctx, &abp, &ctm, text_source->style, pbox, dbox, bbox);
- nr_free(abp.path);
+ g_free(abp.path);
}
glyph_index++;
} else {
index 616134383d15eeaacc0eae0d95b8afcdf20d76bd..34b1e43b814ed84f1d2cec3159050e6aec596f1f 100644 (file)
#include <stdlib.h>
#include <string.h>
+#include <glib/gmem.h>
#include <libnr/nr-macros.h>
#include "nr-type-primitives.h"
NRTypeDict *td;
int i;
- td = nr_new (NRTypeDict, 1);
+ td = g_new (NRTypeDict, 1);
td->size = NR_DICTSIZE;
- td->entries = nr_new (NRTDEntry *, td->size);
+ td->entries = g_new (NRTDEntry *, td->size);
for (i = 0; i < NR_DICTSIZE; i++) {
td->entries[i] = NULL;
}
if (!nr_tde_free_list) {
int i;
- nr_tde_free_list = nr_new (NRTDEntry, NR_TDE_BLOCK_SIZE);
+ nr_tde_free_list = g_new (NRTDEntry, NR_TDE_BLOCK_SIZE);
for (i = 0; i < (NR_TDE_BLOCK_SIZE - 1); i++) {
nr_tde_free_list[i].next = nr_tde_free_list + i + 1;
}
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index c11754ecee4ce4316db5a543fa3c0c145f8e867d..ba181476f8add21aa3660c6c1ceb04888de58410 100644 (file)
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
#include "xml/repr.h"
#include "svg/svg.h"
#include "display/curve.h"
+#include <glib/gmem.h>
#include <glibmm/i18n.h>
#include "sp-path.h"
#include "sp-text.h"
NArtBpath *abp = nr_artpath_affine(SP_CURVE_BPATH(c), SP_ITEM(path)->transform);
sp_curve_unref(c);
gchar *str = sp_svg_write_path(abp);
- nr_free(abp);
+ g_free(abp);
dstring = g_string_append(dstring, str);
g_free(str);
diff --git a/src/sp-marker.cpp b/src/sp-marker.cpp
index 0b4d954bf5280d10893417bd91f6c1a9d8622f80..5a5a9fc6bfb91daf343dc6f77a0f7889d4416c89 100644 (file)
--- a/src/sp-marker.cpp
+++ b/src/sp-marker.cpp
@@ -541,7 +541,7 @@ sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size)
view = NULL;
}
if (!view) {
- view = (SPMarkerView *)malloc (sizeof (SPMarkerView) + (size) * sizeof (NRArenaItem *));
+ view = (SPMarkerView *)g_malloc (sizeof (SPMarkerView) + (size) * sizeof (NRArenaItem *));
for (i = 0; i < size; i++) view->items[i] = NULL;
view->next = marker->views;
marker->views = view;
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 057ebac5a03f8de1deb618cd3aa180c720702770..ed7e341478ecf28af15eccecb4e46043ae75b98b 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
#endif
#include <vector>
+#include <glib/gmem.h>
#include "xml/repr.h"
#include "svg/svg.h"
#include "sp-path.h"
}
if ( doTransformation ) {
- if ( bpath ) nr_free(bpath);
+ if ( bpath ) g_free(bpath);
} else {
sp_curve_unref(curve);
}
index c456778b62537cdfc2f5ca1b930a29e87cf82ddd..7e812236f63927670a317f0fcca88be25fe5078a 100644 (file)
# include <config.h>
#endif
+#include <glib/gmem.h>
#include "icon-widget.h"
namespace Inkscape {
/* TODO
_pb = gdk_pixbuf_new_from_data(pixels, GDK_COLORSPACE_RGB,
TRUE, 8, _size, _size, _size * 4,
- (GdkPixbufDestroyNotify)nr_free, NULL);
+ (GdkPixbufDestroyNotify)g_free, NULL);
*/
}
}
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 0aa01a37e36daaea75d0a9d91f7ba9ed2ba58f59..264349bd17f50a7d898c7d8e86400d32e04a3de6 100644 (file)
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
+#include <glib/gmem.h>
#include <gtk/gtkiconfactory.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkimage.h>
pixels = sp_icon_image_load( icon, icon->name );
if (pixels) {
- // don't pass the nr_free because we're caching the pixel
+ // don't pass the g_free because we're caching the pixel
// space loaded through ...
// I just changed this. make sure sp_icon_image_load still does the right thing.
icon->pb = gdk_pixbuf_new_from_data(pixels, GDK_COLORSPACE_RGB, TRUE, 8,
icon->psize, icon->psize, icon->psize * 4,
- /*(GdkPixbufDestroyNotify)nr_free*/NULL, NULL);
+ /*(GdkPixbufDestroyNotify)g_free*/NULL, NULL);
icon->pb_faded = gdk_pixbuf_copy(icon->pb);
pixels = gdk_pixbuf_get_pixels(icon->pb_faded);
}
guchar *spx = gdk_pixbuf_get_pixels(pb);
int srs = gdk_pixbuf_get_rowstride(pb);
- px = nr_new(guchar, 4 * psize * psize);
+ px = g_new(guchar, 4 * psize * psize);
for (unsigned y = 0; y < psize; y++) {
memcpy(px + 4 * y * psize, spx + y * srs, 4 * psize);
}
g_message( " ua --'%s' (%f,%f)-(%f,%f)", name, (double)ua.x0, (double)ua.y0, (double)ua.x1, (double)ua.y1 );
}
/* Set up pixblock */
- px = nr_new(guchar, 4 * psize * psize);
+ px = g_new(guchar, 4 * psize * psize);
memset(px, 0x00, 4 * psize * psize);
/* Render */
NRPixBlock B;