diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 93e7b4d65844370cdb47ddd407eebca0b8542212..ad9e79de2ba576a9fec46f9c2538ffdfa44cc722 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Edward Flick (EAF)
+ * Abhishek Sharma
*
* Copyright (C) 1999-2005 Authors
* Copyright (C) 2000-2001 Ximian, Inc.
@@ -460,18 +461,15 @@ static GdkPixbuf* pixbuf_new_from_file( const char *filename, time_t &modTime, g
youme.offset = 0;
youme.loader = loader;
- bool dropOut = false;
- while ( !feof(fp) && !dropOut )
+ while ( !feof(fp) )
{
if ( youme.readMore() ) {
if ( youme.first ) {
//g_message( "First data chunk" );
youme.first = FALSE;
- if (!readPngAndHeaders(youme, dpiX, dpiY))
+ if (readPngAndHeaders(youme, dpiX, dpiY))
{
- // We failed to read the PNG headers and info.
- // The GDK pixbuf loader may still get something.
- dropOut = true;
+ // TODO set the dpi to be read elsewhere
}
} else if ( !latter ) {
latter = TRUE;
(GInstanceInitFunc) sp_image_init,
NULL, /* value_table */
};
- image_type = g_type_register_static (sp_item_get_type (), "SPImage", &image_info, (GTypeFlags)0);
+ image_type = g_type_register_static (SPItem::getType (), "SPImage", &image_info, (GTypeFlags)0);
}
return image_type;
}
sp_object_class = (SPObjectClass *) klass;
item_class = (SPItemClass *) klass;
- parent_class = (SPItemClass*)g_type_class_ref (sp_item_get_type ());
+ parent_class = (SPItemClass*)g_type_class_ref (SPItem::getType ());
sp_object_class->build = sp_image_build;
sp_object_class->release = sp_image_release;
@@ -640,16 +638,16 @@ sp_image_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *rep
((SPObjectClass *) parent_class)->build (object, document, repr);
}
- sp_object_read_attr (object, "xlink:href");
- sp_object_read_attr (object, "x");
- sp_object_read_attr (object, "y");
- sp_object_read_attr (object, "width");
- sp_object_read_attr (object, "height");
- sp_object_read_attr (object, "preserveAspectRatio");
- sp_object_read_attr (object, "color-profile");
+ object->readAttr( "xlink:href" );
+ object->readAttr( "x" );
+ object->readAttr( "y" );
+ object->readAttr( "width" );
+ object->readAttr( "height" );
+ object->readAttr( "preserveAspectRatio" );
+ object->readAttr( "color-profile" );
/* Register */
- sp_document_add_resource (document, "image", object);
+ document->addResource("image", object);
}
static void
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "image", SP_OBJECT (object));
+ SP_OBJECT_DOCUMENT(object)->removeResource("image", SP_OBJECT(object));
}
if (image->href) {
pixbuf = sp_image_repr_read_image (
image->lastMod,
image->pixPath,
- object->repr->attribute("xlink:href"),
- object->repr->attribute("sodipodi:absref"),
- doc->base);
+
+ //XML Tree being used directly while it shouldn't be.
+ object->getRepr()->attribute("xlink:href"),
+
+ //XML Tree being used directly while it shouldn't be.
+ object->getRepr()->attribute("sodipodi:absref"),
+ doc->getBase());
if (pixbuf) {
pixbuf = sp_image_pixbuf_force_rgba (pixbuf);
// BLIP
@@ -1059,7 +1061,9 @@ sp_image_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM
if (image->height._set) {
sp_repr_set_svg_double(repr, "height", image->height.computed);
}
- repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio"));
+
+ //XML Tree being used directly here while it shouldn't be...
+ repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio"));
#if ENABLE_LCMS
if (image->color_profile) {
repr->setAttribute("color-profile", image->color_profile);
@@ -1355,7 +1359,7 @@ static void sp_image_snappoints(SPItem const *item, std::vector<Inkscape::SnapCa
double const y0 = image.y.computed;
double const x1 = x0 + image.width.computed;
double const y1 = y0 + image.height.computed;
- Geom::Matrix const i2d (sp_item_i2d_affine (item));
+ Geom::Matrix const i2d (item->i2d_affine ());
p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y0) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x1, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
NRRect rect;
sp_image_bbox(image, &rect, Geom::identity(), 0);
Geom::Rect rect2 = to_2geom(*rect.upgrade());
- SPCurve *c = SPCurve::new_from_rect(rect2);
+ SPCurve *c = SPCurve::new_from_rect(rect2, true);
if (image->curve) {
image->curve = image->curve->unref();