Commit 9d65c44b authored by Caleb Michael Moore's avatar Caleb Michael Moore

fancy new partial render api

parent 85b7070c
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.
2005-11-25 Dom Lachowicz <cinamod@hotmail.com>
* configure.in: 2.13.3
......
......@@ -59,9 +59,6 @@
static double internal_dpi_x = RSVG_DEFAULT_DPI_X;
static double internal_dpi_y = RSVG_DEFAULT_DPI_Y;
void
rsvg_drawing_ctx_init(RsvgDrawingCtx * handle);
static void
rsvg_ctx_free_helper (gpointer key, gpointer value, gpointer user_data)
{
......
......@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <glib/gslist.h>
#include <math.h>
#include <string.h>
......@@ -97,6 +98,7 @@ rsvg_cairo_new_drawing_ctx (cairo_t *cr, RsvgHandle *handle)
draw->vb.w = data.em;
draw->vb.h = data.ex;
draw->pango_context = NULL;
draw->drawsub_stack = NULL;
rsvg_state_push(draw);
......@@ -118,7 +120,10 @@ rsvg_cairo_new_drawing_ctx (cairo_t *cr, RsvgHandle *handle)
}
void
rsvg_cairo_render (cairo_t *cr, RsvgHandle *handle)
rsvg_cairo_render_sub(cairo_t *cr, RsvgHandle *handle, RsvgNode *drawsub);
void
rsvg_cairo_render_sub (cairo_t *cr, RsvgHandle *handle, RsvgNode * drawsub)
{
RsvgDrawingCtx * draw;
g_return_if_fail (handle != NULL);
......@@ -130,8 +135,19 @@ rsvg_cairo_render (cairo_t *cr, RsvgHandle *handle)
if (!draw)
return;
while (drawsub != NULL){
draw->drawsub_stack = g_slist_prepend(draw->drawsub_stack, drawsub);
drawsub = drawsub->parent;
}
rsvg_state_push(draw);
rsvg_node_draw((RsvgNode *)handle->treebase, draw, 0);
rsvg_state_pop(draw);
rsvg_drawing_ctx_free(draw);
}
void
rsvg_cairo_render (cairo_t *cr, RsvgHandle *handle)
{
rsvg_cairo_render_sub(cr, handle, NULL);
}
......@@ -611,6 +611,8 @@ rsvg_filter_get_result (GString * name, RsvgFilterContext * ctx)
{
RsvgFilterPrimitiveOutput output;
RsvgFilterPrimitiveOutput * outputpointer;
output.bounds.x0 = output.bounds.x1 =
output.bounds.y0 = output.bounds.y1 = 0;
if (!strcmp (name->str, "SourceGraphic"))
{
......
......@@ -135,6 +135,7 @@ struct RsvgDrawingCtx {
double dpi_x, dpi_y;
RsvgViewBox vb;
GSList * vb_stack;
GSList * drawsub_stack;
};
/*Abstract base class for context for our backends (one as yet)*/
......
......@@ -38,13 +38,21 @@ rsvg_node_draw (RsvgNode * self, RsvgDrawingCtx *ctx,
int dominate)
{
RsvgState *state;
GSList * stacksave;
state = self->state;
stacksave = ctx->drawsub_stack;
if (stacksave){
if (stacksave->data != self)
return;
ctx->drawsub_stack = stacksave->next;
}
if (0 /*!state->visible*/)
return;
self->draw(self, ctx, dominate);
ctx->drawsub_stack = stacksave;
}
/* generic function for drawing all of the children of a particular node */
......
......@@ -43,26 +43,17 @@
#include "rsvg-cairo.h"
#include "rsvg-cairo-draw.h"
void
rsvg_cairo_render_sub(cairo_t *cr, RsvgHandle *handle, RsvgNode *drawsub);
static void
rsvg_pixmap_destroy (gchar *pixels, gpointer data)
{
g_free (pixels);
}
/**
* rsvg_handle_get_pixbuf:
* @handle: An #RsvgHandle
*
* Returns the pixbuf loaded by #handle. The pixbuf returned will be reffed, so
* the caller of this function must assume that ref. If insufficient data has
* been read to create the pixbuf, or an error occurred in loading, then %NULL
* will be returned. Note that the pixbuf may not be complete until
* @rsvg_handle_close has been called.
*
* Returns: the pixbuf loaded by #handle, or %NULL.
**/
GdkPixbuf *
rsvg_handle_get_pixbuf (RsvgHandle *handle)
rsvg_handle_get_pixbuf_sub (RsvgHandle *handle, char * id)
{
RsvgDimensionData dimensions;
GdkPixbuf *output = NULL;
......@@ -88,8 +79,11 @@ rsvg_handle_get_pixbuf (RsvgHandle *handle)
cr = cairo_create (surface);
rsvg_cairo_render (cr, handle);
if (id == NULL)
rsvg_cairo_render (cr, handle);
else
rsvg_cairo_render_sub (cr, handle,
rsvg_defs_lookup (handle->defs, id));
rsvg_cairo_to_pixbuf(pixels, rowstride, dimensions.height);
output = gdk_pixbuf_new_from_data (pixels,
......@@ -107,3 +101,22 @@ rsvg_handle_get_pixbuf (RsvgHandle *handle)
return output;
}
/**
* rsvg_handle_get_pixbuf:
* @handle: An #RsvgHandle
*
* Returns the pixbuf loaded by #handle. The pixbuf returned will be reffed, so
* the caller of this function must assume that ref. If insufficient data has
* been read to create the pixbuf, or an error occurred in loading, then %NULL
* will be returned. Note that the pixbuf may not be complete until
* @rsvg_handle_close has been called.
*
* Returns: the pixbuf loaded by #handle, or %NULL.
**/
GdkPixbuf *
rsvg_handle_get_pixbuf (RsvgHandle *handle)
{
return rsvg_handle_get_pixbuf_sub (handle, NULL);
}
......@@ -62,6 +62,7 @@ gboolean rsvg_handle_write (RsvgHandle *handle,
gboolean rsvg_handle_close (RsvgHandle *handle,
GError **error);
GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle *handle);
GdkPixbuf *rsvg_handle_get_pixbuf_sub (RsvgHandle *handle, char * id);
void rsvg_handle_free (RsvgHandle *handle);
G_CONST_RETURN char *
......
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