diff options
author | Dom Lachowicz <doml@src.gnome.org> | 2004-08-14 00:53:54 +0000 |
---|---|---|
committer | Dom Lachowicz <doml@src.gnome.org> | 2004-08-14 00:53:54 +0000 |
commit | 15752d078ed4aa3639a78d488fde91fb06e5fd59 (patch) | |
tree | 19e2e56411b09c1abbb9667f910b8aacc75e069e | |
parent | 8522ed25581374d5e052554a8616c7d67b8b1505 (diff) | |
download | librsvg-15752d078ed4aa3639a78d488fde91fb06e5fd59.tar.gz |
small optimizations wrt getting new empty pixbufs
-rw-r--r-- | rsvg-filter.c | 50 | ||||
-rw-r--r-- | rsvg-mask.c | 13 | ||||
-rw-r--r-- | rsvg-paint-server.c | 8 | ||||
-rw-r--r-- | rsvg-private.h | 4 |
4 files changed, 36 insertions, 39 deletions
diff --git a/rsvg-filter.c b/rsvg-filter.c index 3f7858ff..5de70908 100644 --- a/rsvg-filter.c +++ b/rsvg-filter.c @@ -172,9 +172,9 @@ rsvg_filter_primitive_get_bounds (RsvgFilterPrimitive * self, return output; } -static GdkPixbuf * -gdk_pixbuf_new_cleared (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, - int width, int height) +GdkPixbuf * +_rsvg_pixbuf_new_cleared (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, + int width, int height) { GdkPixbuf *pb; guchar *data; @@ -507,9 +507,9 @@ pixbuf_get_alpha (GdkPixbuf * pb) pbsize = gdk_pixbuf_get_width (pb) * gdk_pixbuf_get_height (pb); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, - gdk_pixbuf_get_width (pb), - gdk_pixbuf_get_height (pb)); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, + gdk_pixbuf_get_width (pb), + gdk_pixbuf_get_height (pb)); data = gdk_pixbuf_get_pixels (output); pbdata = gdk_pixbuf_get_pixels (pb); @@ -912,7 +912,7 @@ rsvg_filter_primitive_blend_render (RsvgFilterPrimitive * self, in = rsvg_filter_get_in (self->in, ctx); in2 = rsvg_filter_get_in (bself->in2, ctx); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, gdk_pixbuf_get_width (in), gdk_pixbuf_get_height (in)); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, gdk_pixbuf_get_width (in), gdk_pixbuf_get_height (in)); rsvg_filter_blend(bself->mode, in, in2, output, boundarys); @@ -1136,7 +1136,7 @@ rsvg_filter_primitive_convolve_matrix_render (RsvgFilterPrimitive * self, rowstride = gdk_pixbuf_get_rowstride (in); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); for (y = boundarys.y1; y < boundarys.y2; y++) @@ -1721,10 +1721,10 @@ fast_blur (GdkPixbuf *in, GdkPixbuf *output, gfloat sx, kx = floor(sx * 3*sqrt(2*M_PI)/4 + 0.5); ky = floor(sy * 3*sqrt(2*M_PI)/4 + 0.5); - intermediate1 = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, + intermediate1 = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, gdk_pixbuf_get_width (in), gdk_pixbuf_get_height (in)); - intermediate2 = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, + intermediate2 = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, gdk_pixbuf_get_width (in), gdk_pixbuf_get_height (in)); @@ -1757,7 +1757,7 @@ rsvg_filter_primitive_gaussian_blur_render (RsvgFilterPrimitive * self, op = rsvg_filter_get_result (self->in, ctx); in = op.result; - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, gdk_pixbuf_get_width (in), gdk_pixbuf_get_height (in)); @@ -1911,7 +1911,7 @@ rsvg_filter_primitive_offset_render (RsvgFilterPrimitive * self, rowstride = gdk_pixbuf_get_rowstride (in); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); @@ -2063,7 +2063,7 @@ rsvg_filter_primitive_merge_render (RsvgFilterPrimitive * self, mself = (RsvgFilterPrimitiveMerge *) self; boundarys = rsvg_filter_primitive_get_bounds (self, ctx); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, ctx->width, ctx->height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, ctx->width, ctx->height); for (i = 0; i < mself->nodes->len; i++) { @@ -2236,7 +2236,7 @@ rsvg_filter_primitive_colour_matrix_render (RsvgFilterPrimitive * self, rowstride = gdk_pixbuf_get_rowstride (in); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); for (y = boundarys.y1; y < boundarys.y2; y++) @@ -2585,7 +2585,7 @@ rsvg_filter_primitive_component_transfer_render (RsvgFilterPrimitive * rowstride = gdk_pixbuf_get_rowstride (in); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); @@ -2854,7 +2854,7 @@ rsvg_filter_primitive_erode_render (RsvgFilterPrimitive * self, kx = cself->rx * ctx->paffine[0]; ky = cself->ry * ctx->paffine[3]; - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); @@ -3044,7 +3044,7 @@ rsvg_filter_primitive_composite_render (RsvgFilterPrimitive * self, rowstride = gdk_pixbuf_get_rowstride (in); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); if (bself->mode == COMPOSITE_MODE_ARITHMETIC) @@ -3298,7 +3298,7 @@ rsvg_filter_primitive_flood_render (RsvgFilterPrimitive * self, height = ctx->height; width = ctx->width; - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); rowstride = gdk_pixbuf_get_rowstride (output); output_pixels = gdk_pixbuf_get_pixels (output); @@ -3462,7 +3462,7 @@ rsvg_filter_primitive_displacement_map_render (RsvgFilterPrimitive * self, rowstride = gdk_pixbuf_get_rowstride (in); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); @@ -3873,7 +3873,7 @@ rsvg_filter_primitive_turbulence_render (RsvgFilterPrimitive * self, tileWidth = (boundarys.x2 - boundarys.x1); tileHeight = (boundarys.y2 - boundarys.y1); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); for (y = 0; y < tileHeight; y++) @@ -4040,7 +4040,7 @@ rsvg_filter_primitive_image_render_in (RsvgFilterPrimitive * self, boundarys = rsvg_filter_primitive_get_bounds (self, context); - img = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, context->width, context->height); + img = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, context->width, context->height); save = ctx->pixbuf; ctx->pixbuf = img; @@ -4117,7 +4117,7 @@ rsvg_filter_primitive_image_render (RsvgFilterPrimitive * self, boundarys = rsvg_filter_primitive_get_bounds (self, ctx); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, ctx->width, ctx->height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, ctx->width, ctx->height); img = rsvg_filter_primitive_image_render_in (self, ctx); if (img == NULL) @@ -4690,7 +4690,7 @@ rsvg_filter_primitive_diffuse_lighting_render (RsvgFilterPrimitive * self, rowstride = gdk_pixbuf_get_rowstride (in); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); @@ -4887,7 +4887,7 @@ rsvg_filter_primitive_specular_lighting_render (RsvgFilterPrimitive * self, rowstride = gdk_pixbuf_get_rowstride (in); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, width, height); output_pixels = gdk_pixbuf_get_pixels (output); @@ -5088,7 +5088,7 @@ rsvg_filter_primitive_tile_render (RsvgFilterPrimitive * self, in_pixels = gdk_pixbuf_get_pixels (in); - output = gdk_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, ctx->width, ctx->height); + output = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, ctx->width, ctx->height); rowstride = gdk_pixbuf_get_rowstride (output); output_pixels = gdk_pixbuf_get_pixels (output); diff --git a/rsvg-mask.c b/rsvg-mask.c index c7b54937..0a292871 100644 --- a/rsvg-mask.c +++ b/rsvg-mask.c @@ -54,21 +54,16 @@ rsvg_mask_render (RsvgMask *self, GdkPixbuf *tos, GdkPixbuf *nos, RsvgHandle *ct drawable = (RsvgDefsDrawable*)self; - mask = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 1, 8, - gdk_pixbuf_get_width(tos), - gdk_pixbuf_get_height(tos)); - - gdk_pixbuf_fill(mask, 0x00000000); + mask = _rsvg_pixbuf_new_cleared(GDK_COLORSPACE_RGB, 1, 8, + gdk_pixbuf_get_width(tos), + gdk_pixbuf_get_height(tos)); save = ctx->pixbuf; ctx->pixbuf = mask; rsvg_state_push(ctx); - rsvg_defs_drawable_draw (drawable, ctx, 0); - rsvg_state_pop(ctx); - ctx->pixbuf = save; @@ -80,7 +75,7 @@ rsvg_mask_render (RsvgMask *self, GdkPixbuf *tos, GdkPixbuf *nos, RsvgHandle *ct if (!gdk_pixbuf_get_has_alpha (nos)) { - g_warning ("push/pop transparency group on non-alpha buffer nyi"); + g_warning (_("push/pop transparency group on non-alpha buffer nyi")); return; } diff --git a/rsvg-paint-server.c b/rsvg-paint-server.c index 5ba3d34c..40830f40 100644 --- a/rsvg-paint-server.c +++ b/rsvg-paint-server.c @@ -561,11 +561,9 @@ rsvg_paint_server_pattern_render (RsvgPaintServer *self, ArtRender *ar, if (maxy > gdk_pixbuf_get_height(hctx->pixbuf)) yoffset = -maxy; - render = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 1, 8, - gdk_pixbuf_get_width(hctx->pixbuf), - gdk_pixbuf_get_height(hctx->pixbuf)); - - gdk_pixbuf_fill(render, 0x00000000); + render = _rsvg_pixbuf_new_cleared(GDK_COLORSPACE_RGB, 1, 8, + gdk_pixbuf_get_width(hctx->pixbuf), + gdk_pixbuf_get_height(hctx->pixbuf)); save = hctx->pixbuf; hctx->pixbuf = render; diff --git a/rsvg-private.h b/rsvg-private.h index a8817e39..0c374ec7 100644 --- a/rsvg-private.h +++ b/rsvg-private.h @@ -183,6 +183,10 @@ void rsvg_handle_set_base_uri (RsvgHandle *handle, gboolean rsvg_eval_switch_attributes (RsvgPropertyBag *atts, gboolean * p_has_cond); +GdkPixbuf * +_rsvg_pixbuf_new_cleared (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, + int width, int height); + G_END_DECLS #endif |