[lasem/properties] [SVG] Cleanup.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [lasem/properties] [SVG] Cleanup.
- Date: Fri, 7 Aug 2009 09:29:36 +0000 (UTC)
commit 53f4eb832501db114c87a2893e897035f0ba1e7f
Author: Emmanuel Pacaud <emmanuel pacaud lapp in2p3 fr>
Date: Fri Aug 7 10:56:44 2009 +0200
[SVG] Cleanup.
src/Makefile.am | 5 -
src/lsmsvgattributebags.c | 274 -----------------
src/lsmsvgattributebags.h | 79 -----
src/lsmsvgattributes.c | 612 -------------------------------------
src/lsmsvgattributes.h | 48 ---
src/lsmsvgcircleelement.c | 38 +---
src/lsmsvgdocument.h | 2 +-
src/lsmsvgelement.c | 120 --------
src/lsmsvgelement.h | 15 -
src/lsmsvgellipseelement.c | 42 ---
src/lsmsvggradientelement.c | 65 ----
src/lsmsvggraphic.c | 307 -------------------
src/lsmsvggraphic.h | 69 -----
src/lsmsvgimageelement.c | 91 ------
src/lsmsvglineargradientelement.c | 43 ---
src/lsmsvglineelement.c | 52 +---
src/lsmsvgmaskelement.c | 65 +----
src/lsmsvgpathelement.c | 10 +-
src/lsmsvgpatternelement.c | 76 -----
src/lsmsvgpolygonelement.c | 7 -
src/lsmsvgpolylineelement.c | 7 -
src/lsmsvgradialgradientelement.c | 48 +---
src/lsmsvgrectelement.c | 54 ----
src/lsmsvgstopelement.c | 55 ----
src/lsmsvgstopelement.h | 4 -
src/lsmsvgstyle.c | 8 -
src/lsmsvgstyle.h | 42 +---
src/lsmsvgsvgelement.c | 110 -------
src/lsmsvgsvgelement.h | 2 -
src/lsmsvgsymbolelement.c | 13 -
src/lsmsvgtextelement.c | 35 +--
src/lsmsvguseelement.c | 75 +----
src/lsmsvguseelement.h | 2 -
src/lsmsvgview.c | 252 ++++------------
src/lsmsvgview.h | 21 +--
35 files changed, 81 insertions(+), 2667 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 647c8bf..0d989f6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -67,8 +67,6 @@ liblasem_la_SOURCES = \
lsmmathmllayoututils.c \
lsmsvgenums.c \
lsmsvgtraits.c \
- lsmsvgattributes.c \
- lsmsvgattributebags.c \
lsmsvgstyle.c \
lsmsvgcolors.c \
lsmsvglength.c \
@@ -76,7 +74,6 @@ liblasem_la_SOURCES = \
lsmsvgmatrix.c \
lsmsvgdocument.c \
lsmsvgelement.c \
- lsmsvggraphic.c \
lsmsvgclippathelement.c \
lsmsvgsvgelement.c \
lsmsvguseelement.c \
@@ -156,7 +153,6 @@ liblasem_la_HEADERS = \
lsmsvgenums.h \
lsmsvgtraits.h \
lsmsvgattributes.h \
- lsmsvgattributebags.h \
lsmsvgstyle.h \
lsmsvgcolors.h \
lsmsvglength.h \
@@ -164,7 +160,6 @@ liblasem_la_HEADERS = \
lsmsvgmatrix.h \
lsmsvgdocument.h \
lsmsvgelement.h \
- lsmsvggraphic.h \
lsmsvgclippathelement.h \
lsmsvgsvgelement.h \
lsmsvggelement.h \
diff --git a/src/lsmsvgattributes.h b/src/lsmsvgattributes.h
index 1a2e298..806ac81 100644
--- a/src/lsmsvgattributes.h
+++ b/src/lsmsvgattributes.h
@@ -46,15 +46,8 @@ typedef struct {
typedef struct {
LsmAttribute base;
LsmSvgLength length;
-// double value;
} LsmSvgLengthAttribute;
-//typedef struct {
-// LsmAttribute base;
-// LsmSvgAnimatedLength length;
-// double value;
-//} LsmSvgAnimatedLengthAttribute;
-
typedef struct {
LsmAttribute base;
LsmSvgPaint paint;
@@ -95,47 +88,6 @@ typedef struct {
LsmSvgPatternUnits value;
} LsmSvgPatternUnitsAttribute;
-#if 0
-/* Properties */
-
-void lsm_svg_double_attribute_parse (LsmSvgDoubleAttribute *attribute,
- double *double_value);
-void lsm_svg_length_attribute_parse (LsmSvgLengthAttribute *attribute,
- LsmSvgLength *default_value);
-void lsm_svg_animated_length_attribute_parse (LsmSvgAnimatedLengthAttribute *attribute,
- LsmSvgLength *default_value);
-
-void lsm_svg_dash_array_attribute_finalize (void *abstract);
-
-void lsm_svg_dash_array_attribute_parse (LsmSvgDashArrayAttribute *attribute,
- LsmSvgDashArray **default_value);
-
-void lsm_svg_fill_rule_attribute_parse (LsmDomEnumAttribute *attribute,
- unsigned int *style_value);
-void lsm_svg_line_join_attribute_parse (LsmDomEnumAttribute *attribute,
- unsigned int *style_value);
-void lsm_svg_line_cap_attribute_parse (LsmDomEnumAttribute *attribute,
- unsigned int *style_value);
-void lsm_svg_pattern_units_attribute_parse (LsmDomEnumAttribute *attribute,
- unsigned int *style_value);
-void lsm_svg_spread_method_attribute_parse (LsmDomEnumAttribute *attribute,
- unsigned int *style_value);
-void lsm_svg_paint_attribute_finalize (void *abstract);
-void lsm_svg_paint_attribute_parse (LsmSvgPaintAttribute *attribute,
- LsmSvgPaint *default_value,
- const LsmSvgColor *current_color);
-void lsm_svg_color_attribute_parse (LsmSvgColorAttribute *attribute,
- LsmSvgColor *default_value,
- const LsmSvgColor *current_color);
-
-/* Attributes */
-
-void lsm_svg_viewbox_attribute_parse (LsmSvgViewboxAttribute *attribute);
-void lsm_svg_transform_attribute_parse (LsmSvgTransformAttribute *attribute);
-void lsm_svg_preserve_aspect_ratio_attribute_parse (LsmSvgPreserveAspectRatioAttribute *attribute);
-
-#endif
-
G_END_DECLS
#endif
diff --git a/src/lsmsvgcircleelement.c b/src/lsmsvgcircleelement.c
index c37b65e..8407424 100644
--- a/src/lsmsvgcircleelement.c
+++ b/src/lsmsvgcircleelement.c
@@ -35,29 +35,6 @@ lsm_svg_circle_element_get_node_name (LsmDomNode *node)
/* LsmSvgElement implementation */
-#if 0
-static void
-lsm_svg_circle_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgCircleElement *circle = LSM_SVG_CIRCLE_ELEMENT (self);
- LsmSvgLength length;
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_animated_length_attribute_parse (&circle->cx, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_animated_length_attribute_parse (&circle->cy, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_animated_length_attribute_parse (&circle->r, &length);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
/* LsmSvgGraphic implementation */
static void
@@ -70,7 +47,7 @@ lsm_svg_circle_element_render (LsmSvgElement *self, LsmSvgView *view)
cy = lsm_svg_view_normalize_length (view, &circle->cy.length, LSM_SVG_LENGTH_DIRECTION_VERTICAL);
r = lsm_svg_view_normalize_length (view, &circle->r.length, LSM_SVG_LENGTH_DIRECTION_DIAGONAL);
- lsm_debug ("[LsmSvgCircleElement::graphic_render] cx = %g, cy = %g, r = %g",
+ lsm_debug ("[LsmSvgCircleElement::render] cx = %g, cy = %g, r = %g",
cx, cy, r);
lsm_svg_view_show_circle (view, cx, cy, r);
@@ -129,7 +106,6 @@ lsm_svg_circle_element_class_init (LsmSvgCircleElementClass *s_rect_class)
GObjectClass *object_class = G_OBJECT_CLASS (s_rect_class);
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_rect_class);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_rect_class);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (s_rect_class);*/
parent_class = g_type_class_peek_parent (s_rect_class);
@@ -137,24 +113,12 @@ lsm_svg_circle_element_class_init (LsmSvgCircleElementClass *s_rect_class)
d_node_class->get_node_name = lsm_svg_circle_element_get_node_name;
-/* s_element_class->update = lsm_svg_circle_element_update;*/
-
s_element_class->render = lsm_svg_circle_element_render;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_circle_element_attribute_infos),
lsm_svg_circle_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "cx",*/
-/* offsetof (LsmSvgCircleElement, cx));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "cy",*/
-/* offsetof (LsmSvgCircleElement, cy));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "r",*/
-/* offsetof (LsmSvgCircleElement, r));*/
}
G_DEFINE_TYPE (LsmSvgCircleElement, lsm_svg_circle_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgdocument.h b/src/lsmsvgdocument.h
index 17de642..ba173a9 100644
--- a/src/lsmsvgdocument.h
+++ b/src/lsmsvgdocument.h
@@ -46,7 +46,7 @@ struct _LsmSvgDocumentClass {
GType lsm_svg_document_get_type (void);
-LsmSvgDocument * lsm_svg_document_new (void);
+LsmSvgDocument * lsm_svg_document_new (void);
LsmSvgSvgElement * lsm_svg_document_get_root_element (const LsmSvgDocument *document);
G_END_DECLS
diff --git a/src/lsmsvgelement.c b/src/lsmsvgelement.c
index a12fa49..38661fb 100644
--- a/src/lsmsvgelement.c
+++ b/src/lsmsvgelement.c
@@ -44,13 +44,6 @@ lsm_svg_element_can_append_child (LsmDomNode *self, LsmDomNode *child)
static gboolean
lsm_svg_element_child_changed (LsmDomNode *parent, LsmDomNode *child)
{
-/* LsmSvgElement *element = LSM_SVG_ELEMENT (parent);*/
-
-/* if (element->need_children_update)*/
-/* return FALSE;*/
-
-/* element->need_children_update = TRUE;*/
-
return TRUE;
}
@@ -65,9 +58,6 @@ lsm_svg_element_set_attribute (LsmDomElement *self, const char* name, const char
lsm_debug ("[LsmSvgElement::set_attribute] node = %s, name = %s, value = %s",
lsm_dom_node_get_node_name (LSM_DOM_NODE (self)), name, value);
-/* lsm_dom_attribute_map_set_attribute (s_element_class->attributes, self,*/
-/* name, value);*/
-
/* TODO Avoid double hash table lookup */
if (!lsm_attribute_manager_set_attribute (s_element_class->attribute_manager,
self, name, value))
@@ -96,73 +86,10 @@ lsm_svg_element_get_attribute (LsmDomElement *self, const char *name)
return value;
return lsm_svg_property_bag_get_property (&s_element->property_bag, name);
-/* return lsm_dom_attribute_map_get_attribute (s_element_class->attributes, self, name);*/
-}
-
-/* LsmSvgElement implementation */
-
-#if 0
-void
-lsm_svg_element_update (LsmSvgElement *self, const LsmSvgStyle *parent_style)
-{
- LsmSvgElementClass *element_class;
- LsmSvgStyle *style;
- LsmDomDocument *document;
- LsmDomNode *node;
-
- g_return_if_fail (LSM_IS_SVG_ELEMENT (self));
- g_return_if_fail (parent_style != NULL);
-
- if (!self->need_update && !self->need_children_update) {
- lsm_debug ("[Element::update] %s already up to date",
- lsm_dom_node_get_node_name (LSM_DOM_NODE (self)));
- return;
- }
-
- document = lsm_dom_node_get_owner_document (LSM_DOM_NODE (self));
- if (document != NULL)
- lsm_dom_document_register_element (document, LSM_DOM_ELEMENT (self), self->id.value);
-
- element_class = LSM_SVG_ELEMENT_GET_CLASS (self);
-
- style = lsm_svg_style_duplicate (parent_style);
- g_return_if_fail (style != NULL);
-
- lsm_debug ("[Element::update] update %s",
- lsm_dom_node_get_node_name (LSM_DOM_NODE (self)));
-
- if (element_class->update != NULL)
- element_class->update (self, style);
-
- for (node = LSM_DOM_NODE (self)->first_child; node != NULL; node = node->next_sibling)
- if (LSM_IS_SVG_ELEMENT (node)) {
- if (self->need_update)
- LSM_SVG_ELEMENT (node)->need_update = TRUE;
- lsm_svg_element_update (LSM_SVG_ELEMENT (node), style);
- }
-
- lsm_svg_style_free (style);
-
- self->need_update = FALSE;
- self->need_children_update = FALSE;
}
-#endif
/* LsmSvgElement implementation */
-/*const LsmSvgMatrix **/
-/*lsm_svg_element_get_transform (LsmSvgElement *element)*/
-/*{*/
-/* LsmSvgElementClass *element_class = LSM_SVG_ELEMENT_GET_CLASS (element);*/
-
-/* g_return_val_if_fail (LSM_IS_SVG_ELEMENT (element),NULL);*/
-
-/* if (element_class->get_transform)*/
-/* return element_class->get_transform (element);*/
-
-/* return NULL;*/
-/*}*/
-
static void
_render (LsmSvgElement *element, LsmSvgView *view)
{
@@ -184,7 +111,6 @@ lsm_svg_element_render (LsmSvgElement *element, LsmSvgView *view)
{
LsmSvgElementClass *element_class;
const LsmSvgStyle *parent_style;
-/* const LsmSvgMatrix *matrix;*/
LsmSvgStyle *style;
g_return_if_fail (LSM_IS_SVG_ELEMENT (element));
@@ -192,8 +118,6 @@ lsm_svg_element_render (LsmSvgElement *element, LsmSvgView *view)
parent_style = lsm_svg_view_get_current_style (view);
style = lsm_svg_style_new_inherited (parent_style, &element->property_bag);
-/* matrix = lsm_svg_element_get_transform (element);*/
-/* if (matrix != NULL)*/
if (!lsm_svg_matrix_is_identity (&element->transform.matrix))
lsm_svg_view_push_matrix (view, &element->transform.matrix);
@@ -212,7 +136,6 @@ lsm_svg_element_render (LsmSvgElement *element, LsmSvgView *view)
lsm_svg_view_pop_style (view);
lsm_svg_view_pop_element (view);
-/* if (matrix != NULL)*/
if (!lsm_svg_matrix_is_identity (&element->transform.matrix))
lsm_svg_view_pop_matrix (view);
@@ -244,48 +167,12 @@ lsm_svg_element_force_render (LsmSvgElement *element, LsmSvgView *view)
lsm_svg_element_render (element, view);
}
-/*void*/
-/*lsm_svg_element_render_paint (LsmSvgElement *element, LsmSvgView *view)*/
-/*{*/
-/* LsmSvgElementClass *element_class;*/
-
-/* g_return_if_fail (LSM_IS_SVG_ELEMENT (element));*/
-
-/* element_class = LSM_SVG_ELEMENT_GET_CLASS (element);*/
-/* if (element_class->render_paint != NULL) {*/
-/* lsm_debug ("[LsmSvgElement::render_paint] Render %s (%s)",*/
-/* lsm_dom_node_get_node_name (LSM_DOM_NODE (element)),*/
-/* element->id.value != NULL ? element->id.value : "no id");*/
-
-/* element_class->render_paint (element, view);*/
-/* }*/
-/*}*/
-
-/*void*/
-/*lsm_svg_element_render_clip (LsmSvgElement *element, LsmSvgView *view)*/
-/*{*/
-/* LsmSvgElementClass *element_class;*/
-
-/* g_return_if_fail (LSM_IS_SVG_ELEMENT (element));*/
-
-/* element_class = LSM_SVG_ELEMENT_GET_CLASS (element);*/
-/* if (element_class->render_clip != NULL) {*/
-/* lsm_debug ("[LsmSvgElement::render_clip] Render %s (%s)",*/
-/* lsm_dom_node_get_node_name (LSM_DOM_NODE (element)),*/
-/* element->id.value != NULL ? element->id.value : "no id");*/
-
-/* element_class->render_clip (element, view);*/
-/* }*/
-/*}*/
-
static void
_get_extents (LsmSvgElement *self, LsmSvgView *view, LsmExtents *extents)
{
-/* LsmSvgGraphic *graphic = LSM_SVG_GRAPHIC (self);*/
LsmDomNode *node;
gboolean first_child = TRUE;
LsmExtents element_extents = {0.0, 0.0, 0.0, 0.0};
-/* const LsmSvgMatrix *matrix;*/
lsm_debug ("[LsmSvgGraphic::_graphic_get_extents]");
@@ -295,11 +182,6 @@ _get_extents (LsmSvgElement *self, LsmSvgView *view, LsmExtents *extents)
lsm_svg_element_get_extents (LSM_SVG_ELEMENT (node), view, &child_extents);
-/* if (graphic->transform != NULL)*/
-/* lsm_svg_matrix_transform_bounding_box (&graphic->transform->transform.matrix,*/
-/* &child_extents.x1, &child_extents.y1,*/
-/* &child_extents.x2, &child_extents.y2);*/
-/* matrix = lsm_svg_element_get_transform (self);*/
if (!lsm_svg_matrix_is_identity (&self->transform.matrix))
lsm_svg_matrix_transform_bounding_box (&self->transform.matrix,
&child_extents.x1, &child_extents.y1,
@@ -346,7 +228,6 @@ lsm_svg_element_get_extents (LsmSvgElement *element, LsmSvgView *view, LsmExtent
static void
lsm_svg_element_init (LsmSvgElement *element)
{
-/* element->need_update = TRUE;*/
lsm_svg_matrix_init_identity (&element->transform.matrix);
}
@@ -407,7 +288,6 @@ lsm_svg_element_class_init (LsmSvgElementClass *s_element_class)
s_element_class->render = _render;
s_element_class->get_extents = _get_extents;
-
s_element_class->attribute_manager = lsm_attribute_manager_new (G_N_ELEMENTS (lsm_svg_attribute_infos),
lsm_svg_attribute_infos);
}
diff --git a/src/lsmsvgelement.h b/src/lsmsvgelement.h
index 7ac867e..4138219 100644
--- a/src/lsmsvgelement.h
+++ b/src/lsmsvgelement.h
@@ -26,7 +26,6 @@
#include <lsmsvg.h>
#include <lsmattributes.h>
#include <lsmsvgattributes.h>
-#include <lsmsvgattributebags.h>
#include <lsmsvgstyle.h>
#include <lsmdomelement.h>
#include <cairo.h>
@@ -50,34 +49,20 @@ struct _LsmSvgElement {
LsmAttribute id;
LsmAttribute class_name;
LsmSvgTransformAttribute transform;
-// LsmAttribute style;
-
- /* View */
-
-// gboolean need_update;
-// gboolean need_children_update;
};
struct _LsmSvgElementClass {
LsmDomElementClass parent_class;
-// LsmDomAttributeMap *attributes;
LsmAttributeManager *attribute_manager;
-// const LsmSvgMatrix * (*get_transform) (LsmSvgElement *element);
-
-// void (*update) (LsmSvgElement *element, LsmSvgStyle *style);
void (*enable_rendering) (LsmSvgElement *element);
void (*render) (LsmSvgElement *element, LsmSvgView *view);
-// void (*render_paint) (LsmSvgElement *element, LsmSvgView *view);
-// void (*render_clip) (LsmSvgElement *element, LsmSvgView *view);
void (*get_extents) (LsmSvgElement *element, LsmSvgView *view, LsmExtents *extents);
};
GType lsm_svg_element_get_type (void);
-//void lsm_svg_element_update (LsmSvgElement *element, const LsmSvgStyle *style);
-//void lsm_svg_element_enable_rendering(LsmSvgElement *self);
void lsm_svg_element_render (LsmSvgElement *element, LsmSvgView *view);
void lsm_svg_element_force_render (LsmSvgElement *element, LsmSvgView *view);
void lsm_svg_element_get_extents (LsmSvgElement *element, LsmSvgView *view, LsmExtents *extents);
diff --git a/src/lsmsvgellipseelement.c b/src/lsmsvgellipseelement.c
index 5703364..f394a77 100644
--- a/src/lsmsvgellipseelement.c
+++ b/src/lsmsvgellipseelement.c
@@ -34,33 +34,6 @@ lsm_svg_ellipse_element_get_node_name (LsmDomNode *node)
/* LsmSvgElement implementation */
-#if 0
-static void
-lsm_svg_ellipse_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgEllipseElement *ellipse = LSM_SVG_ELLIPSE_ELEMENT (self);
- LsmSvgLength length;
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_animated_length_attribute_parse (&ellipse->cx, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_animated_length_attribute_parse (&ellipse->cy, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_animated_length_attribute_parse (&ellipse->rx, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_animated_length_attribute_parse (&ellipse->ry, &length);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
/* LsmSvgGraphic implementation */
static void
@@ -137,7 +110,6 @@ lsm_svg_ellipse_element_class_init (LsmSvgEllipseElementClass *s_rect_class)
GObjectClass *object_class = G_OBJECT_CLASS (s_rect_class);
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_rect_class);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_rect_class);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (s_rect_class);*/
parent_class = g_type_class_peek_parent (s_rect_class);
@@ -145,26 +117,12 @@ lsm_svg_ellipse_element_class_init (LsmSvgEllipseElementClass *s_rect_class)
d_node_class->get_node_name = lsm_svg_ellipse_element_get_node_name;
-/* s_element_class->update = lsm_svg_ellipse_element_update;*/
-
s_element_class->render = lsm_svg_ellipse_element_render;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_ellipse_element_attribute_infos),
lsm_svg_ellipse_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "cx",*/
-/* offsetof (LsmSvgEllipseElement, cx));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "cy",*/
-/* offsetof (LsmSvgEllipseElement, cy));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "rx",*/
-/* offsetof (LsmSvgEllipseElement, rx));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "ry",*/
-/* offsetof (LsmSvgEllipseElement, ry));*/
}
G_DEFINE_TYPE (LsmSvgEllipseElement, lsm_svg_ellipse_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvggradientelement.c b/src/lsmsvggradientelement.c
index 0049823..d7d1ef7 100644
--- a/src/lsmsvggradientelement.c
+++ b/src/lsmsvggradientelement.c
@@ -37,32 +37,11 @@ lsm_svg_gradient_element_can_append_child (LsmDomNode *parent, LsmDomNode *child
/* LsmSvgElement implementation */
-#if 0
-static void
-_gradient_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgGradientElement *gradient = LSM_SVG_GRADIENT_ELEMENT (self);
- LsmSvgPatternUnits units;
- LsmSvgSpreadMethod method;
-
- units = LSM_SVG_PATTERN_UNITS_OBJECT_BOUNDING_BOX;
- method = LSM_SVG_SPREAD_METHOD_PAD;
-
- lsm_svg_pattern_units_attribute_parse (&gradient->units, &units);
- lsm_svg_spread_method_attribute_parse (&gradient->spread_method, &method);
- lsm_svg_transform_attribute_parse (&gradient->transform);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
static void
lsm_svg_gradient_element_render (LsmSvgElement *self, LsmSvgView *view)
{
LsmSvgGradientElement *gradient = LSM_SVG_GRADIENT_ELEMENT (self);
LsmSvgGradientElementClass *gradient_class = LSM_SVG_GRADIENT_ELEMENT_GET_CLASS (self);
-/* LsmDomNode *iter;*/
-/* double last_offset = 0.0;*/
if (!gradient->enable_rendering)
return;
@@ -73,33 +52,6 @@ lsm_svg_gradient_element_render (LsmSvgElement *self, LsmSvgView *view)
gradient_class->create_gradient (self, view);
-#if 0
- for (iter = LSM_DOM_NODE (self)->first_child; iter != NULL; iter = iter->next_sibling) {
- if (LSM_IS_SVG_STOP_ELEMENT (iter)) {
- LsmSvgStopElement *stop;
- const LsmSvgColor *color;
- double offset;
- double opacity;
-
- stop = LSM_SVG_STOP_ELEMENT (iter);
-
- offset = lsm_svg_stop_element_get_offset (stop);
- color = lsm_svg_stop_element_get_color (stop);
- opacity = lsm_svg_stop_element_get_opacity (stop);
-
- if (offset < last_offset)
- offset = last_offset;
- else
- last_offset = offset;
-
- lsm_debug ("[LsmSvgGradientElement::render] Add stop at %g (%g,%g,%g,%g)",
- offset, color->red, color->green, color->blue, opacity);
-
- lsm_svg_view_add_gradient_color_stop (view, offset, color, opacity);
- }
- }
-#endif
-
lsm_svg_view_set_gradient_properties (view,
gradient->spread_method.value,
gradient->units.value,
@@ -162,17 +114,11 @@ lsm_svg_gradient_element_class_init (LsmSvgGradientElementClass *klass)
{
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (klass);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (klass);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (klass);*/
parent_class = g_type_class_peek_parent (klass);
d_node_class->can_append_child = lsm_svg_gradient_element_can_append_child;
-/* s_element_class->update = _gradient_element_update;*/
-/* s_element_class->render_paint = s_element_class->render;*/
-/* s_element_class->render = NULL;*/
-/* s_element_class->render = lsm_svg_gradient_element_render;*/
-
s_element_class->render = lsm_svg_gradient_element_render;
s_element_class->enable_rendering = lsm_svg_gradient_element_enable_rendering;
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
@@ -180,17 +126,6 @@ lsm_svg_gradient_element_class_init (LsmSvgGradientElementClass *klass)
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_gradient_element_attribute_infos),
lsm_svg_gradient_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "gradientUnits",*/
-/* offsetof (LsmSvgGradientElement, units));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "gradientTransform",*/
-/* offsetof (LsmSvgGradientElement, transform));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "spreadMethod",*/
-/* offsetof (LsmSvgGradientElement, spread_method));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "xlink:href",*/
-/* offsetof (LsmSvgGradientElement, href));*/
}
G_DEFINE_ABSTRACT_TYPE (LsmSvgGradientElement, lsm_svg_gradient_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgimageelement.c b/src/lsmsvgimageelement.c
index ff27449..9ae0451 100644
--- a/src/lsmsvgimageelement.c
+++ b/src/lsmsvgimageelement.c
@@ -57,78 +57,6 @@ lsm_svg_use_can_append_child (LsmDomNode *node, LsmDomNode *child)
/* LsmSvgElement implementation */
-#if 0
-static void
-lsm_svg_image_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgImageElement *image_element = LSM_SVG_IMAGE_ELEMENT (self);
- const char *href;
- LsmSvgLength length;
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&image_element->x, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&image_element->y, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&image_element->width, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&image_element->height, &length);
-
- lsm_svg_preserve_aspect_ratio_attribute_parse (&image_element->preserve_aspect_ratio);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-
- if (image_element->pixbuf != NULL) {
- g_object_unref (image_element->pixbuf);
- image_element->pixbuf = NULL;
- }
-
- href = image_element->href.value;
-
- if (href != NULL) {
- GdkPixbufLoader *loader;
- void *image_data;
- gsize data_size;
- int result;
-
- if (strncmp (href, "data:", 5) == 0) {
-
- lsm_debug ("[LsmSvgImageElement::update] Found inlined image");
-
- while (*href != '\0' && *href != ',')
- href++;
-
- image_data = g_base64_decode (href, &data_size);
- } else {
- image_data = NULL;
- data_size = 0;
- }
-
- if (image_data != NULL) {
- loader = gdk_pixbuf_loader_new ();
-
- result = gdk_pixbuf_loader_write (loader, image_data, data_size, NULL);
-
- g_free (image_data);
-
- gdk_pixbuf_loader_close (loader, NULL);
-
- image_element->pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- g_object_ref (image_element->pixbuf);
-
- g_object_unref (loader);
- }
- }
-}
-#endif
-
/* LsmSvgGraphic implementation */
static void
@@ -278,7 +206,6 @@ lsm_svg_image_element_class_init (LsmSvgImageElementClass *klass)
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (klass);
LsmDomElementClass *d_element_class = LSM_DOM_ELEMENT_CLASS (klass);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (klass);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (klass);*/
parent_class = g_type_class_peek_parent (klass);
@@ -289,30 +216,12 @@ lsm_svg_image_element_class_init (LsmSvgImageElementClass *klass)
d_element_class->set_attribute = lsm_svg_image_element_set_attribute;
-/* s_element_class->update = lsm_svg_image_element_update;*/
-
s_element_class->render = lsm_svg_image_element_render;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_image_element_attribute_infos),
lsm_svg_image_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x",*/
-/* offsetof (LsmSvgImageElement, x));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y",*/
-/* offsetof (LsmSvgImageElement, y));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "width",*/
-/* offsetof (LsmSvgImageElement, width));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "height",*/
-/* offsetof (LsmSvgImageElement, height));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "xlink:href",*/
-/* offsetof (LsmSvgImageElement, href));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "preserveAspectRatio",*/
-/* offsetof (LsmSvgImageElement, preserve_aspect_ratio));*/
}
G_DEFINE_TYPE (LsmSvgImageElement, lsm_svg_image_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvglineargradientelement.c b/src/lsmsvglineargradientelement.c
index 0faaf6d..c27f650 100644
--- a/src/lsmsvglineargradientelement.c
+++ b/src/lsmsvglineargradientelement.c
@@ -36,33 +36,6 @@ lsm_svg_linear_gradient_element_get_node_name (LsmDomNode *node)
/* GLinearGradientElement implementation */
-#if 0
-static void
-_linear_gradient_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgLinearGradientElement *linear = LSM_SVG_LINEAR_GRADIENT_ELEMENT (self);
- LsmSvgLength length;
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&linear->x1, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&linear->y1, &length);
-
- length.value_unit = 100.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&linear->x2, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&linear->y2, &length);
-}
-#endif
-
static void
lsm_svg_linear_gradient_element_create_gradient (LsmSvgElement *self, LsmSvgView *view)
{
@@ -91,8 +64,6 @@ lsm_svg_linear_gradient_element_create_gradient (LsmSvgElement *self, LsmSvgView
lsm_svg_view_pop_viewbox (view);
lsm_svg_view_create_linear_gradient (view, x1, y1, x2, y2);
-
-/* LSM_SVG_ELEMENT_CLASS (parent_class)->render_paint (self, view);*/
}
/* LsmSvgLinearGradientElement implementation */
@@ -164,9 +135,6 @@ lsm_svg_linear_gradient_element_class_init (LsmSvgLinearGradientElementClass *s_
d_node_class->get_node_name = lsm_svg_linear_gradient_element_get_node_name;
-/* s_element_class->update = _linear_gradient_element_update;*/
-/* s_element_class->render_paint = _linear_gradient_element_render_paint;*/
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
@@ -174,17 +142,6 @@ lsm_svg_linear_gradient_element_class_init (LsmSvgLinearGradientElementClass *s_
lsm_svg_linear_gradient_element_attribute_infos);
s_gradient_class->create_gradient = lsm_svg_linear_gradient_element_create_gradient;
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x1",*/
-/* offsetof (LsmSvgLinearGradientElement, x1));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y1",*/
-/* offsetof (LsmSvgLinearGradientElement, y1));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x2",*/
-/* offsetof (LsmSvgLinearGradientElement, x2));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y2",*/
-/* offsetof (LsmSvgLinearGradientElement, y2));*/
}
G_DEFINE_TYPE (LsmSvgLinearGradientElement, lsm_svg_linear_gradient_element, LSM_TYPE_SVG_GRADIENT_ELEMENT)
diff --git a/src/lsmsvglineelement.c b/src/lsmsvglineelement.c
index dabefed..c7f5b70 100644
--- a/src/lsmsvglineelement.c
+++ b/src/lsmsvglineelement.c
@@ -35,33 +35,6 @@ lsm_svg_line_element_get_node_name (LsmDomNode *node)
/* LsmSvgElement implementation */
-#if 0
-static void
-lsm_svg_line_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgLineElement *line = LSM_SVG_LINE_ELEMENT (self);
- LsmSvgLength length;
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&line->x1, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&line->y1, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&line->x2, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&line->y2, &length);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
/* LsmSvgGraphic implementation */
static void
@@ -75,7 +48,7 @@ lsm_svg_line_element_render (LsmSvgElement *self, LsmSvgView *view)
x2 = lsm_svg_view_normalize_length (view, &line->x2.length, LSM_SVG_LENGTH_DIRECTION_HORIZONTAL);
y2 = lsm_svg_view_normalize_length (view, &line->y2.length, LSM_SVG_LENGTH_DIRECTION_VERTICAL);
- lsm_debug ("[LsmSvgLineElement::graphic_render] %g, %g, %g, %g", x1, y1, x2, y2);
+ lsm_debug ("[LsmSvgLineElement::render] %g, %g, %g, %g", x1, y1, x2, y2);
lsm_svg_view_show_line (view, x1, y1, x2, y2);
}
@@ -88,15 +61,19 @@ lsm_svg_line_element_new (void)
return g_object_new (LSM_TYPE_SVG_LINE_ELEMENT, NULL);
}
+static const LsmSvgLength length_default = { .value_unit = 0.0, .type = LSM_SVG_LENGTH_TYPE_PX};
+
static void
lsm_svg_line_element_init (LsmSvgLineElement *self)
{
+ self->x1.length = length_default;
+ self->x2.length = length_default;
+ self->y1.length = length_default;
+ self->y2.length = length_default;
}
/* LsmSvgLineElement class */
-static const LsmSvgLength length_default = { .value_unit = 0.0, .type = LSM_SVG_LENGTH_TYPE_PX};
-
static const LsmAttributeInfos lsm_svg_line_element_attribute_infos[] = {
{
.name = "x1",
@@ -129,32 +106,17 @@ lsm_svg_line_element_class_init (LsmSvgLineElementClass *s_rect_class)
{
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_rect_class);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_rect_class);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (s_rect_class);*/
parent_class = g_type_class_peek_parent (s_rect_class);
d_node_class->get_node_name = lsm_svg_line_element_get_node_name;
-/* s_element_class->update = lsm_svg_line_element_update;*/
-
s_element_class->render = lsm_svg_line_element_render;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_line_element_attribute_infos),
lsm_svg_line_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x1",*/
-/* offsetof (LsmSvgLineElement, x1));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y1",*/
-/* offsetof (LsmSvgLineElement, y1));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x2",*/
-/* offsetof (LsmSvgLineElement, x2));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y2",*/
-/* offsetof (LsmSvgLineElement, y2));*/
}
G_DEFINE_TYPE (LsmSvgLineElement, lsm_svg_line_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgmaskelement.c b/src/lsmsvgmaskelement.c
index 20dfb59..16cd1d9 100644
--- a/src/lsmsvgmaskelement.c
+++ b/src/lsmsvgmaskelement.c
@@ -36,40 +36,6 @@ _mask_element_get_node_name (LsmDomNode *node)
/* LsmSvgElement implementation */
-#if 0
-static void
-_mask_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgMaskElement *mask = LSM_SVG_MASK_ELEMENT (self);
- LsmSvgPatternUnits units;
- LsmSvgLength length;
-
- units = LSM_SVG_PATTERN_UNITS_OBJECT_BOUNDING_BOX;
- lsm_svg_pattern_units_attribute_parse (&mask->units, &units);
-
- units = LSM_SVG_PATTERN_UNITS_USER_SPACE_ON_USE;
- lsm_svg_pattern_units_attribute_parse (&mask->content_units, &units);
-
- length.value_unit = -10.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&mask->x, &length);
-
- length.value_unit = -10.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&mask->y, &length);
-
- length.value_unit = 120.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&mask->width, &length);
-
- length.value_unit = 120.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&mask->height, &length);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
static void
lsm_svg_mask_element_render (LsmSvgElement *self, LsmSvgView *view)
{
@@ -185,16 +151,6 @@ lsm_svg_mask_element_init (LsmSvgMaskElement *self)
self->height.length = width_height_default;
self->units.value = units_default;
self->content_units.value = content_units_default;
-
- /* Hack - Force the creation of the attribute bags,
- making sure the properties will be inherited from the
- mask element ancestor, not the referencing one. */
-
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "fill", NULL);*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stroke", NULL);*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "transform", NULL);*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "font-family", NULL);*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stop-color", NULL);*/
}
/* LsmSvgMaskElement class */
@@ -248,32 +204,13 @@ lsm_svg_mask_element_class_init (LsmSvgMaskElementClass *klass)
d_node_class->get_node_name = _mask_element_get_node_name;
-/* s_element_class->update = _mask_element_update;*/
-/* s_element_class->render_paint = _mask_element_render_paint;*/
-/* s_element_class->render = NULL;*/
s_element_class->render = lsm_svg_mask_element_render;
-
- s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
s_element_class->enable_rendering = lsm_svg_mask_element_enable_rendering;
+ s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_mask_element_attribute_infos),
lsm_svg_mask_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x",*/
-/* offsetof (LsmSvgMaskElement, x));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y",*/
-/* offsetof (LsmSvgMaskElement, y));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "width",*/
-/* offsetof (LsmSvgMaskElement, width));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "height",*/
-/* offsetof (LsmSvgMaskElement, height));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "maskUnits",*/
-/* offsetof (LsmSvgMaskElement, units));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "maskContentUnits",*/
-/* offsetof (LsmSvgMaskElement, content_units));*/
}
G_DEFINE_TYPE (LsmSvgMaskElement, lsm_svg_mask_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgpathelement.c b/src/lsmsvgpathelement.c
index f515e5b..eb1d540 100644
--- a/src/lsmsvgpathelement.c
+++ b/src/lsmsvgpathelement.c
@@ -42,9 +42,8 @@ lsm_svg_path_element_render (LsmSvgElement *self, LsmSvgView *view)
path = LSM_SVG_PATH_ELEMENT (self);
- lsm_debug ("[LsmSvgPathElement::graphic_render]");
+ lsm_debug ("[LsmSvgPathElement::render]");
-/* lsm_svg_view_show_path (view, lsm_dom_attribute_get_value (&path->d));*/
lsm_svg_view_show_path (view, path->d.value);
}
@@ -83,7 +82,6 @@ lsm_svg_path_element_class_init (LsmSvgPathElementClass *s_rect_class)
GObjectClass *object_class = G_OBJECT_CLASS (s_rect_class);
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_rect_class);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_rect_class);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (s_rect_class);*/
parent_class = g_type_class_peek_parent (s_rect_class);
@@ -92,17 +90,11 @@ lsm_svg_path_element_class_init (LsmSvgPathElementClass *s_rect_class)
d_node_class->get_node_name = lsm_svg_path_element_get_node_name;
s_element_class->render = lsm_svg_path_element_render;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_path_element_attribute_infos),
lsm_svg_path_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "d",*/
-/* offsetof (LsmSvgPathElement, d));*/
}
G_DEFINE_TYPE (LsmSvgPathElement, lsm_svg_path_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgpatternelement.c b/src/lsmsvgpatternelement.c
index 63c3985..4999c01 100644
--- a/src/lsmsvgpatternelement.c
+++ b/src/lsmsvgpatternelement.c
@@ -36,45 +36,6 @@ _pattern_element_get_node_name (LsmDomNode *node)
/* LsmSvgElement implementation */
-#if 0
-static void
-_pattern_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgPatternElement *pattern = LSM_SVG_PATTERN_ELEMENT (self);
- LsmSvgPatternUnits units;
- LsmSvgLength length;
-
- units = LSM_SVG_PATTERN_UNITS_OBJECT_BOUNDING_BOX;
- lsm_svg_pattern_units_attribute_parse (&pattern->units, &units);
-
- units = LSM_SVG_PATTERN_UNITS_USER_SPACE_ON_USE;
- lsm_svg_pattern_units_attribute_parse (&pattern->content_units, &units);
-
- lsm_svg_transform_attribute_parse (&pattern->transform);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&pattern->x, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&pattern->y, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&pattern->width, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&pattern->height, &length);
-
- lsm_svg_viewbox_attribute_parse (&pattern->viewbox);
- lsm_svg_preserve_aspect_ratio_attribute_parse (&pattern->preserve_aspect_ratio);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
static void
lsm_svg_pattern_element_render (LsmSvgElement *self, LsmSvgView *view)
{
@@ -212,16 +173,6 @@ lsm_svg_pattern_element_init (LsmSvgPatternElement *self)
self->units.value = units_default;
self->content_units.value = content_units_default;
self->preserve_aspect_ratio.value = preserve_aspect_ratio_default;
-
- /* Hack - Force the creation of the attribute bags,
- making sure the properties will be inherited from the
- pattern element ancestor, not the referencing one. */
-
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "fill", NULL);*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stroke", NULL);*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "transform", NULL);*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "font-family", NULL);*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stop-color", NULL);*/
}
/* LsmSvgPatternElement class */
@@ -298,40 +249,13 @@ lsm_svg_pattern_element_class_init (LsmSvgPatternElementClass *klass)
d_node_class->get_node_name = _pattern_element_get_node_name;
-/* s_element_class->update = _pattern_element_update;*/
-/* s_element_class->render_paint = _pattern_element_render_paint;*/
-/* s_element_class->render = NULL;*/
s_element_class->render = lsm_svg_pattern_element_render;
s_element_class->enable_rendering = lsm_svg_pattern_element_enable_rendering;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_pattern_element_attribute_infos),
lsm_svg_pattern_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x",*/
-/* offsetof (LsmSvgPatternElement, x));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y",*/
-/* offsetof (LsmSvgPatternElement, y));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "width",*/
-/* offsetof (LsmSvgPatternElement, width));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "height",*/
-/* offsetof (LsmSvgPatternElement, height));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "patternUnits",*/
-/* offsetof (LsmSvgPatternElement, units));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "patternContentUnits",*/
-/* offsetof (LsmSvgPatternElement, content_units));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "patternTransform",*/
-/* offsetof (LsmSvgPatternElement, transform));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "xlink:href",*/
-/* offsetof (LsmSvgPatternElement, href));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "viewBox",*/
-/* offsetof (LsmSvgPatternElement, viewbox));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "preserveAspectRatio",*/
-/* offsetof (LsmSvgPatternElement, preserve_aspect_ratio));*/
}
G_DEFINE_TYPE (LsmSvgPatternElement, lsm_svg_pattern_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgpolygonelement.c b/src/lsmsvgpolygonelement.c
index e7c7b5e..fde87d0 100644
--- a/src/lsmsvgpolygonelement.c
+++ b/src/lsmsvgpolygonelement.c
@@ -72,24 +72,17 @@ lsm_svg_polygon_element_class_init (LsmSvgPolygonElementClass *s_rect_class)
{
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_rect_class);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_rect_class);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (s_rect_class);*/
parent_class = g_type_class_peek_parent (s_rect_class);
d_node_class->get_node_name = lsm_svg_polygon_element_get_node_name;
s_element_class->render = lsm_svg_polygon_element_render;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_polygon_element_attribute_infos),
lsm_svg_polygon_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "points",*/
-/* offsetof (LsmSvgPolygonElement, points));*/
}
G_DEFINE_TYPE (LsmSvgPolygonElement, lsm_svg_polygon_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgpolylineelement.c b/src/lsmsvgpolylineelement.c
index 9ec61fd..821e7b0 100644
--- a/src/lsmsvgpolylineelement.c
+++ b/src/lsmsvgpolylineelement.c
@@ -72,24 +72,17 @@ lsm_svg_polyline_element_class_init (LsmSvgPolylineElementClass *s_rect_class)
{
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_rect_class);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_rect_class);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (s_rect_class);*/
parent_class = g_type_class_peek_parent (s_rect_class);
d_node_class->get_node_name = lsm_svg_polyline_element_get_node_name;
s_element_class->render = lsm_svg_polyline_element_render;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_polyline_element_attribute_infos),
lsm_svg_polyline_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "points",*/
-/* offsetof (LsmSvgPolylineElement, points));*/
}
G_DEFINE_TYPE (LsmSvgPolylineElement, lsm_svg_polyline_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgradialgradientelement.c b/src/lsmsvgradialgradientelement.c
index d8a036c..daa569c 100644
--- a/src/lsmsvgradialgradientelement.c
+++ b/src/lsmsvgradialgradientelement.c
@@ -35,36 +35,7 @@ lsm_svg_radial_gradient_element_get_node_name (LsmDomNode *node)
return "radialGradient";
}
-/* GRadialGradientElement implementation */
-
-#if 0
-static void
-_radial_gradient_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgRadialGradientElement *radial = LSM_SVG_RADIAL_GRADIENT_ELEMENT (self);
- LsmSvgLength length;
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-
- length.value_unit = 50.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&radial->cx, &length);
-
- length.value_unit = 50.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&radial->cy, &length);
-
- length.value_unit = 50.0;
- length.type = LSM_SVG_LENGTH_TYPE_PERCENTAGE;
- lsm_svg_animated_length_attribute_parse (&radial->r, &length);
-
- length = radial->cx.length.base;
- lsm_svg_animated_length_attribute_parse (&radial->fx, &length);
-
- length = radial->cy.length.base;
- lsm_svg_animated_length_attribute_parse (&radial->fy, &length);
-}
-#endif
+/* LsmSvgRadialGradientElement implementation */
static void
lsm_svg_radial_gradient_element_create_gradient (LsmSvgElement *self, LsmSvgView *view)
@@ -115,8 +86,6 @@ lsm_svg_radial_gradient_element_create_gradient (LsmSvgElement *self, LsmSvgView
cx, cy, r, fx, fy);
lsm_svg_view_create_radial_gradient (view, cx, cy, r, fx, fy);
-
-/* LSM_SVG_ELEMENT_CLASS (parent_class)->render_paint (self, view);*/
}
/* LsmSvgRadialGradientElement implementation */
@@ -195,9 +164,6 @@ lsm_svg_radial_gradient_element_class_init (LsmSvgRadialGradientElementClass *s_
d_node_class->get_node_name = lsm_svg_radial_gradient_element_get_node_name;
-/* s_element_class->update = _radial_gradient_element_update;*/
-/* s_element_class->render_paint = _radial_gradient_element_render_paint;*/
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
@@ -205,18 +171,6 @@ lsm_svg_radial_gradient_element_class_init (LsmSvgRadialGradientElementClass *s_
lsm_svg_radial_gradient_element_attribute_infos);
s_gradient_class->create_gradient = lsm_svg_radial_gradient_element_create_gradient;
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "cx",*/
-/* offsetof (LsmSvgRadialGradientElement, cx));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "cy",*/
-/* offsetof (LsmSvgRadialGradientElement, cy));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "r",*/
-/* offsetof (LsmSvgRadialGradientElement, r));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "fx",*/
-/* offsetof (LsmSvgRadialGradientElement, fx));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "fy",*/
-/* offsetof (LsmSvgRadialGradientElement, fy));*/
}
G_DEFINE_TYPE (LsmSvgRadialGradientElement, lsm_svg_radial_gradient_element, LSM_TYPE_SVG_GRADIENT_ELEMENT)
diff --git a/src/lsmsvgrectelement.c b/src/lsmsvgrectelement.c
index 807d81d..c743fb1 100644
--- a/src/lsmsvgrectelement.c
+++ b/src/lsmsvgrectelement.c
@@ -34,41 +34,6 @@ lsm_svg_rect_element_get_node_name (LsmDomNode *node)
/* LsmSvgElement implementation */
-#if 0
-static void
-lsm_svg_rect_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgRectElement *rect = LSM_SVG_RECT_ELEMENT (self);
- LsmSvgLength length;
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&rect->x, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&rect->y, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&rect->width, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&rect->height, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&rect->rx, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&rect->ry, &length);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
/* LsmSvgGraphic implementation */
static void
@@ -191,7 +156,6 @@ lsm_svg_rect_element_class_init (LsmSvgRectElementClass *s_rect_class)
GObjectClass *object_class = G_OBJECT_CLASS (s_rect_class);
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_rect_class);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_rect_class);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (s_rect_class);*/
parent_class = g_type_class_peek_parent (s_rect_class);
@@ -199,31 +163,13 @@ lsm_svg_rect_element_class_init (LsmSvgRectElementClass *s_rect_class)
d_node_class->get_node_name = lsm_svg_rect_element_get_node_name;
-/* s_element_class->update = lsm_svg_rect_element_update;*/
-
s_element_class->render = lsm_svg_rect_element_render;
s_element_class->get_extents = lsm_svg_rect_element_get_extents;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_rect_element_attribute_infos),
lsm_svg_rect_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x",*/
-/* offsetof (LsmSvgRectElement, x));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y",*/
-/* offsetof (LsmSvgRectElement, y));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "width",*/
-/* offsetof (LsmSvgRectElement, width));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "height",*/
-/* offsetof (LsmSvgRectElement, height));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "rx",*/
-/* offsetof (LsmSvgRectElement, rx));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "ry",*/
-/* offsetof (LsmSvgRectElement, ry));*/
}
G_DEFINE_TYPE (LsmSvgRectElement, lsm_svg_rect_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgstopelement.c b/src/lsmsvgstopelement.c
index e93395b..e50b7f3 100644
--- a/src/lsmsvgstopelement.c
+++ b/src/lsmsvgstopelement.c
@@ -37,20 +37,6 @@ lsm_svg_stop_element_get_node_name (LsmDomNode *node)
/* LsmSvgElement implementation */
-#if 0
-static void
-_stop_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgStopElement *stop = LSM_SVG_STOP_ELEMENT (self);
- LsmSvgLength length;
-
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_length_attribute_parse (&stop->offset, &length);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
static void
lsm_svg_stop_element_render (LsmSvgElement *element, LsmSvgView *view)
{
@@ -69,41 +55,6 @@ lsm_svg_stop_element_render (LsmSvgElement *element, LsmSvgView *view)
/* LsmSvgStopElement implementation */
-#if 0
-double
-lsm_svg_stop_element_get_offset (LsmSvgStopElement *self)
-{
- g_return_val_if_fail (LSM_IS_SVG_STOP_ELEMENT (self), 0.0);
-
- if (self->offset.length.type == LSM_SVG_LENGTH_TYPE_PERCENTAGE)
- return self->offset.length.value_unit / 100.0;
- else
- return self->offset.length.value_unit;
-}
-
-const LsmSvgColor *
-lsm_svg_stop_element_get_color (LsmSvgStopElement *self)
-{
-/* g_return_val_if_fail (LSM_IS_SVG_STOP_ELEMENT (self), &lsm_svg_color_null);*/
-
-/* if (LSM_SVG_GRAPHIC (self)->stop != NULL)*/
-/* return &(LSM_SVG_GRAPHIC (self)->stop->color.value);*/
-/* else*/
- return &lsm_svg_color_null;
-}
-
-double
-lsm_svg_stop_element_get_opacity (LsmSvgStopElement *self)
-{
-/* g_return_val_if_fail (LSM_IS_SVG_STOP_ELEMENT (self), 1.0);*/
-
-/* if (LSM_SVG_GRAPHIC(self)->stop != NULL)*/
-/* return LSM_SVG_GRAPHIC (self)->stop->opacity.value;*/
-/* else*/
- return 1.0;
-}
-#endif
-
LsmDomNode *
lsm_svg_stop_element_new (void)
{
@@ -139,8 +90,6 @@ lsm_svg_stop_element_class_init (LsmSvgStopElementClass *klass)
d_node_class->get_node_name = lsm_svg_stop_element_get_node_name;
-/* s_element_class->update = _stop_element_update;*/
-
s_element_class->render = lsm_svg_stop_element_render;
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
@@ -148,10 +97,6 @@ lsm_svg_stop_element_class_init (LsmSvgStopElementClass *klass)
G_N_ELEMENTS (lsm_svg_stop_element_attribute_infos),
lsm_svg_stop_element_attribute_infos);
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "offset",*/
-/* offsetof (LsmSvgStopElement, offset));*/
}
G_DEFINE_TYPE (LsmSvgStopElement, lsm_svg_stop_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgstopelement.h b/src/lsmsvgstopelement.h
index 32075ac..7b17be4 100644
--- a/src/lsmsvgstopelement.h
+++ b/src/lsmsvgstopelement.h
@@ -50,10 +50,6 @@ GType lsm_svg_stop_element_get_type (void);
LsmDomNode * lsm_svg_stop_element_new (void);
-double lsm_svg_stop_element_get_offset (LsmSvgStopElement *self);
-const LsmSvgColor * lsm_svg_stop_element_get_color (LsmSvgStopElement *self);
-double lsm_svg_stop_element_get_opacity (LsmSvgStopElement *self);
-
G_END_DECLS
#endif
diff --git a/src/lsmsvgstyle.c b/src/lsmsvgstyle.c
index 893b46f..438aa26 100644
--- a/src/lsmsvgstyle.c
+++ b/src/lsmsvgstyle.c
@@ -464,8 +464,6 @@ lsm_svg_style_new (void)
style = g_new0 (LsmSvgStyle, 1);
-/* style->text.font_family = g_strdup ("sans");*/
-
return style;
}
@@ -474,9 +472,6 @@ lsm_svg_style_free (LsmSvgStyle *style)
{
g_return_if_fail (style != NULL);
-/* lsm_svg_dash_array_free (style->stroke.dash_array);*/
-
-/* g_free (style->text.font_family);*/
g_free (style);
}
@@ -502,9 +497,6 @@ lsm_svg_style_new_inherited (const LsmSvgStyle *parent_style, LsmPropertyBag *pr
memcpy (style, default_style, sizeof (LsmSvgStyle));
}
-/* style->stroke.dash_array = lsm_svg_dash_array_duplicate (from->stroke.dash_array);*/
-/* style->text.font_family = g_strdup (from->text.font_family);*/
-
return style;
}
diff --git a/src/lsmsvgstyle.h b/src/lsmsvgstyle.h
index 701c349..cbb1cc7 100644
--- a/src/lsmsvgstyle.h
+++ b/src/lsmsvgstyle.h
@@ -22,9 +22,8 @@
#ifndef LSM_SVG_STYLE_H
#define LSM_SVG_STYLE_H
+#include <lsmsvgtraits.h>
#include <lsmproperties.h>
-#include <lsmsvg.h>
-#include <lsmsvgattributebags.h>
G_BEGIN_DECLS
@@ -149,45 +148,6 @@ const char * lsm_svg_property_bag_get_property (LsmPropertyBag *property_bag,
void lsm_svg_property_bag_clean (LsmPropertyBag *property_bag);
char * lsm_svg_property_bag_serialize (LsmPropertyBag *property_bag);
-#if 0
-struct _LsmSvgStyle {
- LsmBox viewport;
- LsmSvgColor color;
-
- struct {
- LsmSvgPaint paint;
- LsmSvgFillRule rule;
- double opacity;
- } fill;
-
- struct {
- LsmSvgPaint paint;
- LsmSvgLength width;
- LsmSvgLineJoin line_join;
- LsmSvgLineCap line_cap;
- double opacity;
- double miter_limit;
- LsmSvgDashArray *dash_array;
- LsmSvgLength dash_offset;
- } stroke;
-
- struct {
- LsmSvgFillRule rule;
- } clip;
-
- struct {
- char *font_family;
- LsmSvgLength font_size;
- } text;
-
- struct {
- LsmSvgColor color;
- double opacity;
- } stop;
-};
-
-#endif
-
LsmSvgStyle * lsm_svg_style_new (void);
void lsm_svg_style_free (LsmSvgStyle *style);
LsmSvgStyle * lsm_svg_style_new_inherited (const LsmSvgStyle *parent_style,
diff --git a/src/lsmsvgsvgelement.c b/src/lsmsvgsvgelement.c
index c8ed8d4..9537697 100644
--- a/src/lsmsvgsvgelement.c
+++ b/src/lsmsvgsvgelement.c
@@ -39,44 +39,6 @@ lsm_svg_svg_element_get_node_name (LsmDomNode *node)
/* LsmSvgElement implementation */
-#if 0
-static void
-_svg_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgSvgElement *svg = LSM_SVG_SVG_ELEMENT (self);
- LsmSvgLength length;
-
- length.value_unit = 0;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_length_attribute_parse (&svg->x, &length);
-
- length.value_unit = 0;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_length_attribute_parse (&svg->y, &length);
-
- length.value_unit = parent_style->viewport.width;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_length_attribute_parse (&svg->width, &length);
-
- length.value_unit = parent_style->viewport.height;
- length.type = LSM_SVG_LENGTH_TYPE_NUMBER;
- lsm_svg_length_attribute_parse (&svg->height, &length);
-
- lsm_svg_viewbox_attribute_parse (&svg->viewbox);
- lsm_svg_preserve_aspect_ratio_attribute_parse (&svg->preserve_aspect_ratio);
-
- lsm_debug ("[LsmSvgSvgElement::update] view_bbox = %g, %g, %g, %g\n",
- svg->viewbox.value.x,
- svg->viewbox.value.y,
- svg->viewbox.value.width,
- svg->viewbox.value.height);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-
- parent_style->viewport = svg->viewbox.value;
-}
-#endif
-
void
lsm_svg_svg_element_measure (LsmSvgSvgElement *self, double *width, double *height)
{
@@ -174,40 +136,12 @@ _svg_element_render (LsmSvgElement *self, LsmSvgView *view)
/* LsmSvgSvgElement implementation */
-/*LsmSvgStyle **/
-/*lsm_svg_svg_element_get_default_style (LsmSvgSvgElement *svg_element)*/
-/*{*/
-/* g_return_val_if_fail (LSM_IS_SVG_SVG_ELEMENT (svg_element), NULL);*/
-
-/* return svg_element->default_style;*/
-/*}*/
-
-/*void*/
-/*lsm_svg_svg_element_update (LsmSvgSvgElement *svg_element)*/
-/*{*/
-/* LsmDomDocument *document;*/
-/* LsmSvgStyle *style;*/
-
-/* g_return_if_fail (LSM_IS_SVG_SVG_ELEMENT (svg_element));*/
-
-/* document = LSM_DOM_DOCUMENT (LSM_DOM_NODE (svg_element)->parent_node);*/
-/* g_return_if_fail (LSM_IS_DOM_DOCUMENT (document));*/
-
-/* style = lsm_svg_svg_element_get_default_style (svg_element);*/
-
-/* style->viewport = lsm_dom_document_get_viewport_px (document);*/
-
-/* lsm_svg_element_update (LSM_SVG_ELEMENT (svg_element), style);*/
-/*}*/
-
void
lsm_svg_svg_element_render (LsmSvgSvgElement *svg, LsmSvgView *view)
{
-/* lsm_svg_view_push_style (view, svg->default_style);*/
lsm_svg_view_push_viewbox (view, &svg->svg_box);
lsm_svg_element_render (LSM_SVG_ELEMENT (svg), view);
lsm_svg_view_pop_viewbox (view);
-/* lsm_svg_view_pop_style (view);*/
}
LsmDomNode *
@@ -234,36 +168,11 @@ lsm_svg_svg_element_init (LsmSvgSvgElement *self)
self->height.length = width_height_default;
self->viewbox.value = viewbox_default;
self->preserve_aspect_ratio.value = preserve_aspect_ratio_default;
-
-/* LsmSvgStyle *style;*/
-
-/* style = lsm_svg_style_new ();*/
-/* self->default_style = style;*/
-/* g_return_if_fail (style != NULL);*/
-
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "opacity", "1.0");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "fill", "black");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "fill-opacity", "1");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "fill-rule", "nonzero");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stroke", "none");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stroke-width", "1px");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stroke-opacity", "1");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stroke-linejoin", "miter");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stroke-linecap", "butt");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stroke-miterlimit", "4");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "font-family", "sans");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "font-size", "10pt");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stop-color", "black");*/
-/* lsm_dom_element_set_attribute (LSM_DOM_ELEMENT (self), "stop-opacity", "1");*/
}
static void
lsm_svg_svg_element_finalize (GObject *object)
{
-/* LsmSvgSvgElement *svg_element = LSM_SVG_SVG_ELEMENT (object);*/
-
-/* lsm_svg_style_free (svg_element->default_style);*/
-
parent_class->finalize (object);
}
@@ -314,7 +223,6 @@ lsm_svg_svg_element_class_init (LsmSvgSvgElementClass *s_svg_class)
GObjectClass *object_class = G_OBJECT_CLASS (s_svg_class);
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_svg_class);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_svg_class);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (s_svg_class);*/
parent_class = g_type_class_peek_parent (s_svg_class);
@@ -322,30 +230,12 @@ lsm_svg_svg_element_class_init (LsmSvgSvgElementClass *s_svg_class)
d_node_class->get_node_name = lsm_svg_svg_element_get_node_name;
-/* s_element_class->update = _svg_element_update;*/
-
s_element_class->render = _svg_element_render;
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_svg_element_attribute_infos),
lsm_svg_svg_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x",*/
-/* offsetof (LsmSvgSvgElement, x));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y",*/
-/* offsetof (LsmSvgSvgElement, y));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "width",*/
-/* offsetof (LsmSvgSvgElement, width));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "height",*/
-/* offsetof (LsmSvgSvgElement, height));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "viewBox",*/
-/* offsetof (LsmSvgSvgElement, viewbox));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "preserveAspectRatio",*/
-/* offsetof (LsmSvgSvgElement, preserve_aspect_ratio));*/
}
G_DEFINE_TYPE (LsmSvgSvgElement, lsm_svg_svg_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgsvgelement.h b/src/lsmsvgsvgelement.h
index 79e3eb2..fca6269 100644
--- a/src/lsmsvgsvgelement.h
+++ b/src/lsmsvgsvgelement.h
@@ -60,8 +60,6 @@ GType lsm_svg_svg_element_get_type (void);
LsmDomNode * lsm_svg_svg_element_new (void);
-//LsmSvgStyle * lsm_svg_svg_element_get_default_style (LsmSvgSvgElement *svg_element);
-//void lsm_svg_svg_element_update (LsmSvgSvgElement *svg_element);
void lsm_svg_svg_element_measure (LsmSvgSvgElement *self, double *width, double *height);
void lsm_svg_svg_element_render (LsmSvgSvgElement *svg_element, LsmSvgView *view);
diff --git a/src/lsmsvgsymbolelement.c b/src/lsmsvgsymbolelement.c
index 6863354..1f8b641 100644
--- a/src/lsmsvgsymbolelement.c
+++ b/src/lsmsvgsymbolelement.c
@@ -37,14 +37,6 @@ lsm_svg_symbol_element_get_node_name (LsmDomNode *node)
/* LsmSvgElement implementation */
-#if 0
-static void
-lsm_svg_symbol_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
/* LsmSvgGraphic implementation */
/* LsmSvgSymbolElement implementation */
@@ -66,15 +58,10 @@ static void
lsm_svg_symbol_element_class_init (LsmSvgSymbolElementClass *klass)
{
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (klass);
-/* LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (klass);*/
parent_class = g_type_class_peek_parent (klass);
d_node_class->get_node_name = lsm_svg_symbol_element_get_node_name;
-
-/* s_element_class->update = lsm_svg_symbol_element_update;*/
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
}
G_DEFINE_TYPE (LsmSvgSymbolElement, lsm_svg_symbol_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvgtextelement.c b/src/lsmsvgtextelement.c
index 90e205b..c891343 100644
--- a/src/lsmsvgtextelement.c
+++ b/src/lsmsvgtextelement.c
@@ -41,25 +41,6 @@ lsm_svg_text_element_can_append_child (LsmDomNode *self, LsmDomNode *child)
/* LsmSvgElement implementation */
-#if 0
-static void
-lsm_svg_text_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgTextElement *text = LSM_SVG_TEXT_ELEMENT (self);
- LsmSvgLength length;
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&text->x, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&text->y, &length);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
/* LsmSvgGraphic implementation */
static void
@@ -96,9 +77,13 @@ lsm_svg_text_element_new (void)
return g_object_new (LSM_TYPE_SVG_TEXT_ELEMENT, NULL);
}
+static const LsmSvgLength length_default = { .value_unit = 0.0, .type = LSM_SVG_LENGTH_TYPE_PX};
+
static void
lsm_svg_text_element_init (LsmSvgTextElement *self)
{
+ self->x.length = length_default;
+ self->y.length = length_default;
}
static void
@@ -109,8 +94,6 @@ lsm_svg_text_element_finalize (GObject *object)
/* LsmSvgTextElement class */
-static const LsmSvgLength length_default = { .value_unit = 0.0, .type = LSM_SVG_LENGTH_TYPE_PX};
-
static const LsmAttributeInfos lsm_svg_text_element_attribute_infos[] = {
{
.name = "x",
@@ -132,7 +115,6 @@ lsm_svg_text_element_class_init (LsmSvgTextElementClass *s_text_class)
GObjectClass *object_class = G_OBJECT_CLASS (s_text_class);
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_text_class);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_text_class);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (s_text_class);*/
parent_class = g_type_class_peek_parent (s_text_class);
@@ -141,21 +123,12 @@ lsm_svg_text_element_class_init (LsmSvgTextElementClass *s_text_class)
d_node_class->get_node_name = lsm_svg_text_element_get_node_name;
d_node_class->can_append_child = lsm_svg_text_element_can_append_child;
-/* s_element_class->update = lsm_svg_text_element_update;*/
-
s_element_class->render = lsm_svg_text_element_render;
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_text_element_attribute_infos),
lsm_svg_text_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x",*/
-/* offsetof (LsmSvgTextElement, x));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y",*/
-/* offsetof (LsmSvgTextElement, y));*/
}
G_DEFINE_TYPE (LsmSvgTextElement, lsm_svg_text_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvguseelement.c b/src/lsmsvguseelement.c
index 101eb4f..5fcb2ee 100644
--- a/src/lsmsvguseelement.c
+++ b/src/lsmsvguseelement.c
@@ -43,33 +43,6 @@ lsm_svg_use_can_append_child (LsmDomNode *node, LsmDomNode *child)
/* LsmSvgElement implementation */
-#if 0
-static void
-lsm_svg_use_element_update (LsmSvgElement *self, LsmSvgStyle *parent_style)
-{
- LsmSvgUseElement *use_element = LSM_SVG_USE_ELEMENT (self);
- LsmSvgLength length;
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&use_element->x, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&use_element->y, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&use_element->width, &length);
-
- length.value_unit = 0.0;
- length.type = LSM_SVG_LENGTH_TYPE_PX;
- lsm_svg_animated_length_attribute_parse (&use_element->height, &length);
-
- LSM_SVG_ELEMENT_CLASS (parent_class)->update (self, parent_style);
-}
-#endif
-
/* LsmSvgGraphic implementation */
static void
@@ -84,7 +57,7 @@ lsm_svg_use_element_render (LsmSvgElement *self, LsmSvgView *view)
document = lsm_dom_node_get_owner_document (LSM_DOM_NODE (self));
if (document == NULL) {
- lsm_debug ("[LsmSvgUseElement::graphic_render] Owner document not found");
+ lsm_debug ("[LsmSvgUseElement::render] Owner document not found");
return;
}
@@ -100,7 +73,7 @@ lsm_svg_use_element_render (LsmSvgElement *self, LsmSvgView *view)
element = lsm_dom_document_get_element_by_id (document, id);
if (!LSM_IS_SVG_ELEMENT (element)) {
- lsm_debug ("[LsmSvgUseElement::graphic_render] Target '%s' not found", id);
+ lsm_debug ("[LsmSvgUseElement::render] Target '%s' not found", id);
return;
}
@@ -108,10 +81,8 @@ lsm_svg_use_element_render (LsmSvgElement *self, LsmSvgView *view)
LSM_SVG_LENGTH_DIRECTION_HORIZONTAL);
height = lsm_svg_view_normalize_length (view, &use_element->height.length,
LSM_SVG_LENGTH_DIRECTION_VERTICAL);
-/* if (width <= 0.0 || height <= 0.0)*/
-/* return;*/
- lsm_debug ("[LsmSvgUseElement::graphic_render] Use '%s'", id);
+ lsm_debug ("[LsmSvgUseElement::render] Use '%s'", id);
x = lsm_svg_view_normalize_length (view, &use_element->x.length,
LSM_SVG_LENGTH_DIRECTION_HORIZONTAL);
@@ -126,12 +97,6 @@ lsm_svg_use_element_render (LsmSvgElement *self, LsmSvgView *view)
lsm_svg_view_pop_matrix (view);
}
-/*static const LsmSvgMatrix **/
-/*lsm_svg_use_element_get_transform (LsmSvgElement *element)*/
-/*{*/
-/* return (&LSM_SVG_USE_ELEMENT (element)->transform.matrix);*/
-/*}*/
-
/* LsmSvgUseElement implementation */
LsmDomNode *
@@ -140,16 +105,19 @@ lsm_svg_use_element_new (void)
return g_object_new (LSM_TYPE_SVG_USE_ELEMENT, NULL);
}
+static const LsmSvgLength length_default = { .value_unit = 0.0, .type = LSM_SVG_LENGTH_TYPE_PX};
+
static void
lsm_svg_use_element_init (LsmSvgUseElement *self)
{
+ self->x.length = length_default;
+ self->y.length = length_default;
+ self->width.length = length_default;
+ self->height.length = length_default;
}
/* LsmSvgUseElement class */
-static const LsmSvgLength length_default = { .value_unit = 0.0, .type = LSM_SVG_LENGTH_TYPE_PX};
-static const LsmSvgMatrix matrix_default = { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0};
-
static const LsmAttributeInfos lsm_svg_use_element_attribute_infos[] = {
{
.name = "x",
@@ -180,13 +148,6 @@ static const LsmAttributeInfos lsm_svg_use_element_attribute_infos[] = {
.attribute_offset = offsetof (LsmSvgUseElement, href),
.trait_class = &lsm_null_trait_class
}
-/* ,*/
-/* {*/
-/* .name = "transform",*/
-/* .attribute_offset = offsetof (LsmSvgUseElement, transform),*/
-/* .trait_class = &lsm_svg_matrix_trait_class,*/
-/* .trait_default = &matrix_default*/
-/* }*/
};
static void
@@ -194,36 +155,18 @@ lsm_svg_use_element_class_init (LsmSvgUseElementClass *klass)
{
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (klass);
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (klass);
-/* LsmSvgGraphicClass *s_graphic_class = LSM_SVG_GRAPHIC_CLASS (klass);*/
parent_class = g_type_class_peek_parent (klass);
d_node_class->get_node_name = lsm_svg_use_element_get_node_name;
d_node_class->can_append_child = lsm_svg_use_can_append_child;
-/* s_element_class->update = lsm_svg_use_element_update;*/
-
s_element_class->render = lsm_svg_use_element_render;
-/* s_element_class->get_transform = lsm_svg_use_element_get_transform;*/
-
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
G_N_ELEMENTS (lsm_svg_use_element_attribute_infos),
lsm_svg_use_element_attribute_infos);
-
-/* s_element_class->attributes = lsm_dom_attribute_map_duplicate (s_element_class->attributes);*/
-
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "x",*/
-/* offsetof (LsmSvgUseElement, x));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "y",*/
-/* offsetof (LsmSvgUseElement, y));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "width",*/
-/* offsetof (LsmSvgUseElement, width));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "height",*/
-/* offsetof (LsmSvgUseElement, height));*/
-/* lsm_dom_attribute_map_add_attribute (s_element_class->attributes, "xlink:href",*/
-/* offsetof (LsmSvgUseElement, href));*/
}
G_DEFINE_TYPE (LsmSvgUseElement, lsm_svg_use_element, LSM_TYPE_SVG_ELEMENT)
diff --git a/src/lsmsvguseelement.h b/src/lsmsvguseelement.h
index 3ea6c4a..3645d90 100644
--- a/src/lsmsvguseelement.h
+++ b/src/lsmsvguseelement.h
@@ -45,8 +45,6 @@ struct _LsmSvgUseElement {
LsmSvgLengthAttribute height;
LsmAttribute href;
-
-// LsmSvgTransformAttribute transform;
};
struct _LsmSvgUseElementClass {
diff --git a/src/lsmsvgview.c b/src/lsmsvgview.c
index d98a79a..58845fc 100644
--- a/src/lsmsvgview.c
+++ b/src/lsmsvgview.c
@@ -58,13 +58,7 @@ lsm_svg_view_normalize_length (LsmSvgView *view, const LsmSvgLength *length, Lsm
g_return_val_if_fail (LSM_IS_SVG_VIEW (view), 0.0);
/* TODO cache font size */
-/* if (view->text_stack != NULL && view->viewbox_stack != NULL) {*/
if (view->viewbox_stack != NULL && view->style != NULL) {
-/* LsmSvgTextAttributeBag *text;*/
-
-/* text = view->text_stack->data;*/
-/* font_size = lsm_svg_length_normalize (&text->font_size.length, view->viewbox_stack->data,*/
-/* 0.0, LSM_SVG_LENGTH_DIRECTION_DIAGONAL);*/
font_size = lsm_svg_length_normalize (&view->style->font_size->length, view->viewbox_stack->data,
0.0, LSM_SVG_LENGTH_DIRECTION_DIAGONAL);
} else
@@ -149,7 +143,6 @@ lsm_svg_view_create_linear_gradient (LsmSvgView *view,
void
lsm_svg_view_add_gradient_color_stop (LsmSvgView *view, double offset)
-/* , const LsmSvgColor *color, double opacity)*/
{
const LsmSvgStyle *style;
const LsmSvgColor *color;
@@ -157,7 +150,6 @@ lsm_svg_view_add_gradient_color_stop (LsmSvgView *view, double offset)
g_return_if_fail (LSM_IS_SVG_VIEW (view));
g_return_if_fail (view->pattern_data != NULL);
g_return_if_fail (view->pattern_data->pattern != NULL);
-/* g_return_if_fail (color != NULL);*/
if (offset > 1.0)
offset = 1.0;
@@ -169,8 +161,6 @@ lsm_svg_view_add_gradient_color_stop (LsmSvgView *view, double offset)
style = view->style;
-/* cairo_pattern_add_color_stop_rgba (view->pattern_data->pattern, offset,*/
-/* color->red, color->green, color->blue, opacity);*/
lsm_debug ("[LsmSvgView::add_gradient_color_stop] opacity = %g", style->stop_opacity->value);
color = &style->stop_color->value;
@@ -183,7 +173,6 @@ lsm_svg_view_add_gradient_color_stop (LsmSvgView *view, double offset)
color->green,
color->blue,
style->stop_opacity->value);
-/* color->red, color->green, color->blue, opacity);*/
}
void
@@ -230,13 +219,6 @@ lsm_svg_view_create_surface_pattern (LsmSvgView *view,
width = viewport->width;
height = viewport->height;
-/* if (units == LSM_SVG_PATTERN_UNITS_OBJECT_BOUNDING_BOX) {*/
-/* x *= view->pattern_data->extents.width;*/
-/* y *= view->pattern_data->extents.height;*/
-/* width *= view->pattern_data->extents.width;*/
-/* height *= view->pattern_data->extents.height;*/
-/* }*/
-
lsm_debug ("[LsmSvgView::create_pattern] pattern size = %g ,%g at %g, %g",
width, height, x, y);
@@ -819,18 +801,12 @@ _set_color (LsmSvgView *view, LsmSvgViewPaintOperation operation,
static void
paint (LsmSvgView *view)
{
-/* LsmSvgFillAttributeBag *fill;*/
-/* LsmSvgStrokeAttributeBag *stroke;*/
LsmSvgElement *element;
const LsmSvgStyle *style;
cairo_t *cairo;
gboolean use_group;
double group_opacity;
-/* g_return_if_fail (view->fill_stack != NULL);*/
-/* g_return_if_fail (view->stroke_stack != NULL);*/
-/* g_return_if_fail (view->element_stack != NULL);*/
-
element = view->element_stack->data;
g_return_if_fail (LSM_IS_SVG_ELEMENT (element));
@@ -838,20 +814,9 @@ paint (LsmSvgView *view)
cairo = view->dom_view.cairo;
style = view->style;
-/* fill = view->fill_stack->data;*/
-/* stroke = view->stroke_stack->data;*/
-
-/* if (view->mask_stack != NULL && view->mask_stack->data == element->mask) {*/
if (style->opacity != NULL) {
-/* LsmSvgMaskAttributeBag *mask;*/
-
-/* mask = view->mask_stack->data;*/
-/* group_opacity = mask->opacity.value;*/
group_opacity = style->opacity->value;
-/* use_group = fill->paint.paint.type != LSM_SVG_PAINT_TYPE_NONE &&*/
-/* stroke->paint.paint.type != LSM_SVG_PAINT_TYPE_NONE &&*/
-/* group_opacity < 1.0;*/
use_group = style->fill->paint.type != LSM_SVG_PAINT_TYPE_NONE &&
style->stroke->paint.type != LSM_SVG_PAINT_TYPE_NONE &&
group_opacity < 1.0;
@@ -908,8 +873,6 @@ paint (LsmSvgView *view)
cairo_set_line_width (cairo, line_width);
if (style->stroke_dash_array->value.n_dashes > 0) {
-/* != NULL &&*/
-/* stroke->dash_array.value->n_dashes > 0) {*/
double dash_offset;
double *dashes;
unsigned int i;
@@ -944,10 +907,6 @@ process_path (LsmSvgView *view)
g_return_if_fail (view->style != NULL);
if (view->is_clipping) {
-/* LsmSvgMaskAttributeBag *mask;*/
-
-/* mask = view->mask_stack->data;*/
-/* cairo_set_fill_rule (view->dom_view.cairo, mask->clip_rule.value);*/
cairo_set_fill_rule (view->dom_view.cairo, view->style->clip_rule->value);
} else
paint (view);
@@ -1106,7 +1065,6 @@ lsm_svg_view_show_text (LsmSvgView *view, char const *string, double x, double y
PangoFontDescription *font_description;
PangoLayoutIter *iter;
PangoRectangle ink_rect;
-/* LsmSvgTextAttributeBag *text;*/
double font_size;
int baseline;
@@ -1116,8 +1074,6 @@ lsm_svg_view_show_text (LsmSvgView *view, char const *string, double x, double y
g_return_if_fail (LSM_IS_SVG_VIEW (view));
style = view->style;
-/* text = view->text_stack->data;*/
-/* g_return_if_fail (text != NULL);*/
pango_layout = view->dom_view.pango_layout;
font_description = view->dom_view.font_description;
@@ -1402,165 +1358,89 @@ static void
lsm_svg_view_push_mask (LsmSvgView *view)
{
g_return_if_fail (LSM_IS_SVG_VIEW (view));
-/* g_return_if_fail (mask != NULL);*/
-
-/* view->mask_stack = g_slist_prepend (view->mask_stack, (void *) mask);*/
-/* if (mask->clip_path.value != NULL)*/
-/* lsm_svg_view_push_clip (view, mask->clip_path.value, mask->clip_rule.value);*/
-
-/* if (mask->mask.value != NULL)*/
- cairo_push_group (view->dom_view.cairo);
+ cairo_push_group (view->dom_view.cairo);
}
static void
lsm_svg_view_pop_mask (LsmSvgView *view)
{
-/* LsmSvgMaskAttributeBag *mask;*/
-
g_return_if_fail (LSM_IS_SVG_VIEW (view));
-/* g_return_if_fail (view->mask_stack != NULL);*/
-
-/* mask = view->mask_stack->data;*/
-/* if (mask->clip_path.value != NULL)*/
-/* lsm_svg_view_pop_clip (view);*/
-
-/* if (mask->mask.value != NULL) {*/
- if (strncmp (view->style->mask->value, "url(#", 5) == 0) {
- LsmDomElement *mask_element;
- char *end;
- char *uri;
+ if (strncmp (view->style->mask->value, "url(#", 5) == 0) {
+ LsmDomElement *mask_element;
+ char *end;
+ char *uri;
- uri = g_strdup (view->style->mask->value + 5);
- for (end = uri; *end != '\0' && *end != ')'; end++);
- *end = '\0';
+ uri = g_strdup (view->style->mask->value + 5);
+ for (end = uri; *end != '\0' && *end != ')'; end++);
+ *end = '\0';
- mask_element = lsm_dom_document_get_element_by_id (view->dom_view.document, uri);
+ mask_element = lsm_dom_document_get_element_by_id (view->dom_view.document, uri);
- if (LSM_IS_SVG_MASK_ELEMENT (mask_element)) {
- LsmExtents extents;
- LsmBox mask_extents;
- cairo_t *cairo;
+ if (LSM_IS_SVG_MASK_ELEMENT (mask_element)) {
+ LsmExtents extents;
+ LsmBox mask_extents;
+ cairo_t *cairo;
- lsm_svg_element_get_extents (view->element_stack->data, view, &extents);
+ lsm_svg_element_get_extents (view->element_stack->data, view, &extents);
- mask_extents.x = extents.x1;
- mask_extents.y = extents.y1;
- mask_extents.width = extents.x2 - extents.x1;
- mask_extents.height = extents.y2 - extents.y1;
+ mask_extents.x = extents.x1;
+ mask_extents.y = extents.y1;
+ mask_extents.width = extents.x2 - extents.x1;
+ mask_extents.height = extents.y2 - extents.y1;
- cairo = view->dom_view.cairo;
+ cairo = view->dom_view.cairo;
- _start_pattern (view, &mask_extents);
+ _start_pattern (view, &mask_extents);
- lsm_svg_element_force_render (LSM_SVG_ELEMENT (mask_element), view);
+ lsm_svg_element_force_render (LSM_SVG_ELEMENT (mask_element), view);
- cairo_pop_group_to_source (cairo);
- if (view->pattern_data->pattern != NULL) {
- cairo_surface_t *surface;
- int width, height, row, i, stride;
- unsigned char *pixels;
+ cairo_pop_group_to_source (cairo);
+ if (view->pattern_data->pattern != NULL) {
+ cairo_surface_t *surface;
+ int width, height, row, i, stride;
+ unsigned char *pixels;
- cairo_pattern_get_surface (view->pattern_data->pattern, &surface);
- pixels = cairo_image_surface_get_data (surface);
- height = cairo_image_surface_get_height (surface);
- width = cairo_image_surface_get_width (surface);
- stride = cairo_image_surface_get_stride (surface);
+ cairo_pattern_get_surface (view->pattern_data->pattern, &surface);
+ pixels = cairo_image_surface_get_data (surface);
+ height = cairo_image_surface_get_height (surface);
+ width = cairo_image_surface_get_width (surface);
+ stride = cairo_image_surface_get_stride (surface);
- for (row = 0; row < height; row++) {
- guint8 *row_data = (pixels + (row * stride));
- for (i = 0; i < width; i++) {
- guint32 *pixel = (guint32 *) row_data + i;
- *pixel = ((((*pixel & 0x00ff0000) >> 16) * 13817 +
- ((*pixel & 0x0000ff00) >> 8) * 46518 +
- ((*pixel & 0x000000ff)) * 4688) * 0xff
- /* * opacity */);
- }
+ for (row = 0; row < height; row++) {
+ guint8 *row_data = (pixels + (row * stride));
+ for (i = 0; i < width; i++) {
+ guint32 *pixel = (guint32 *) row_data + i;
+ *pixel = ((((*pixel & 0x00ff0000) >> 16) * 13817 +
+ ((*pixel & 0x0000ff00) >> 8) * 46518 +
+ ((*pixel & 0x000000ff)) * 4688) * 0xff
+ /* * opacity */);
}
+ }
- cairo_pattern_set_matrix (view->pattern_data->pattern,
- &view->pattern_data->matrix);
- cairo_pattern_set_extend (view->pattern_data->pattern, CAIRO_EXTEND_NONE);
+ cairo_pattern_set_matrix (view->pattern_data->pattern,
+ &view->pattern_data->matrix);
+ cairo_pattern_set_extend (view->pattern_data->pattern, CAIRO_EXTEND_NONE);
#if 0
- cairo_surface_write_to_png (surface, "mask.png");
+ cairo_surface_write_to_png (surface, "mask.png");
#endif
- cairo_mask (cairo, view->pattern_data->pattern);
- } else {
- cairo_paint (cairo);
- }
-
- _end_pattern (view);
+ cairo_mask (cairo, view->pattern_data->pattern);
} else {
- cairo_pop_group_to_source (view->dom_view.cairo);
- cairo_paint (view->dom_view.cairo);
+ cairo_paint (cairo);
}
+
+ _end_pattern (view);
} else {
cairo_pop_group_to_source (view->dom_view.cairo);
cairo_paint (view->dom_view.cairo);
}
-/* }*/
-
-/* view->mask_stack = g_slist_delete_link (view->mask_stack, view->mask_stack);*/
-}
-
-#if 0
-void
-lsm_svg_view_push_fill_attributes (LsmSvgView *view, const LsmSvgFillAttributeBag *fill)
-{
- g_return_if_fail (LSM_IS_SVG_VIEW (view));
- g_return_if_fail (fill != NULL);
-
- view->fill_stack = g_slist_prepend (view->fill_stack, (void *) fill);
-}
-
-void
-lsm_svg_view_pop_fill_attributes (LsmSvgView *view)
-{
- g_return_if_fail (LSM_IS_SVG_VIEW (view));
- g_return_if_fail (view->fill_stack != NULL);
-
- view->fill_stack = g_slist_delete_link (view->fill_stack, view->fill_stack);
-}
-
-void
-lsm_svg_view_push_stroke_attributes (LsmSvgView *view, const LsmSvgStrokeAttributeBag *stroke)
-{
- g_return_if_fail (LSM_IS_SVG_VIEW (view));
- g_return_if_fail (stroke != NULL);
-
- view->stroke_stack = g_slist_prepend (view->stroke_stack, (void *) stroke);
-}
-
-void
-lsm_svg_view_pop_stroke_attributes (LsmSvgView *view)
-{
- g_return_if_fail (LSM_IS_SVG_VIEW (view));
- g_return_if_fail (view->stroke_stack != NULL);
-
- view->stroke_stack = g_slist_delete_link (view->stroke_stack, view->stroke_stack);
-}
-
-void
-lsm_svg_view_push_text_attributes (LsmSvgView *view, const LsmSvgTextAttributeBag *text)
-{
- g_return_if_fail (LSM_IS_SVG_VIEW (view));
- g_return_if_fail (text != NULL);
-
- view->text_stack = g_slist_prepend (view->text_stack, (void *) text);
-}
-
-void
-lsm_svg_view_pop_text_attributes (LsmSvgView *view)
-{
- g_return_if_fail (LSM_IS_SVG_VIEW (view));
- g_return_if_fail (view->text_stack != NULL);
-
- view->text_stack = g_slist_delete_link (view->text_stack, view->text_stack);
+ } else {
+ cairo_pop_group_to_source (view->dom_view.cairo);
+ cairo_paint (view->dom_view.cairo);
+ }
}
-#endif
-
void
lsm_svg_view_push_element (LsmSvgView *view, const LsmSvgElement *element)
{
@@ -1653,8 +1533,6 @@ lsm_svg_view_measure (LsmDomView *view, double *width, double *height)
if (svg_element == NULL)
return;
-/* lsm_svg_svg_element_update (svg_element);*/
-
lsm_svg_svg_element_measure (svg_element, width, height);
}
@@ -1670,15 +1548,9 @@ lsm_svg_view_render (LsmDomView *view)
if (svg_element == NULL)
return;
-/* lsm_svg_svg_element_update (svg_element);*/
-
svg_view->style_stack = NULL;
svg_view->element_stack = NULL;
svg_view->viewbox_stack = NULL;
-/* svg_view->mask_stack = NULL;*/
-/* svg_view->fill_stack = NULL;*/
-/* svg_view->stroke_stack = NULL;*/
-/* svg_view->text_stack = NULL;*/
svg_view->matrix_stack = NULL;
svg_view->is_clipping = FALSE;
@@ -1700,26 +1572,6 @@ lsm_svg_view_render (LsmDomView *view)
g_slist_free (svg_view->viewbox_stack);
svg_view->viewbox_stack = NULL;
}
-/* if (svg_view->fill_stack != NULL) {*/
-/* g_warning ("[LsmSvgView::render] Dangling fill attributes in stack");*/
-/* g_slist_free (svg_view->fill_stack);*/
-/* svg_view->fill_stack = NULL;*/
-/* }*/
-/* if (svg_view->stroke_stack != NULL) {*/
-/* g_warning ("[LsmSvgView::render] Dangling stroke attributes in stack");*/
-/* g_slist_free (svg_view->stroke_stack);*/
-/* svg_view->stroke_stack = NULL;*/
-/* }*/
-/* if (svg_view->mask_stack != NULL) {*/
-/* g_warning ("[LsmSvgView::render] Dangling mask attributes in stack");*/
-/* g_slist_free (svg_view->mask_stack);*/
-/* svg_view->mask_stack = NULL;*/
-/* }*/
-/* if (svg_view->text_stack != NULL) {*/
-/* g_warning ("[LsmSvgView::render] Dangling text attribute in stack");*/
-/* g_slist_free (svg_view->text_stack);*/
-/* svg_view->text_stack = NULL;*/
-/* }*/
if (svg_view->element_stack != NULL) {
g_warning ("[LsmSvgView::render] Dangling element in stack");
g_slist_free (svg_view->element_stack);
diff --git a/src/lsmsvgview.h b/src/lsmsvgview.h
index 7294907..b960b05 100644
--- a/src/lsmsvgview.h
+++ b/src/lsmsvgview.h
@@ -56,10 +56,6 @@ struct _LsmSvgView {
GSList *style_stack;
GSList *element_stack;
GSList *viewbox_stack;
-// GSList *mask_stack;
-// GSList *fill_stack;
-// GSList *stroke_stack;
-// GSList *text_stack;
GSList *matrix_stack;
LsmSvgViewPatternData *pattern_data;
@@ -91,8 +87,6 @@ void lsm_svg_view_create_radial_gradient (LsmSvgView *view, double cx, double
void lsm_svg_view_create_linear_gradient (LsmSvgView *view, double x1, double y1,
double x2, double y2);
void lsm_svg_view_add_gradient_color_stop (LsmSvgView *view, double offset);
-//,
-// const LsmSvgColor *color, double opacity);
void lsm_svg_view_set_gradient_properties (LsmSvgView *view,
LsmSvgSpreadMethod method,
LsmSvgPatternUnits units,
@@ -128,23 +122,14 @@ void lsm_svg_view_pop_matrix (LsmSvgView *view);
void lsm_svg_view_push_element (LsmSvgView *view, const LsmSvgElement *element);
void lsm_svg_view_pop_element (LsmSvgView *view);
+void lsm_svg_view_push_group_opacity (LsmSvgView *view);
+void lsm_svg_view_pop_group_opacity (LsmSvgView *view);
+
void lsm_svg_view_push_style (LsmSvgView *view, const LsmSvgStyle *style);
void lsm_svg_view_pop_style (LsmSvgView *view);
const LsmSvgStyle * lsm_svg_view_get_current_style (LsmSvgView *view);
-void lsm_svg_view_push_group_opacity (LsmSvgView *view);
-void lsm_svg_view_pop_group_opacity (LsmSvgView *view);
-
-//void lsm_svg_view_push_mask_attributes (LsmSvgView *view, const LsmSvgMaskAttributeBag *mask);
-//void lsm_svg_view_pop_mask_attributes (LsmSvgView *view);
-//void lsm_svg_view_push_fill_attributes (LsmSvgView *view, const LsmSvgFillAttributeBag *fill);
-//void lsm_svg_view_pop_fill_attributes (LsmSvgView *view);
-//void lsm_svg_view_push_stroke_attributes (LsmSvgView *view, const LsmSvgStrokeAttributeBag *stroke);
-//void lsm_svg_view_pop_stroke_attributes (LsmSvgView *view);
-//void lsm_svg_view_push_text_attributes (LsmSvgView *view, const LsmSvgTextAttributeBag *text);
-//void lsm_svg_view_pop_text_attributes (LsmSvgView *view);
-
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]