Commit 6e9d8ea4 authored by Dom Lachowicz's avatar Dom Lachowicz

bug 322489

parent 9d65c44b
2005-11-26 Dom Lachowicz <cinamod@hotmail.com>
* configure.in: Bump version number
* *.c: C89 build fixes from jensgr@gmx.net (Jens Granseuer) - bug 322489
* rsvg-cairo-render.c, rsvg.c, rsvg.h: Make mods to Caleb's latest work. Prefer to expose a Cairo API that can render an element by id, and then go from there.
2005-11-26 Caleb Moore <c.moore@student.unsw.edu.au> 2005-11-26 Caleb Moore <c.moore@student.unsw.edu.au>
* rsvg-cairo-render.c, rsvg.c, rsvg.h: made that partial rendering api that I promised Rahga ages ago. Havn't tested yet. * rsvg-cairo-render.c, rsvg.c, rsvg.h: made that partial rendering api that I promised Rahga ages ago. Havn't tested yet.
......
...@@ -21,7 +21,7 @@ dnl =========================================================================== ...@@ -21,7 +21,7 @@ dnl ===========================================================================
LIBRSVG_MAJOR_VERSION=2 LIBRSVG_MAJOR_VERSION=2
LIBRSVG_MINOR_VERSION=13 LIBRSVG_MINOR_VERSION=13
LIBRSVG_MICRO_VERSION=3 LIBRSVG_MICRO_VERSION=4
AC_SUBST(LIBRSVG_MAJOR_VERSION) AC_SUBST(LIBRSVG_MAJOR_VERSION)
AC_SUBST(LIBRSVG_MINOR_VERSION) AC_SUBST(LIBRSVG_MINOR_VERSION)
AC_SUBST(LIBRSVG_MICRO_VERSION) AC_SUBST(LIBRSVG_MICRO_VERSION)
......
...@@ -601,6 +601,9 @@ static void ...@@ -601,6 +601,9 @@ static void
rsvg_characters (void *data, const xmlChar *ch, int len) rsvg_characters (void *data, const xmlChar *ch, int len)
{ {
RsvgHandle *ctx = (RsvgHandle *)data; RsvgHandle *ctx = (RsvgHandle *)data;
char * utf8 = NULL;
RsvgNodeChars * self;
GString * string;
if (ctx->handler && ctx->handler->characters != NULL) if (ctx->handler && ctx->handler->characters != NULL)
{ {
...@@ -608,10 +611,6 @@ rsvg_characters (void *data, const xmlChar *ch, int len) ...@@ -608,10 +611,6 @@ rsvg_characters (void *data, const xmlChar *ch, int len)
return; return;
} }
char * utf8 = NULL;
RsvgNodeChars * self;
GString * string;
if (!ch || !len) if (!ch || !len)
return; return;
......
...@@ -186,11 +186,14 @@ _set_source_rsvg_solid_colour (RsvgDrawingCtx *ctx, ...@@ -186,11 +186,14 @@ _set_source_rsvg_solid_colour (RsvgDrawingCtx *ctx,
{ {
cairo_t *cr = ((RsvgCairoRender *)ctx->render)->cr; cairo_t *cr = ((RsvgCairoRender *)ctx->render)->cr;
guint32 rgb = colour->rgb; guint32 rgb = colour->rgb;
double r, g, b;
if (colour->currentcolour) if (colour->currentcolour)
rgb = current_colour; rgb = current_colour;
double r = ((rgb >> 16) & 0xff) / 255.0;
double g = ((rgb >> 8) & 0xff) / 255.0; r = ((rgb >> 16) & 0xff) / 255.0;
double b = ((rgb >> 0) & 0xff) / 255.0; g = ((rgb >> 8) & 0xff) / 255.0;
b = ((rgb >> 0) & 0xff) / 255.0;
if (opacity == 0xff) if (opacity == 0xff)
cairo_set_source_rgb (cr, r, g, b); cairo_set_source_rgb (cr, r, g, b);
...@@ -868,11 +871,10 @@ rsvg_cairo_pop_render_stack (RsvgDrawingCtx *ctx) ...@@ -868,11 +871,10 @@ rsvg_cairo_pop_render_stack (RsvgDrawingCtx *ctx)
{ {
RsvgCairoRender *render = (RsvgCairoRender *)ctx->render; RsvgCairoRender *render = (RsvgCairoRender *)ctx->render;
cairo_t *child_cr = render->cr; cairo_t *child_cr = render->cr;
RsvgState *state;
state = rsvg_state_current(ctx);
gboolean lateclip = FALSE; gboolean lateclip = FALSE;
GdkPixbuf * output = NULL; GdkPixbuf * output = NULL;
cairo_surface_t *surface = NULL; cairo_surface_t *surface = NULL;
RsvgState *state = rsvg_state_current(ctx);
if (rsvg_state_current(ctx)->clip_path_ref) if (rsvg_state_current(ctx)->clip_path_ref)
if (((RsvgClipPath *)rsvg_state_current(ctx)->clip_path_ref)->units == if (((RsvgClipPath *)rsvg_state_current(ctx)->clip_path_ref)->units ==
......
...@@ -120,12 +120,10 @@ rsvg_cairo_new_drawing_ctx (cairo_t *cr, RsvgHandle *handle) ...@@ -120,12 +120,10 @@ rsvg_cairo_new_drawing_ctx (cairo_t *cr, RsvgHandle *handle)
} }
void void
rsvg_cairo_render_sub(cairo_t *cr, RsvgHandle *handle, RsvgNode *drawsub); rsvg_cairo_render_sub (cairo_t *cr, RsvgHandle *handle, const char * id)
void
rsvg_cairo_render_sub (cairo_t *cr, RsvgHandle *handle, RsvgNode * drawsub)
{ {
RsvgDrawingCtx * draw; RsvgDrawingCtx * draw;
RsvgNode * drawsub;
g_return_if_fail (handle != NULL); g_return_if_fail (handle != NULL);
if (!handle->finished) if (!handle->finished)
...@@ -135,6 +133,9 @@ rsvg_cairo_render_sub (cairo_t *cr, RsvgHandle *handle, RsvgNode * drawsub) ...@@ -135,6 +133,9 @@ rsvg_cairo_render_sub (cairo_t *cr, RsvgHandle *handle, RsvgNode * drawsub)
if (!draw) if (!draw)
return; return;
if(id && *id)
drawsub = rsvg_defs_lookup (handle->defs, id);
while (drawsub != NULL){ while (drawsub != NULL){
draw->drawsub_stack = g_slist_prepend(draw->drawsub_stack, drawsub); draw->drawsub_stack = g_slist_prepend(draw->drawsub_stack, drawsub);
drawsub = drawsub->parent; drawsub = drawsub->parent;
......
...@@ -31,5 +31,8 @@ ...@@ -31,5 +31,8 @@
void void
rsvg_cairo_render (cairo_t *cr, RsvgHandle *handle); rsvg_cairo_render (cairo_t *cr, RsvgHandle *handle);
void
rsvg_cairo_render_sub(cairo_t *cr, RsvgHandle *handle, const char * id);
#endif #endif
...@@ -3541,6 +3541,8 @@ rsvg_filter_primitive_image_render_ext (RsvgFilterPrimitive * self, ...@@ -3541,6 +3541,8 @@ rsvg_filter_primitive_image_render_ext (RsvgFilterPrimitive * self,
int i; int i;
GdkPixbuf * intermediate; GdkPixbuf * intermediate;
unsigned char * pixels; unsigned char * pixels;
int channelmap[4];
int length;
upself = (RsvgFilterPrimitiveImage *) self; upself = (RsvgFilterPrimitiveImage *) self;
...@@ -3574,8 +3576,7 @@ rsvg_filter_primitive_image_render_ext (RsvgFilterPrimitive * self, ...@@ -3574,8 +3576,7 @@ rsvg_filter_primitive_image_render_ext (RsvgFilterPrimitive * self,
g_object_unref (G_OBJECT (img)); g_object_unref (G_OBJECT (img));
int channelmap[4]; length = gdk_pixbuf_get_height(intermediate) * gdk_pixbuf_get_rowstride(intermediate);
int length = gdk_pixbuf_get_height(intermediate) * gdk_pixbuf_get_rowstride(intermediate);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
channelmap[i] = ctx->channelmap[i]; channelmap[i] = ctx->channelmap[i];
pixels = gdk_pixbuf_get_pixels(intermediate); pixels = gdk_pixbuf_get_pixels(intermediate);
......
...@@ -503,12 +503,15 @@ rsvg_node_image_draw (RsvgNode * self, RsvgDrawingCtx *ctx, ...@@ -503,12 +503,15 @@ rsvg_node_image_draw (RsvgNode * self, RsvgDrawingCtx *ctx,
RsvgNodeImage *z = (RsvgNodeImage *)self; RsvgNodeImage *z = (RsvgNodeImage *)self;
unsigned int aspect_ratio = z->preserve_aspect_ratio; unsigned int aspect_ratio = z->preserve_aspect_ratio;
GdkPixbuf *img = z->img; GdkPixbuf *img = z->img;
gdouble x, y, w, h;
if (img == NULL) if (img == NULL)
return; return;
gdouble x = _rsvg_css_normalize_length(&z->x, ctx, 'h');
gdouble y = _rsvg_css_normalize_length(&z->y, ctx, 'v'); x = _rsvg_css_normalize_length(&z->x, ctx, 'h');
gdouble w = _rsvg_css_normalize_length(&z->w, ctx, 'h'); y = _rsvg_css_normalize_length(&z->y, ctx, 'v');
gdouble h = _rsvg_css_normalize_length(&z->h, ctx, 'v'); w = _rsvg_css_normalize_length(&z->w, ctx, 'h');
h = _rsvg_css_normalize_length(&z->h, ctx, 'v');
rsvg_state_reinherit_top(ctx, z->super.state, dominate); rsvg_state_reinherit_top(ctx, z->super.state, dominate);
......
...@@ -203,6 +203,7 @@ rsvg_stop_set_atts (RsvgNode *self, RsvgHandle *ctx, ...@@ -203,6 +203,7 @@ rsvg_stop_set_atts (RsvgNode *self, RsvgHandle *ctx,
gboolean is_current_color = FALSE; gboolean is_current_color = FALSE;
const char *value; const char *value;
RsvgGradientStop * stop; RsvgGradientStop * stop;
RsvgState state;
stop = (RsvgGradientStop *)self; stop = (RsvgGradientStop *)self;
...@@ -230,7 +231,6 @@ rsvg_stop_set_atts (RsvgNode *self, RsvgHandle *ctx, ...@@ -230,7 +231,6 @@ rsvg_stop_set_atts (RsvgNode *self, RsvgHandle *ctx,
rsvg_parse_style_pairs (ctx, self->state, atts); rsvg_parse_style_pairs (ctx, self->state, atts);
} }
self->parent = ctx->currentnode; self->parent = ctx->currentnode;
RsvgState state;
rsvg_state_init(&state); rsvg_state_init(&state);
rsvg_state_reconstruct(&state, self); rsvg_state_reconstruct(&state, self);
if (is_current_color) if (is_current_color)
......
...@@ -43,9 +43,6 @@ ...@@ -43,9 +43,6 @@
#include "rsvg-cairo.h" #include "rsvg-cairo.h"
#include "rsvg-cairo-draw.h" #include "rsvg-cairo-draw.h"
void
rsvg_cairo_render_sub(cairo_t *cr, RsvgHandle *handle, RsvgNode *drawsub);
static void static void
rsvg_pixmap_destroy (gchar *pixels, gpointer data) rsvg_pixmap_destroy (gchar *pixels, gpointer data)
{ {
...@@ -53,7 +50,7 @@ rsvg_pixmap_destroy (gchar *pixels, gpointer data) ...@@ -53,7 +50,7 @@ rsvg_pixmap_destroy (gchar *pixels, gpointer data)
} }
GdkPixbuf * GdkPixbuf *
rsvg_handle_get_pixbuf_sub (RsvgHandle *handle, char * id) rsvg_handle_get_pixbuf_sub (RsvgHandle *handle, const char * id)
{ {
RsvgDimensionData dimensions; RsvgDimensionData dimensions;
GdkPixbuf *output = NULL; GdkPixbuf *output = NULL;
...@@ -82,8 +79,7 @@ rsvg_handle_get_pixbuf_sub (RsvgHandle *handle, char * id) ...@@ -82,8 +79,7 @@ rsvg_handle_get_pixbuf_sub (RsvgHandle *handle, char * id)
if (id == NULL) if (id == NULL)
rsvg_cairo_render (cr, handle); rsvg_cairo_render (cr, handle);
else else
rsvg_cairo_render_sub (cr, handle, rsvg_cairo_render_sub (cr, handle, id);
rsvg_defs_lookup (handle->defs, id));
rsvg_cairo_to_pixbuf(pixels, rowstride, dimensions.height); rsvg_cairo_to_pixbuf(pixels, rowstride, dimensions.height);
output = gdk_pixbuf_new_from_data (pixels, output = gdk_pixbuf_new_from_data (pixels,
......
...@@ -62,7 +62,7 @@ gboolean rsvg_handle_write (RsvgHandle *handle, ...@@ -62,7 +62,7 @@ gboolean rsvg_handle_write (RsvgHandle *handle,
gboolean rsvg_handle_close (RsvgHandle *handle, gboolean rsvg_handle_close (RsvgHandle *handle,
GError **error); GError **error);
GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle *handle); GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle *handle);
GdkPixbuf *rsvg_handle_get_pixbuf_sub (RsvgHandle *handle, char * id); GdkPixbuf *rsvg_handle_get_pixbuf_sub (RsvgHandle *handle, const char * id);
void rsvg_handle_free (RsvgHandle *handle); void rsvg_handle_free (RsvgHandle *handle);
G_CONST_RETURN char * G_CONST_RETURN char *
...@@ -103,15 +103,6 @@ void rsvg_handle_set_size_callback (RsvgHandle *handle, ...@@ -103,15 +103,6 @@ void rsvg_handle_set_size_callback (RsvgHandle *handle,
gpointer user_data, gpointer user_data,
GDestroyNotify user_data_destroy); GDestroyNotify user_data_destroy);
#ifndef RSVG_DISABLE_DEPRECATED
/*
* TODO: decide whether we want to either:
* 1) Keep these around, and just implement it in terms of libart or cairo, whichever one we have around
* 2) Get rid of these completely
* 3) Push these into librsvg-libart solely
*/
/* Convenience API */ /* Convenience API */
GdkPixbuf *rsvg_pixbuf_from_file (const gchar *file_name, GdkPixbuf *rsvg_pixbuf_from_file (const gchar *file_name,
...@@ -134,8 +125,6 @@ GdkPixbuf *rsvg_pixbuf_from_file_at_zoom_with_max (const gchar *file_name, ...@@ -134,8 +125,6 @@ GdkPixbuf *rsvg_pixbuf_from_file_at_zoom_with_max (const gchar *file_name,
gint max_width, gint max_width,
gint max_height, gint max_height,
GError **error); GError **error);
#endif /* RSVG_DISABLE_DEPRECATED */
G_END_DECLS G_END_DECLS
#endif /* RSVG_H */ #endif /* RSVG_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment