Use the slice allocator for regions. Still todo: avoid extra allocations

2005-12-21  Matthias Clasen  <mclasen@redhat.com>

	* gdk/gdkregion-generic.c: Use the slice allocator
	for regions. Still todo: avoid extra allocations for
	the single-rectangle case.
This commit is contained in:
Matthias Clasen 2005-12-21 21:10:41 +00:00 committed by Matthias Clasen
parent 2962480b2c
commit fe0fb8966d
3 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,9 @@
2005-12-21 Matthias Clasen <mclasen@redhat.com> 2005-12-21 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkregion-generic.c: Use the slice allocator
for regions. Still todo: avoid extra allocations for
the single-rectangle case.
* gtk/gtksettings.c (gtk_settings_class_init): Update * gtk/gtksettings.c (gtk_settings_class_init): Update
class_n_properties after installing color-hash, since class_n_properties after installing color-hash, since
other classes install settings, too. other classes install settings, too.

View File

@ -1,5 +1,9 @@
2005-12-21 Matthias Clasen <mclasen@redhat.com> 2005-12-21 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkregion-generic.c: Use the slice allocator
for regions. Still todo: avoid extra allocations for
the single-rectangle case.
* gtk/gtksettings.c (gtk_settings_class_init): Update * gtk/gtksettings.c (gtk_settings_class_init): Update
class_n_properties after installing color-hash, since class_n_properties after installing color-hash, since
other classes install settings, too. other classes install settings, too.

View File

@ -112,7 +112,7 @@ gdk_region_new ()
{ {
GdkRegion *temp; GdkRegion *temp;
temp = g_new (GdkRegion, 1); temp = g_slice_new (GdkRegion);
temp->rects = g_new (GdkRegionBox, 1); temp->rects = g_new (GdkRegionBox, 1);
temp->numRects = 0; temp->numRects = 0;
@ -143,7 +143,7 @@ gdk_region_rectangle (GdkRectangle *rectangle)
if (rectangle->width <= 0 || rectangle->height <= 0) if (rectangle->width <= 0 || rectangle->height <= 0)
return gdk_region_new(); return gdk_region_new();
temp = g_new (GdkRegion, 1); temp = g_slice_new (GdkRegion);
temp->rects = g_new (GdkRegionBox, 1); temp->rects = g_new (GdkRegionBox, 1);
temp->numRects = 1; temp->numRects = 1;
@ -171,7 +171,7 @@ gdk_region_copy (GdkRegion *region)
g_return_val_if_fail (region != NULL, NULL); g_return_val_if_fail (region != NULL, NULL);
temp = g_new (GdkRegion, 1); temp = g_slice_new (GdkRegion);
temp->rects = g_new (GdkRegionBox, region->numRects); temp->rects = g_new (GdkRegionBox, region->numRects);
temp->numRects = region->numRects; temp->numRects = region->numRects;
@ -330,7 +330,7 @@ gdk_region_destroy (GdkRegion *r)
g_return_if_fail (r != NULL); g_return_if_fail (r != NULL);
g_free (r->rects); g_free (r->rects);
g_free (r); g_slice_free (GdkRegion, r);
} }