Commit d6979476 authored by Caleb Michael Moore's avatar Caleb Michael Moore

filters working

parent df5c228a
2005-07-29 Caleb Moore <c.moore@student.unsw.edu.au>
* rsvg-filter.c, et_al: Made filters work again.
* rsvg-private.c: made a new function for render thingies to implement,
something that will get a node as a pixbuf.
* rsvg-styles.c: made overflow into a propper CSS property
2005-07-21 Caleb Moore <c.moore@student.unsw.edu.au>
* Makefile.am, configure.in, rsvg.c, rsvg-base.c: further split the library into librsvg-2.so, librsvg-2-base.so and librsvg-2-libart.so. Make libart an optional dependancy.
......
......@@ -47,6 +47,8 @@ librsvg_2_base_la_SOURCES = \
rsvg-path.h \
rsvg-private.h \
rsvg-file-util.c \
rsvg-filter.c \
rsvg-filter.h \
rsvg-marker.c \
rsvg-marker.h \
rsvg-mask.c \
......@@ -76,9 +78,7 @@ librsvg_2_libart_la_SOURCES = \
rsvg-art-paint-server.c \
rsvg-art-paint-server.h \
rsvg-art-render.c \
rsvg-art-render.h \
rsvg-filter.c \
rsvg-filter.h
rsvg-art-render.h
librsvg_2_libart_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined -export-dynamic
librsvg_2_libart_la_LIBADD = librsvg-2-base.la $(LIBGNOME_VFS_LIBS) $(LIBGSF_LIBS) $(LIBCROCO_LIBS) $(LIBRSVG_LIBS) $(FREETYPE_LIBS) $(LIBART_LIBS)
......
......@@ -50,7 +50,7 @@ typedef struct _RsvgArtDiscreteLayer RsvgArtDiscreteLayer;
struct _RsvgArtDiscreteLayer
{
GdkPixbuf *save_pixbuf;
ArtIRect underbbox;
RsvgIRect underbbox;
RsvgState * state;
ArtSVP * clippath_save;
gboolean clippath_loaded;
......@@ -215,7 +215,7 @@ rsvg_compile_bg(RsvgDrawingCtx *ctx)
int i;
GdkPixbuf *intermediate, *lastintermediate;
RsvgArtDiscreteLayer *state;
ArtIRect save;
RsvgIRect save;
RsvgArtRender *render = (RsvgArtRender *)ctx->render;
lastintermediate = gdk_pixbuf_copy(((RsvgArtDiscreteLayer *)render->layers->data)->save_pixbuf);
......@@ -254,6 +254,7 @@ rsvg_composite_layer(RsvgDrawingCtx *ctx, RsvgState *state, GdkPixbuf *tos, GdkP
GdkPixbuf *in, *out, *insidebg;
int operationsleft;
gint adobe_blend = state->adobe_blend;
RsvgArtRender * render = (RsvgArtRender *)ctx->render;
intermediate = NULL;
......@@ -289,8 +290,17 @@ rsvg_composite_layer(RsvgDrawingCtx *ctx, RsvgState *state, GdkPixbuf *tos, GdkP
if (filter != NULL)
{
GdkPixbuf * temp;
out = get_next_out(&operationsleft, in, tos, nos, intermediate);
rsvg_filter_render (filter, in, out, insidebg, ctx);
temp = rsvg_filter_render (filter, in, insidebg, ctx,
(RsvgIRect *)&render->bbox);
if (render->clippath)
rsvg_art_clip_image(temp, render->clippath);
rsvg_alpha_blt (temp, render->bbox.x0, render->bbox.y0,
render->bbox.x1 - render->bbox.x0,
render->bbox.y1 - render->bbox.y0,
out, render->bbox.x0, render->bbox.y0);
g_object_unref (G_OBJECT (temp));
in = out;
}
if (opacity != 0xFF)
......@@ -308,7 +318,8 @@ rsvg_composite_layer(RsvgDrawingCtx *ctx, RsvgState *state, GdkPixbuf *tos, GdkP
if (adobe_blend)
{
out = get_next_out(&operationsleft, in, tos, nos, intermediate);
rsvg_filter_adobe_blend (adobe_blend, in, insidebg, out, ctx);
rsvg_filter_adobe_blend (adobe_blend, in, insidebg, out,
render->bbox, ctx);
in = out;
}
......@@ -354,7 +365,9 @@ rsvg_art_pop_discrete_layer(RsvgDrawingCtx *ctx)
g_object_unref (tos);
render->pixbuf = nos;
art_irect_union(&render->bbox, &render->bbox, &layer->underbbox);
art_irect_union((ArtIRect*)&render->bbox,
(ArtIRect*)&render->bbox,
(ArtIRect*)&layer->underbbox);
}
if (layer->clippath_loaded)
{
......@@ -371,206 +384,6 @@ rsvg_art_needs_discrete_layer(RsvgState *state)
return state->filter || state->mask || state->adobe_blend || state->backgroundnew || state->clip_path_ref;
}
void
rsvg_art_alpha_blt (GdkPixbuf * src, gint srcx, gint srcy, gint srcwidth,
gint srcheight, GdkPixbuf * dst, gint dstx, gint dsty)
{
gint rightx;
gint bottomy;
gint dstwidth;
gint dstheight;
gint srcoffsetx;
gint srcoffsety;
gint dstoffsetx;
gint dstoffsety;
gint x, y, srcrowstride, dstrowstride, sx, sy, dx, dy;
guchar *src_pixels, *dst_pixels;
dstheight = srcheight;
dstwidth = srcwidth;
rightx = srcx + srcwidth;
bottomy = srcy + srcheight;
if (rightx > gdk_pixbuf_get_width (src))
rightx = gdk_pixbuf_get_width (src);
if (bottomy > gdk_pixbuf_get_height (src))
bottomy = gdk_pixbuf_get_height (src);
srcwidth = rightx - srcx;
srcheight = bottomy - srcy;
rightx = dstx + dstwidth;
bottomy = dsty + dstheight;
if (rightx > gdk_pixbuf_get_width (dst))
rightx = gdk_pixbuf_get_width (dst);
if (bottomy > gdk_pixbuf_get_height (dst))
bottomy = gdk_pixbuf_get_height (dst);
dstwidth = rightx - dstx;
dstheight = bottomy - dsty;
if (dstwidth < srcwidth)
srcwidth = dstwidth;
if (dstheight < srcheight)
srcheight = dstheight;
if (srcx < 0)
srcoffsetx = 0 - srcx;
else
srcoffsetx = 0;
if (srcy < 0)
srcoffsety = 0 - srcy;
else
srcoffsety = 0;
if (dstx < 0)
dstoffsetx = 0 - dstx;
else
dstoffsetx = 0;
if (dsty < 0)
dstoffsety = 0 - dsty;
else
dstoffsety = 0;
if (dstoffsetx > srcoffsetx)
srcoffsetx = dstoffsetx;
if (dstoffsety > srcoffsety)
srcoffsety = dstoffsety;
srcrowstride = gdk_pixbuf_get_rowstride (src);
dstrowstride = gdk_pixbuf_get_rowstride (dst);
src_pixels = gdk_pixbuf_get_pixels (src);
dst_pixels = gdk_pixbuf_get_pixels (dst);
for (y = srcoffsety; y < srcheight; y++)
for (x = srcoffsetx; x < srcwidth; x++)
{
guchar r, g, b, a;
sx = x + srcx;
sy = y + srcy;
dx = x + dstx;
dy = y + dsty;
a = src_pixels[4 * sx + sy * srcrowstride + 3];
if (a)
{
r = src_pixels[4 * sx + sy * srcrowstride];
g = src_pixels[4 * sx + 1 + sy * srcrowstride];
b = src_pixels[4 * sx + 2 + sy * srcrowstride];
art_rgba_run_alpha (dst_pixels + 4 * dx +
dy * dstrowstride, r, g, b, a, 1);
}
}
}
void
rsvg_art_affine_image(const GdkPixbuf *img, GdkPixbuf *intermediate,
double * affine, double w, double h)
{
gdouble tmp_affine[6];
gdouble inv_affine[6];
gdouble raw_inv_affine[6];
gint intstride;
gint basestride;
gint basex, basey;
gdouble fbasex, fbasey;
gdouble rawx, rawy;
guchar * intpix;
guchar * basepix;
gint i, j, k, basebpp, ii, jj;
gboolean has_alpha;
gdouble pixsum[4];
gboolean xrunnoff, yrunnoff;
gint iwidth, iheight;
gint width, height;
width = gdk_pixbuf_get_width (img);
height = gdk_pixbuf_get_height (img);
iwidth = gdk_pixbuf_get_width (intermediate);
iheight = gdk_pixbuf_get_height (intermediate);
has_alpha = gdk_pixbuf_get_has_alpha (img);
basestride = gdk_pixbuf_get_rowstride (img);
intstride = gdk_pixbuf_get_rowstride (intermediate);
basepix = gdk_pixbuf_get_pixels (img);
intpix = gdk_pixbuf_get_pixels (intermediate);
basebpp = has_alpha ? 4 : 3;
_rsvg_affine_invert(raw_inv_affine, affine);
/*scale to w and h*/
tmp_affine[0] = (double)w;
tmp_affine[3] = (double)h;
tmp_affine[1] = tmp_affine[2] = tmp_affine[4] = tmp_affine[5] = 0;
_rsvg_affine_multiply(tmp_affine, tmp_affine, affine);
_rsvg_affine_invert(inv_affine, tmp_affine);
/*apply the transformation*/
for (i = 0; i < iwidth; i++)
for (j = 0; j < iheight; j++)
{
fbasex = (inv_affine[0] * (double)i + inv_affine[2] * (double)j +
inv_affine[4]) * (double)width;
fbasey = (inv_affine[1] * (double)i + inv_affine[3] * (double)j +
inv_affine[5]) * (double)height;
basex = floor(fbasex);
basey = floor(fbasey);
rawx = raw_inv_affine[0] * i + raw_inv_affine[2] * j +
raw_inv_affine[4];
rawy = raw_inv_affine[1] * i + raw_inv_affine[3] * j +
raw_inv_affine[5];
if (rawx < 0 || rawy < 0 || rawx >= w ||
rawy >= h || basex < 0 || basey < 0
|| basex >= width || basey >= height)
{
for (k = 0; k < 4; k++)
intpix[i * 4 + j * intstride + k] = 0;
}
else
{
if (basex < 0 || basex + 1 >= width)
xrunnoff = TRUE;
else
xrunnoff = FALSE;
if (basey < 0 || basey + 1 >= height)
yrunnoff = TRUE;
else
yrunnoff = FALSE;
for (k = 0; k < basebpp; k++)
pixsum[k] = 0;
for (ii = 0; ii < 2; ii++)
for (jj = 0; jj < 2; jj++)
{
if (basex + ii < 0 || basey + jj< 0
|| basex + ii >= width || basey + jj >= height)
;
else
{
for (k = 0; k < basebpp; k++)
{
pixsum[k] +=
(double)basepix[basebpp * (basex + ii) + (basey + jj) * basestride + k]
* (xrunnoff ? 1 : fabs(fbasex - (double)(basex + (1 - ii))))
* (yrunnoff ? 1 : fabs(fbasey - (double)(basey + (1 - jj))));
}
}
}
for (k = 0; k < basebpp; k++)
intpix[i * 4 + j * intstride + k] = pixsum[k];
if (!has_alpha)
intpix[i * 4 + j * intstride + 3] = 255;
}
}
}
void
rsvg_art_clip_image(GdkPixbuf *intermediate, ArtSVP *path)
{
......@@ -617,3 +430,27 @@ rsvg_art_add_clipping_rect(RsvgDrawingCtx *ctx, double x, double y, double w, do
else
data->clippath_loaded = FALSE;
}
void *
rsvg_art_get_image_of_node(RsvgDrawingCtx *ctx, RsvgNode * drawable,
double w, double h)
{
GdkPixbuf *img, *save;
img = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, w, h);
save = ((RsvgArtRender *)ctx->render)->pixbuf;
((RsvgArtRender *)ctx->render)->pixbuf = img;
rsvg_state_push(ctx);
rsvg_node_draw (drawable, ctx, 0);
rsvg_state_pop(ctx);
((RsvgArtRender *)ctx->render)->pixbuf = save;
return img;
}
......@@ -39,13 +39,10 @@ void rsvg_art_pop_discrete_layer(RsvgDrawingCtx *ctx);
void rsvg_art_push_discrete_layer (RsvgDrawingCtx *ctx);
gboolean rsvg_art_needs_discrete_layer(RsvgState *state);
void rsvg_art_alpha_blt (GdkPixbuf * src, gint srcx, gint srcy,
gint srcwidth, gint srcheight,
GdkPixbuf * dst, gint dstx, gint dsty);
void rsvg_art_clip_image (GdkPixbuf *intermediate, ArtSVP *path);
void rsvg_art_affine_image(const GdkPixbuf *img, GdkPixbuf *intermediate,
double * affine, double w, double h);
void rsvg_art_add_clipping_rect(RsvgDrawingCtx *ctx, double x, double y, double w, double h);
void * rsvg_art_get_image_of_node(RsvgDrawingCtx *ctx, RsvgNode * drawable, double w, double h);
G_END_DECLS
#endif
......@@ -44,6 +44,7 @@
#include "rsvg-styles.h"
#include "rsvg-bpath-util.h"
#include "rsvg-path.h"
#include "rsvg-filter.h"
#include <math.h>
......@@ -253,7 +254,8 @@ rsvg_render_svp (RsvgDrawingCtx *ctx, ArtSVP *svp,
art_render_mask_solid (render, (opacity << 8) + opacity + (opacity >> 7));
temptemprect = rsvg_frect_pixelspaceise(temprect, state->affine);
art_irect_union(&arender->bbox, &arender->bbox, &temptemprect);
art_irect_union((ArtIRect*)&arender->bbox,
(ArtIRect*)&arender->bbox, (ArtIRect*)&temptemprect);
gradctx.x0 = temprect.x0;
gradctx.y0 = temprect.y0;
......@@ -466,11 +468,11 @@ void rsvg_art_render_image (RsvgDrawingCtx *ctx, const GdkPixbuf * img,
}
/*slap it down*/
rsvg_art_alpha_blt (intermediate, 0, 0,
gdk_pixbuf_get_width (intermediate),
gdk_pixbuf_get_height (intermediate),
pixbuf,
0, 0);
rsvg_alpha_blt (intermediate, 0, 0,
gdk_pixbuf_get_width (intermediate),
gdk_pixbuf_get_height (intermediate),
pixbuf,
0, 0);
temprect.x0 = gdk_pixbuf_get_width (intermediate);
temprect.y0 = gdk_pixbuf_get_height (intermediate);
......@@ -488,7 +490,8 @@ void rsvg_art_render_image (RsvgDrawingCtx *ctx, const GdkPixbuf * img,
temprect.y1 = MAX(basey, temprect.y1);
}
art_irect_union(&arender->bbox, &arender->bbox, &temprect);
art_irect_union((ArtIRect*)&arender->bbox,
(ArtIRect*)&arender->bbox, (ArtIRect*)&temprect);
g_object_unref (G_OBJECT (intermediate));
}
......@@ -77,6 +77,7 @@ rsvg_art_render_new(int new_width, int new_height)
output->super.pop_discrete_layer = rsvg_art_pop_discrete_layer;
output->super.push_discrete_layer = rsvg_art_push_discrete_layer;
output->super.add_clipping_rect = rsvg_art_add_clipping_rect;
output->super.get_image_of_node = rsvg_art_get_image_of_node;
output->pixbuf = gdk_pixbuf_new_from_data (pixels,
GDK_COLORSPACE_RGB,
......
......@@ -38,7 +38,7 @@ struct RsvgArtRender {
RsvgRender super;
GdkPixbuf *pixbuf;
GSList * layers;
ArtIRect bbox;
RsvgIRect bbox;
ArtSVP * clippath;
};
......
......@@ -207,7 +207,6 @@ rsvg_filter_handler_start (RsvgHandle *ctx, const xmlChar *name,
newnode = rsvg_new_radial_gradient ();
else if (!strcmp ((char *)name, "conicalGradient"))
newnode = rsvg_new_radial_gradient ();
/*
else if (!strcmp ((char *)name, "filter"))
newnode = rsvg_new_filter();
else if (!strcmp ((char *)name, "feBlend"))
......@@ -258,7 +257,6 @@ rsvg_filter_handler_start (RsvgHandle *ctx, const xmlChar *name,
newnode = rsvg_new_filter_primitive_light_source('s');
else if (!strcmp ((char *)name, "fePointLight"))
newnode = rsvg_new_filter_primitive_light_source('p');
*/
if (newnode)
{
rsvg_node_set_atts(newnode, ctx, atts);
......@@ -1330,6 +1328,12 @@ rsvg_add_clipping_rect (RsvgDrawingCtx *ctx, double x, double y, double w, doubl
ctx->render->add_clipping_rect(ctx, x, y, w, h);
}
void * rsvg_get_image_of_node(RsvgDrawingCtx *ctx, RsvgNode * drawable,
double w, double h)
{
return ctx->render->get_image_of_node(ctx, drawable, w, h);
}
void
rsvg_render_free (RsvgRender * render)
{
......
......@@ -906,9 +906,14 @@ rsvg_css_parse_aspect_ratio (const char * str)
}
gboolean
rsvg_css_parse_overflow(const char * str)
rsvg_css_parse_overflow(const char * str, gboolean * inherit)
{
if (!strcmp(str, "visible"))
SETINHERIT ();
if (!strcmp(str, "visible") || !strcmp(str, "auto"))
return 1;
return 0; /* hidden, scroll */
if (!strcmp(str, "hidden") || !strcmp(str, "scroll"))
return 0;
UNSETINHERIT ();
return 0;
}
......@@ -103,7 +103,7 @@ gdouble *
rsvg_css_parse_number_list(const char * in_str, guint * out_list_len);
gboolean
rsvg_css_parse_overflow(const char * str);
rsvg_css_parse_overflow(const char * str, gboolean * inherit);
G_END_DECLS
......
This diff is collapsed.
......@@ -41,8 +41,8 @@ struct _RsvgFilter {
RsvgFilterUnits primitiveunits;
};
void
rsvg_filter_render (RsvgFilter *self, GdkPixbuf *source, GdkPixbuf *output, GdkPixbuf *bg, RsvgDrawingCtx *context);
GdkPixbuf *
rsvg_filter_render (RsvgFilter *self, GdkPixbuf *source, GdkPixbuf *bg, RsvgDrawingCtx *context, RsvgIRect * dimentions);
RsvgNode *
rsvg_new_filter (void);
......@@ -108,9 +108,17 @@ RsvgNode *
rsvg_new_filter_primitive_tile (void);
void
rsvg_filter_adobe_blend(gint modenum, GdkPixbuf *in, GdkPixbuf *bg, GdkPixbuf *output,
rsvg_filter_adobe_blend(gint modenum, GdkPixbuf *in, GdkPixbuf *bg,
GdkPixbuf *output, RsvgIRect boundarys,
RsvgDrawingCtx * ctx);
void rsvg_alpha_blt (GdkPixbuf * src, gint srcx, gint srcy,
gint srcwidth, gint srcheight,
GdkPixbuf * dst, gint dstx, gint dsty);
void rsvg_art_affine_image(const GdkPixbuf *img, GdkPixbuf *intermediate,
double * affine, double w, double h);
G_END_DECLS
#endif
......@@ -508,7 +508,7 @@ rsvg_node_image_draw (RsvgNode * self, RsvgDrawingCtx *ctx,
rsvg_push_discrete_layer(ctx);
if (!z->overflow && (aspect_ratio & RSVG_ASPECT_RATIO_SLICE)){
if (!rsvg_state_current(ctx)->overflow && (aspect_ratio & RSVG_ASPECT_RATIO_SLICE)){
rsvg_add_clipping_rect(ctx, x, y, w, h);
}
......@@ -569,8 +569,6 @@ rsvg_node_image_set_atts (RsvgNode *self, RsvgHandle *ctx, RsvgPropertyBag *atts
}
if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
image->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
if ((value = rsvg_property_bag_lookup (atts, "overflow")))
image->overflow = rsvg_css_parse_overflow(value);
rsvg_parse_style_attrs (ctx, image->super.state, "image", klazz, id, atts);
}
......@@ -587,7 +585,6 @@ rsvg_new_image (void)
image->y = 0;
image->w = -1;
image->h = -1;
image->overflow = FALSE;
image->super.state = g_new(RsvgState, 1);
rsvg_state_init(image->super.state);
image->super.type = RSVG_NODE_PATH;
......
......@@ -40,7 +40,6 @@ typedef struct _RsvgNodeImage RsvgNodeImage;
struct _RsvgNodeImage {
RsvgNode super;
gboolean overflow;
gint preserve_aspect_ratio, x, y, w, h;
GdkPixbuf *img;
};
......
......@@ -86,8 +86,6 @@ rsvg_node_marker_set_atts (RsvgNode * self, RsvgHandle *ctx, RsvgPropertyBag *at
}
if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
marker->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
if ((value = rsvg_property_bag_lookup (atts, "overflow")))
marker->overflow = rsvg_css_parse_overflow(value);
rsvg_parse_style_attrs (ctx, self->state, "marker", klazz, id, atts);
}
}
......@@ -100,7 +98,6 @@ rsvg_new_marker (void)
_rsvg_node_init(&marker->super);
marker->orient = 0;
marker->orientAuto = FALSE;
marker->overflow = FALSE;
marker->preserve_aspect_ratio = RSVG_ASPECT_RATIO_XMID_YMID;
marker->refX = 0;
marker->refY = 0;
......
......@@ -37,7 +37,7 @@ struct _RsvgMarker {
double refX, refY, orient;
double vbx, vby, vbw, vbh, width, height;
gint preserve_aspect_ratio;
gboolean vbox, orientAuto, overflow;
gboolean vbox, orientAuto;
};
RsvgNode *
......
......@@ -47,6 +47,7 @@ typedef struct _RsvgDefs RsvgDefs;
typedef struct _RsvgNode RsvgNode;
typedef struct _RsvgFilter RsvgFilter;
typedef struct _RsvgNodeChars RsvgNodeChars;
typedef struct _RsvgIRect RsvgIRect;
/* prepare for gettext */
#ifndef _
......@@ -148,6 +149,8 @@ struct RsvgRender {
void (* push_discrete_layer) (RsvgDrawingCtx *ctx);
void (* add_clipping_rect) (RsvgDrawingCtx *ctx,
double x, double y, double w, double h);
void * (* get_image_of_node) (RsvgDrawingCtx *ctx, RsvgNode * drawable,
double w, double h);
};
struct RsvgDimensionData {
......@@ -156,6 +159,10 @@ struct RsvgDimensionData {
gdouble em, ex;
};
struct _RsvgIRect {
int x0, y0, x1, y1;
};
typedef enum {
RSVG_SIZE_ZOOM,
RSVG_SIZE_WH,
......@@ -263,6 +270,8 @@ void rsvg_render_image (RsvgDrawingCtx *ctx, GdkPixbuf * pb,
void rsvg_render_free (RsvgRender * render);
void rsvg_add_clipping_rect (RsvgDrawingCtx *ctx, double x, double y,
double w, double h);
void * rsvg_get_image_of_node(RsvgDrawingCtx *ctx, RsvgNode * drawable,
double w, double h);
void
......
......@@ -195,9 +195,6 @@ rsvg_node_use_draw (RsvgNode * self, RsvgDrawingCtx *ctx,
(symbol->preserve_aspect_ratio,
symbol->width, symbol->height,
&width, &height, &x, &y);
if (!symbol->overflow)
rsvg_add_clipping_rect (ctx, x, y, width, height);
_rsvg_affine_translate(affine, x, y);
_rsvg_affine_multiply(state->affine, affine, state->affine);
......@@ -208,6 +205,10 @@ rsvg_node_use_draw (RsvgNode * self, RsvgDrawingCtx *ctx,
-symbol->y);
_rsvg_affine_multiply(state->affine, affine, state->affine);
if (!state->overflow ||
(!state->has_overflow && child->state->overflow))
rsvg_add_clipping_rect (ctx, symbol->x, symbol->y,
symbol->width, symbol->height);
} else {
_rsvg_affine_translate(affine, use->x, use->y);
_rsvg_affine_multiply(state->affine, affine, state->affine);
......@@ -244,11 +245,12 @@ rsvg_node_svg_draw (RsvgNode * self, RsvgDrawingCtx *ctx,
rsvg_push_discrete_layer (ctx);
if (!sself->overflow && self->parent)
state = rsvg_state_current (ctx);
if (!state->overflow && self->parent)
{
rsvg_add_clipping_rect(ctx, sself->x, sself->y, sself->w, sself->h);
}
state = rsvg_state_current (ctx);
if (sself->has_vbox && sself->hasw && sself->hash)
{
......@@ -332,8 +334,6 @@ rsvg_node_svg_set_atts (RsvgNode * self, RsvgHandle *ctx, RsvgPropertyBag *atts)
id = value;
rsvg_defs_register_name (ctx->defs, value, &svg->super);
}
if ((value = rsvg_property_bag_lookup (atts, "overflow")))
svg->overflow = rsvg_css_parse_overflow(value);
}
}
......@@ -351,7 +351,6 @@ rsvg_new_svg (void)
svg->super.type = RSVG_NODE_PATH;
svg->super.draw = rsvg_node_svg_draw;
svg->super.set_atts = rsvg_node_svg_set_atts;
svg->overflow = FALSE;
return &svg->super;
}
......@@ -437,8 +436,6 @@ rsvg_node_symbol_set_atts(RsvgNode *self, RsvgHandle *ctx, RsvgPropertyBag *atts
}
if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
symbol->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
if ((value = rsvg_property_bag_lookup (atts, "overflow")))
symbol->overflow = rsvg_css_parse_overflow(value);
}
rsvg_parse_style_attrs (ctx, self->state, "symbol", klazz, id, atts);
......@@ -452,7 +449,6 @@ rsvg_new_symbol(void)
symbol = g_new (RsvgNodeSymbol, 1);
_rsvg_node_init(&symbol->super);
symbol->has_vbox = 0;
symbol->overflow = 0;
symbol->preserve_aspect_ratio = RSVG_ASPECT_RATIO_XMID_YMID;
symbol->super.type = RSVG_NODE_SYMBOL;
symbol->super.draw = _rsvg_node_draw_nothing;
......
......@@ -54,7 +54,7 @@ struct _RsvgNodeGroup {
struct _RsvgNodeSymbol {
RsvgNode super;
gint preserve_aspect_ratio;
gboolean overflow, has_vbox;
gboolean has_vbox;
double x, y, width, height;
};
......@@ -71,7 +71,7 @@ struct _RsvgNodeSvg {
int hasw :1;
int hash :1;
gdouble vbx, vby, vbw, vbh;
gboolean overflow, has_vbox;
gboolean has_vbox;
GdkPixbuf *img;
};
......
......@@ -68,7 +68,8 @@ rsvg_state_init (RsvgState *state)
state->stop_opacity = 0xff;
state->fill_rule = FILL_RULE_NONZERO;
state->clip_rule = FILL_RULE_NONZERO;
state->backgroundnew = FALSE;
state->backgroundnew = FALSE;
state->overflow = FALSE;
state->font_family = g_strdup (RSVG_DEFAULT_FONT);
state->font_size = 12.0;
......@@ -117,6 +118,7 @@ rsvg_state_init (RsvgState *state)
state->has_startMarker = FALSE;
state->has_middleMarker = FALSE;
state->has_endMarker = FALSE;
state->has_overflow = FALSE;
}
typedef int (*InheritanceFunction) (int dst, int src);
......@@ -171,6 +173,8 @@ rsvg_state_inherit_run (RsvgState *dst, const RsvgState *src,
dst->fill_rule = src->fill_rule;
if (function(dst->has_clip_rule, src->has_clip_rule))
dst->clip_rule = src->clip_rule;
if (function(dst->overflow, src->overflow))
dst->overflow = src->overflow;
if (function(dst->has_stroke_server, src->has_stroke_server))
{
rsvg_paint_server_ref (src->stroke);
......@@ -392,6 +396,13 @@ rsvg_parse_style_arg (RsvgHandle *ctx, RsvgState *state, const char *str)
{
state->clip_path_ref = rsvg_clip_path_parse(ctx->defs, str + arg_off);
}
else if (rsvg_css_param_match (str, "overflow"))
{
if (strcmp(str + arg_off, "inherit"))
{
state->overflow = rsvg_css_parse_overflow (str + arg_off, &state->has_overflow);
}
}
else if (rsvg_css_param_match (str, "enable-background"))
{
if (!strcmp (str + arg_off, "new"))
......@@ -760,6 +771,7 @@ rsvg_parse_style_pairs (RsvgHandle *ctx, RsvgState *state,
rsvg_lookup_parse_style_pair (ctx, state, "marker-mid", atts);
rsvg_lookup_parse_style_pair (ctx, state, "marker-start", atts);
rsvg_lookup_parse_style_pair (ctx, state, "opacity", atts);
rsvg_lookup_parse_style_pair (ctx, state, "overflow", atts);
rsvg_lookup_parse_style_pair (ctx, state, "stop-color", atts);
rsvg_lookup_parse_style_pair (ctx, state, "stop-opacity", atts);
rsvg_lookup_parse_style_pair (ctx, state, "stroke", atts);
......
......@@ -104,6 +104,9 @@ struct _RsvgState {
gint clip_rule;
gboolean has_clip_rule;