295
/* extra (title, desc, metadata) */
298
rsvg_extra_handler_free (RsvgSaxHandler * self)
300
RsvgSaxHandlerExtra *z = (RsvgSaxHandlerExtra *) self;
304
g_string_free (*z->stringptr, TRUE);
305
*z->stringptr = z->string;
306
} else if (z->string) {
307
g_string_free (z->string, TRUE);
314
rsvg_extra_handler_characters (RsvgSaxHandler * self, const char *ch, int len)
316
RsvgSaxHandlerExtra *z = (RsvgSaxHandlerExtra *) self;
317
RsvgHandle *ctx = z->ctx;
319
/* This isn't quite the correct behavior - in theory, any graphics
320
element may contain a title, desc, or metadata element */
328
if (!g_utf8_validate ((char *) ch, len, NULL)) {
330
utf8 = rsvg_make_valid_utf8 ((char *) ch, len);
331
g_string_append (z->string, utf8);
334
g_string_append_len (z->string, (char *) ch, len);
339
rsvg_extra_handler_start (RsvgSaxHandler * self, const char *name, RsvgPropertyBag * atts)
344
rsvg_extra_handler_end (RsvgSaxHandler * self, const char *name)
346
RsvgSaxHandlerExtra *z = (RsvgSaxHandlerExtra *) self;
347
RsvgHandle *ctx = z->ctx;
349
if (!strcmp (name, z->name)) {
350
if (ctx->priv->handler != NULL) {
351
ctx->priv->handler->free (ctx->priv->handler);
352
ctx->priv->handler = NULL;
357
static RsvgSaxHandlerExtra *
358
rsvg_start_extra (RsvgHandle * ctx,
362
RsvgSaxHandlerExtra *handler = g_new0 (RsvgSaxHandlerExtra, 1);
363
RsvgNode *treebase = ctx->priv->treebase;
364
RsvgNode *currentnode = ctx->priv->currentnode;
367
/* only parse <extra> for the <svg> node.
368
* This isn't quite the correct behavior - any graphics
369
* element may contain a <extra> element.
371
do_care = treebase != NULL && treebase == currentnode;
373
handler->super.free = rsvg_extra_handler_free;
374
handler->super.characters = rsvg_extra_handler_characters;
375
handler->super.start_element = rsvg_extra_handler_start;
376
handler->super.end_element = rsvg_extra_handler_end;
378
handler->name = name; /* interned */
379
handler->string = do_care ? g_string_new (NULL) : NULL;
380
handler->stringptr = do_care ? stringptr : NULL;
382
ctx->priv->handler = &handler->super;
286
rsvg_desc_handler_free (RsvgSaxHandler * self)
292
rsvg_desc_handler_characters (RsvgSaxHandler * self, const char *ch, int len)
294
RsvgSaxHandlerDesc *z = (RsvgSaxHandlerDesc *) self;
295
RsvgHandle *ctx = z->ctx;
297
/* This isn't quite the correct behavior - in theory, any graphics
298
element may contain a title or desc element */
303
if (!g_utf8_validate ((char *) ch, len, NULL)) {
305
utf8 = rsvg_make_valid_utf8 ((char *) ch, len);
306
g_string_append (ctx->priv->desc, utf8);
309
g_string_append_len (ctx->priv->desc, (char *) ch, len);
314
rsvg_desc_handler_start (RsvgSaxHandler * self, const char *name, RsvgPropertyBag * atts)
319
rsvg_desc_handler_end (RsvgSaxHandler * self, const char *name)
321
RsvgSaxHandlerDesc *z = (RsvgSaxHandlerDesc *) self;
322
RsvgHandle *ctx = z->ctx;
324
if (!strcmp (name, "desc")) {
325
if (ctx->priv->handler != NULL) {
326
ctx->priv->handler->free (ctx->priv->handler);
327
ctx->priv->handler = NULL;
333
rsvg_start_desc (RsvgHandle * ctx, RsvgPropertyBag * atts)
335
RsvgSaxHandlerDesc *handler = g_new0 (RsvgSaxHandlerDesc, 1);
337
handler->super.free = rsvg_desc_handler_free;
338
handler->super.characters = rsvg_desc_handler_characters;
339
handler->super.start_element = rsvg_desc_handler_start;
340
handler->super.end_element = rsvg_desc_handler_end;
343
ctx->priv->desc = g_string_new (NULL);
344
ctx->priv->handler = &handler->super;
390
rsvg_start_desc (RsvgHandle * ctx)
392
rsvg_start_extra (ctx, "desc", &ctx->priv->desc);
349
397
/* start title */
352
rsvg_title_handler_free (RsvgSaxHandler * self)
358
rsvg_title_handler_characters (RsvgSaxHandler * self, const char *ch, int len)
360
RsvgSaxHandlerTitle *z = (RsvgSaxHandlerTitle *) self;
361
RsvgHandle *ctx = z->ctx;
363
/* This isn't quite the correct behavior - in theory, any graphics
364
element may contain a title or desc element */
369
if (!g_utf8_validate ((char *) ch, len, NULL)) {
371
utf8 = rsvg_make_valid_utf8 ((char *) ch, len);
372
g_string_append (ctx->priv->title, utf8);
375
g_string_append_len (ctx->priv->title, (char *) ch, len);
380
rsvg_title_handler_start (RsvgSaxHandler * self, const char *name, RsvgPropertyBag * atts)
385
rsvg_title_handler_end (RsvgSaxHandler * self, const char *name)
387
RsvgSaxHandlerTitle *z = (RsvgSaxHandlerTitle *) self;
388
RsvgHandle *ctx = z->ctx;
390
if (!strcmp (name, "title")) {
391
if (ctx->priv->handler != NULL) {
392
ctx->priv->handler->free (ctx->priv->handler);
393
ctx->priv->handler = NULL;
399
rsvg_start_title (RsvgHandle * ctx, RsvgPropertyBag * atts)
401
RsvgSaxHandlerTitle *handler = g_new0 (RsvgSaxHandlerTitle, 1);
403
handler->super.free = rsvg_title_handler_free;
404
handler->super.characters = rsvg_title_handler_characters;
405
handler->super.start_element = rsvg_title_handler_start;
406
handler->super.end_element = rsvg_title_handler_end;
409
ctx->priv->title = g_string_new (NULL);
410
ctx->priv->handler = &handler->super;
400
rsvg_start_title (RsvgHandle * ctx)
402
rsvg_start_extra (ctx, "title", &ctx->priv->title);
415
407
/* start metadata */
418
rsvg_metadata_handler_free (RsvgSaxHandler * self)
424
rsvg_metadata_handler_characters (RsvgSaxHandler * self, const char *ch, int len)
426
RsvgSaxHandlerDesc *z = (RsvgSaxHandlerDesc *) self;
427
RsvgHandle *ctx = z->ctx;
429
/* This isn't quite the correct behavior - in theory, any graphics
430
element may contain a metadata or desc element */
435
if (!g_utf8_validate ((char *) ch, len, NULL)) {
437
utf8 = rsvg_make_valid_utf8 ((char *) ch, len);
438
g_string_append (ctx->priv->metadata, utf8);
441
g_string_append_len (ctx->priv->metadata, (char *) ch, len);
446
410
rsvg_metadata_props_enumerate (const char *key, const char *value, gpointer user_data)
448
412
GString *metadata = (GString *) user_data;
455
419
RsvgSaxHandlerMetadata *z = (RsvgSaxHandlerMetadata *) self;
456
420
RsvgHandle *ctx = z->ctx;
458
g_string_append_printf (ctx->priv->metadata, "<%s ", name);
459
rsvg_property_bag_enumerate (atts, rsvg_metadata_props_enumerate, ctx->priv->metadata);
460
g_string_append (ctx->priv->metadata, ">\n");
422
rsvg_extra_handler_start (self, name, atts);
427
g_string_append_printf (z->string, "<%s ", name);
428
rsvg_property_bag_enumerate (atts, rsvg_metadata_props_enumerate, z->string);
429
g_string_append (z->string, ">\n");
466
435
RsvgSaxHandlerMetadata *z = (RsvgSaxHandlerMetadata *) self;
467
436
RsvgHandle *ctx = z->ctx;
469
if (!strcmp (name, "metadata")) {
470
if (ctx->priv->handler != NULL) {
471
ctx->priv->handler->free (ctx->priv->handler);
472
ctx->priv->handler = NULL;
475
g_string_append_printf (ctx->priv->metadata, "</%s>\n", name);
438
if (strcmp (name, z->name) != 0) {
440
g_string_append_printf (z->string, "</%s>\n", name);
442
rsvg_extra_handler_end (self, name);
479
rsvg_start_metadata (RsvgHandle * ctx, RsvgPropertyBag * atts)
447
rsvg_start_metadata (RsvgHandle * ctx)
481
RsvgSaxHandlerMetadata *handler = g_new0 (RsvgSaxHandlerMetadata, 1);
449
RsvgSaxHandlerMetadata *handler = rsvg_start_extra (ctx, "metadata", &ctx->priv->metadata);
483
handler->super.free = rsvg_metadata_handler_free;
484
handler->super.characters = rsvg_metadata_handler_characters;
485
451
handler->super.start_element = rsvg_metadata_handler_start;
486
452
handler->super.end_element = rsvg_metadata_handler_end;
489
ctx->priv->metadata = g_string_new (NULL);
490
ctx->priv->handler = &handler->super;
493
455
/* end metadata */
566
528
rsvg_start_xinclude (RsvgHandle * ctx, RsvgPropertyBag * atts)
568
530
RsvgSaxHandlerXinclude *handler;
531
const char *href, *parse;
571
532
gboolean success = FALSE;
573
534
href = rsvg_property_bag_lookup (atts, "href");
575
data = _rsvg_acquire_xlink_href_resource (href, rsvg_handle_get_base_uri (ctx), NULL);
579
parse = rsvg_property_bag_lookup (atts, "parse");
580
if (parse && !strcmp (parse, "text")) {
581
const char *encoding;
584
gboolean text_data_needs_free = FALSE;
586
encoding = rsvg_property_bag_lookup (atts, "encoding");
589
g_convert ((const char *) data->data, data->len, "utf-8", encoding, NULL,
538
parse = rsvg_property_bag_lookup (atts, "parse");
539
if (parse && !strcmp (parse, "text")) {
542
const char *encoding;
544
data = _rsvg_handle_acquire_data (ctx, href, NULL, &data_len, NULL);
548
encoding = rsvg_property_bag_lookup (atts, "encoding");
549
if (encoding && g_ascii_strcasecmp (encoding, "UTF-8") != 0) {
553
text_data = g_convert (data, data_len, "utf-8", encoding, NULL,
590
554
&text_data_len, NULL);
591
text_data_needs_free = TRUE;
593
text_data = (char *) data->data;
594
text_data_len = data->len;
597
rsvg_characters_impl (ctx, (const xmlChar *) text_data, text_data_len);
599
if (text_data_needs_free)
604
xmlParserCtxtPtr xml_parser;
607
xml_parser = xmlCreatePushParserCtxt (&rsvgSAXHandlerStruct, ctx, NULL, 0, NULL);
608
result = xmlParseChunk (xml_parser, (char *) data->data, data->len, 0);
609
result = xmlParseChunk (xml_parser, "", 0, TRUE);
611
xml_doc = xml_parser->myDoc;
612
xmlFreeParserCtxt (xml_parser);
613
xmlFreeDoc (xml_doc);
616
g_byte_array_free (data, TRUE);
558
data_len = text_data_len;
561
rsvg_characters_impl (ctx, (const xmlChar *) data, data_len);
566
GInputStream *stream;
569
xmlParserCtxtPtr xml_parser;
570
xmlParserInputBufferPtr buffer;
571
xmlParserInputPtr input;
574
stream = _rsvg_handle_acquire_stream (ctx, href, NULL, NULL);
578
xml_parser = xmlCreatePushParserCtxt (&rsvgSAXHandlerStruct, ctx, NULL, 0, NULL);
580
buffer = _rsvg_xml_input_buffer_new_from_stream (stream, NULL /* cancellable */, XML_CHAR_ENCODING_NONE, &err);
581
g_object_unref (stream);
583
input = xmlNewIOInputStream (xml_parser, buffer /* adopts */, XML_CHAR_ENCODING_NONE);
585
if (xmlPushInput (xml_parser, input) < 0) {
586
g_clear_error (&err);
587
xmlFreeInputStream (input);
588
xmlFreeParserCtxt (xml_parser);
592
(void) xmlParseDocument (xml_parser);
594
xml_doc = xml_parser->myDoc;
595
xmlFreeParserCtxt (xml_parser);
597
xmlFreeDoc (xml_doc);
599
g_clear_error (&err);
621
606
/* needed to handle xi:fallback */
622
607
handler = g_new0 (RsvgSaxHandlerXinclude, 1);
655
640
if (!strcmp ((const char *) name, "style"))
656
641
rsvg_start_style (ctx, bag);
657
642
else if (!strcmp ((const char *) name, "title"))
658
rsvg_start_title (ctx, bag);
643
rsvg_start_title (ctx);
659
644
else if (!strcmp ((const char *) name, "desc"))
660
rsvg_start_desc (ctx, bag);
645
rsvg_start_desc (ctx);
661
646
else if (!strcmp ((const char *) name, "metadata"))
662
rsvg_start_metadata (ctx, bag);
647
rsvg_start_metadata (ctx);
663
648
else if (!strcmp ((const char *) name, "include")) /* xi:include */
664
649
rsvg_start_xinclude (ctx, bag);
825
804
resolvedPublicId = xmlBuildRelativeURI (publicId, (xmlChar*) rsvg_handle_get_base_uri (ctx));
827
806
if (type == XML_EXTERNAL_PARAMETER_ENTITY && !content) {
828
GByteArray *arr = NULL;
831
arr = _rsvg_acquire_xlink_href_resource ((const char *) systemId,
832
rsvg_handle_get_base_uri (ctx), NULL);
834
arr = _rsvg_acquire_xlink_href_resource ((const char *) publicId,
835
rsvg_handle_get_base_uri (ctx), NULL);
837
content = xmlCharStrndup ((const char*)arr->data, arr->len);
838
g_byte_array_free(arr, TRUE);
808
gsize entity_data_len;
811
entity_data = _rsvg_handle_acquire_data (ctx,
812
(const char *) systemId,
817
entity_data = _rsvg_handle_acquire_data (ctx,
818
(const char *) publicId,
826
content = xmlCharStrndup (entity_data, entity_data_len);
827
g_free (entity_data);
842
831
entity = xmlNewEntity(NULL, name, type, resolvedPublicId, resolvedSystemId, content);
844
833
xmlFree(resolvedPublicId);
845
834
xmlFree(resolvedSystemId);
847
836
g_hash_table_insert (entities, g_strdup ((const char*) name), entity);
851
entity = xmlMalloc (sizeof (xmlEntity));
852
memset (entity, 0, sizeof (xmlEntity));
853
entity->type = XML_ENTITY_DECL;
854
dupname = (xmlChar *) xmlMemStrdup ((const char *) name);
855
entity->name = dupname;
857
entity->etype = type;
859
entity->content = (xmlChar *) xmlMemStrdup ((const char *) content);
860
entity->length = strlen ((const char *) content);
861
} else if (systemId || publicId) {
862
GByteArray *data = NULL;
866
_rsvg_acquire_xlink_href_resource ((const char *) systemId,
867
rsvg_handle_get_base_uri (ctx), NULL);
870
_rsvg_acquire_xlink_href_resource ((const char *) publicId,
871
rsvg_handle_get_base_uri (ctx), NULL);
874
entity->SystemID = (xmlChar *) xmlMemStrdup ((const char *) systemId);
875
entity->ExternalID = (xmlChar *) xmlMemStrdup ((const char *) publicId);
876
entity->content = (xmlChar *) xmlMemStrdup ((const char *) data->data);
877
entity->length = data->len;
879
/* fool libxml2 into supporting SYSTEM and PUBLIC entities */
880
entity->etype = XML_INTERNAL_GENERAL_ENTITY;
882
g_byte_array_free (data, TRUE);
886
g_hash_table_insert (entities, dupname, entity);
934
881
xml_atts = rsvg_css_parse_xml_attribute_string ((const char *) data);
935
atts = rsvg_property_bag_new ((const char **) xml_atts);
938
884
const char *value;
886
atts = rsvg_property_bag_new ((const char **) xml_atts);
940
887
value = rsvg_property_bag_lookup (atts, "alternate");
941
if (!value || (strcmp (value, "no") != 0)) {
888
if (!value || !value[0] || (strcmp (value, "no") != 0)) {
942
889
value = rsvg_property_bag_lookup (atts, "type");
943
890
if (value && strcmp (value, "text/css") == 0) {
944
891
value = rsvg_property_bag_lookup (atts, "href");
892
if (value && value[0]) {
894
gsize style_data_len;
895
char *mime_type = NULL;
949
_rsvg_acquire_xlink_href_resource (value,
950
rsvg_handle_get_base_uri (handle),
953
rsvg_parse_cssbuffer (handle, (char *) style->data, style->len);
954
g_byte_array_free (style, TRUE);
897
style_data = _rsvg_handle_acquire_data (handle,
904
strcmp (mime_type, "text/css") == 0) {
905
rsvg_parse_cssbuffer (handle, (char *) style_data, style_data_len);
914
rsvg_property_bag_free (atts);
960
915
g_strfreev (xml_atts);
961
rsvg_property_bag_free (atts);
1433
1382
cairo_destroy (cr);
1434
1383
cairo_surface_destroy (target);
1436
dimension_data->width = bbox.w;
1437
dimension_data->height = bbox.h;
1385
dimension_data->width = bbox.rect.width;
1386
dimension_data->height = bbox.rect.height;
1439
bbox.w = root->vbox.w;
1440
bbox.h = root->vbox.h;
1388
bbox.rect.width = root->vbox.rect.width;
1389
bbox.rect.height = root->vbox.rect.height;
1442
1391
dimension_data->width = (int) (_rsvg_css_hand_normalize_length (&root->w, handle->priv->dpi_x,
1443
bbox.w + bbox.x * 2, 12) + 0.5);
1392
bbox.rect.width + bbox.rect.x * 2, 12) + 0.5);
1444
1393
dimension_data->height = (int) (_rsvg_css_hand_normalize_length (&root->h, handle->priv->dpi_y,
1445
bbox.h + bbox.y * 2,
1394
bbox.rect.height + bbox.rect.y * 2,
1523
1472
cairo_save (cr);
1525
1474
rsvg_node_draw ((RsvgNode *) handle->priv->treebase, draw, 0);
1526
bbox.x = ((RsvgCairoRender *) draw->render)->bbox.x;
1527
bbox.y = ((RsvgCairoRender *) draw->render)->bbox.y;
1528
bbox.w = ((RsvgCairoRender *) draw->render)->bbox.w;
1529
bbox.h = ((RsvgCairoRender *) draw->render)->bbox.h;
1475
bbox = RSVG_CAIRO_RENDER (draw->render)->bbox;
1531
1477
cairo_restore (cr);
1532
1478
rsvg_state_pop (draw);
1533
1479
rsvg_drawing_ctx_free (draw);
1535
position_data->x = bbox.x;
1536
position_data->y = bbox.y;
1537
dimension_data.width = bbox.w;
1538
dimension_data.height = bbox.h;
1481
position_data->x = bbox.rect.x;
1482
position_data->y = bbox.rect.y;
1483
dimension_data.width = bbox.rect.width;
1484
dimension_data.height = bbox.rect.height;
1540
1486
dimension_data.em = dimension_data.width;
1541
1487
dimension_data.ex = dimension_data.height;
1725
1671
/* test for GZ marker. todo: store the first 2 bytes in the odd circumstance that someone calls
1726
1672
* write() in 1 byte increments */
1727
1673
if ((count >= 2) && (buf[0] == (guchar) 0x1f) && (buf[1] == (guchar) 0x8b)) {
1728
#if GLIB_CHECK_VERSION (2, 24, 0)
1729
1674
priv->data_input_stream = g_memory_input_stream_new ();
1730
#elif defined (HAVE_GSF)
1731
priv->gzipped_data = GSF_OUTPUT (gsf_output_memory_new ());
1733
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
1734
"GZip compressed SVG not supported");
1740
#if GLIB_CHECK_VERSION (2, 24, 0)
1741
1678
if (priv->data_input_stream) {
1742
1679
g_memory_input_stream_add_data ((GMemoryInputStream *) priv->data_input_stream,
1743
1680
g_memdup (buf, count), count, (GDestroyNotify) g_free);
1746
#elif defined (HAVE_GSF)
1747
if (priv->gzipped_data)
1748
return gsf_output_write (handle->priv->gzipped_data, count, buf);
1751
1684
return rsvg_handle_write_impl (handle, buf, count, error);
1793
#elif defined(HAVE_GSF)
1794
if (priv->gzipped_data) {
1796
const guchar *bytes;
1800
bytes = gsf_output_memory_get_bytes (GSF_OUTPUT_MEMORY (priv->gzipped_data));
1801
size = gsf_output_size (priv->gzipped_data);
1804
GSF_INPUT (gsf_input_gzip_new
1805
(GSF_INPUT (gsf_input_memory_new (bytes, size, FALSE)), error));
1806
remaining = gsf_input_remaining (gzip);
1807
while ((size = MIN (remaining, 1024)) > 0) {
1810
/* write to parent */
1811
buf = gsf_input_read (gzip, size, NULL);
1813
/* an error occured, so bail */
1814
g_warning (_("rsvg_gz_handle_close_impl: gsf_input_read returned NULL"));
1818
rsvg_handle_write_impl (handle, buf, size, error);
1819
/* if we didn't manage to lower remaining number of bytes,
1820
* something is wrong, and we should avoid an endless loop */
1821
if (remaining == ((gsize) gsf_input_remaining (gzip))) {
1823
("rsvg_gz_handle_close_impl: write_impl didn't lower the input_remaining count"));
1826
remaining = gsf_input_remaining (gzip);
1828
g_object_unref (gzip);
1831
gsf_output_close (priv->gzipped_data);
1832
g_object_unref (priv->gzipped_data);
1833
priv->gzipped_data = NULL;
1835
#endif /* GIO >= 2.24.0 */
1837
1726
return rsvg_handle_close_impl (handle, error);
2073
rsvg_render_path (RsvgDrawingCtx * ctx, const char *d)
1972
rsvg_render_path (RsvgDrawingCtx * ctx, const cairo_path_t *path)
2075
/* todo: store and use the bpath higher up */
2076
RsvgBpathDef *bpath_def;
2078
bpath_def = rsvg_parse_path (d);
2079
rsvg_bpath_def_art_finish (bpath_def);
2081
ctx->render->render_path (ctx, bpath_def);
2082
rsvg_render_markers (bpath_def, ctx);
2084
rsvg_bpath_def_free (bpath_def);
1974
ctx->render->render_path (ctx, path);
1975
rsvg_render_markers (ctx, path);
2088
rsvg_render_image (RsvgDrawingCtx * ctx, GdkPixbuf * pb, double x, double y, double w, double h)
1979
rsvg_render_surface (RsvgDrawingCtx * ctx, cairo_surface_t *surface, double x, double y, double w, double h)
2090
ctx->render->render_image (ctx, pb, x, y, w, h);
1981
/* surface must be a cairo image surface */
1982
g_return_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE);
1984
ctx->render->render_surface (ctx, surface, x, y, w, h);
2131
2023
if (!dst->virgin) {
2132
xmin = dst->x, ymin = dst->y;
2133
xmax = dst->x + dst->w, ymax = dst->y + dst->h;
2024
xmin = dst->rect.x, ymin = dst->rect.y;
2025
xmax = dst->rect.x + dst->rect.width, ymax = dst->rect.y + dst->rect.height;
2135
2027
xmin = ymin = xmax = ymax = 0;
2138
_rsvg_affine_invert (affine, dst->affine);
2139
_rsvg_affine_multiply (affine, src->affine, affine);
2030
affine = dst->affine;
2031
if (cairo_matrix_invert (&affine) != CAIRO_STATUS_SUCCESS)
2032
return; //FIXMEchpe correct??
2034
cairo_matrix_multiply (&affine, &src->affine, &affine);
2141
2036
for (i = 0; i < 4; i++) {
2142
2037
double rx, ry, x, y;
2143
rx = src->x + src->w * (double) (i % 2);
2144
ry = src->y + src->h * (double) (i / 2);
2145
x = affine[0] * rx + affine[2] * ry + affine[4];
2146
y = affine[1] * rx + affine[3] * ry + affine[5];
2038
rx = src->rect.x + src->rect.width * (double) (i % 2);
2039
ry = src->rect.y + src->rect.height * (double) (i / 2);
2040
x = affine.xx * rx + affine.xy * ry + affine.x0;
2041
y = affine.yx * rx + affine.yy * ry + affine.y0;
2147
2042
if (dst->virgin) {
2148
2043
xmin = xmax = x;
2149
2044
ymin = ymax = y;
2179
2074
if (!dst->virgin) {
2180
xmin = dst->x + dst->w, ymin = dst->y + dst->h;
2181
xmax = dst->x, ymax = dst->y;
2075
xmin = dst->rect.x + dst->rect.width, ymin = dst->rect.y + dst->rect.height;
2076
xmax = dst->rect.x, ymax = dst->rect.y;
2183
2078
xmin = ymin = xmax = ymax = 0;
2186
_rsvg_affine_invert (affine, dst->affine);
2187
_rsvg_affine_multiply (affine, src->affine, affine);
2081
affine = dst->affine;
2082
if (cairo_matrix_invert (&affine) != CAIRO_STATUS_SUCCESS)
2085
cairo_matrix_multiply (&affine, &src->affine, &affine);
2189
2087
for (i = 0; i < 4; i++) {
2190
2088
double rx, ry, x, y;
2191
rx = src->x + src->w * (double) (i % 2);
2192
ry = src->y + src->h * (double) (i / 2);
2193
x = affine[0] * rx + affine[2] * ry + affine[4];
2194
y = affine[1] * rx + affine[3] * ry + affine[5];
2089
rx = src->rect.x + src->rect.width * (double) (i % 2);
2090
ry = src->rect.y + src->rect.height * (double) (i / 2);
2091
x = affine.xx * rx + affine.xy * ry + affine.x0;
2092
y = affine.yx * rx + affine.yy * ry + affine.y0;
2195
2093
if (dst->virgin) {
2196
2094
xmin = xmax = x;
2197
2095
ymin = ymax = y;
2247
2145
g_set_error (error, RSVG_ERROR, 0, _("%s: assertion `%s' failed"), pretty_function, expression);
2149
_rsvg_handle_allow_load (RsvgHandle *handle,
2153
RsvgLoadPolicy policy = handle->priv->load_policy;
2155
if (policy == RSVG_LOAD_POLICY_ALL_PERMISSIVE)
2162
_rsvg_handle_acquire_data (RsvgHandle *handle,
2164
char **content_type,
2168
if (!_rsvg_handle_allow_load (handle, uri, error))
2171
return _rsvg_io_acquire_data (uri,
2172
rsvg_handle_get_base_uri (handle),
2175
handle->priv->cancellable,
2180
_rsvg_handle_acquire_stream (RsvgHandle *handle,
2182
char **content_type,
2185
if (!_rsvg_handle_allow_load (handle, uri, error))
2188
return _rsvg_io_acquire_stream (uri,
2189
rsvg_handle_get_base_uri (handle),
2191
handle->priv->cancellable,