summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2010-08-16 04:50:22 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-03-24 17:35:54 -0400
commit1a289b4be8dd1dd5ab9bc5a8e7e0c3f7169a52e1 (patch)
tree066fbb4f8268dfd4fe4a0801c437feb86916de5d
parent5c1608b94b06c38ad854041b280cf731bc987623 (diff)
Allocate only the necessary number of bytes for a given image.
Previously we would allocate the full size of pixman_image_t. That didn't matter too much because most images are bits images and those used to be the biggest image type. However, that's not the case anymore. Now bits images are 184 bytes and radial gradient images are 192 bytes on 64 bit.
-rw-r--r--pixman/pixman-conical-gradient.c2
-rw-r--r--pixman/pixman-linear-gradient.c2
-rw-r--r--pixman/pixman-private.h2
-rw-r--r--pixman/pixman-radial-gradient.c2
-rw-r--r--pixman/pixman-solid-fill.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/pixman/pixman-conical-gradient.c b/pixman/pixman-conical-gradient.c
index 791d4f34..57e60f4c 100644
--- a/pixman/pixman-conical-gradient.c
+++ b/pixman/pixman-conical-gradient.c
@@ -185,7 +185,7 @@ pixman_image_create_conical_gradient (pixman_point_fixed_t * center,
const pixman_gradient_stop_t *stops,
int n_stops)
{
- pixman_image_t *image = _pixman_image_allocate ();
+ pixman_image_t *image = _pixman_image_allocate (sizeof (conical_gradient_t));
conical_gradient_t *conical;
if (!image)
diff --git a/pixman/pixman-linear-gradient.c b/pixman/pixman-linear-gradient.c
index 6e1ea24b..941645db 100644
--- a/pixman/pixman-linear-gradient.c
+++ b/pixman/pixman-linear-gradient.c
@@ -263,7 +263,7 @@ pixman_image_create_linear_gradient (pixman_point_fixed_t * p1,
pixman_image_t *image;
linear_gradient_t *linear;
- image = _pixman_image_allocate ();
+ image = _pixman_image_allocate (sizeof (linear_gradient_t));
if (!image)
return NULL;
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 6e9732cf..3a05372a 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -296,7 +296,7 @@ pixman_bool_t
_pixman_image_fini (pixman_image_t *image);
pixman_image_t *
-_pixman_image_allocate (void);
+_pixman_image_allocate (int n_bytes);
pixman_bool_t
_pixman_init_gradient (gradient_t * gradient,
diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c
index b6dd6b2c..865c93b3 100644
--- a/pixman/pixman-radial-gradient.c
+++ b/pixman/pixman-radial-gradient.c
@@ -430,7 +430,7 @@ pixman_image_create_radial_gradient (pixman_point_fixed_t * inner,
pixman_image_t *image;
radial_gradient_t *radial;
- image = _pixman_image_allocate ();
+ image = _pixman_image_allocate (sizeof (radial_gradient_t));
if (!image)
return NULL;
diff --git a/pixman/pixman-solid-fill.c b/pixman/pixman-solid-fill.c
index 852e1356..abb7c089 100644
--- a/pixman/pixman-solid-fill.c
+++ b/pixman/pixman-solid-fill.c
@@ -74,7 +74,7 @@ color_to_uint64 (const pixman_color_t *color)
PIXMAN_EXPORT pixman_image_t *
pixman_image_create_solid_fill (pixman_color_t *color)
{
- pixman_image_t *img = _pixman_image_allocate ();
+ pixman_image_t *img = _pixman_image_allocate (sizeof (solid_fill_t));
if (!img)
return NULL;