summaryrefslogtreecommitdiffstats
path: root/ksvg
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-06-21 15:04:11 -0500
committerTimothy Pearson <[email protected]>2013-06-21 15:04:11 -0500
commit6792dcd1ea0be1edf7f91dfda15829001c3f0e7d (patch)
tree65b8caf8276deaaa66af8d204346369d04d1ee11 /ksvg
parentaf3e4faad3d3f2dae56e6033630e438bd9a36179 (diff)
downloadtdegraphics-6792dcd1ea0be1edf7f91dfda15829001c3f0e7d.tar.gz
tdegraphics-6792dcd1ea0be1edf7f91dfda15829001c3f0e7d.zip
Fix ksvg not respecting fit request
This resolves Bug 1018
Diffstat (limited to 'ksvg')
-rw-r--r--ksvg/core/KSVGCanvas.cpp2
-rw-r--r--ksvg/core/KSVGReader.cc24
-rw-r--r--ksvg/plugin/svgcreator.cpp5
3 files changed, 20 insertions, 11 deletions
diff --git a/ksvg/core/KSVGCanvas.cpp b/ksvg/core/KSVGCanvas.cpp
index 49d56982..d6ae5b5b 100644
--- a/ksvg/core/KSVGCanvas.cpp
+++ b/ksvg/core/KSVGCanvas.cpp
@@ -575,7 +575,9 @@ void KSVGCanvas::update(float zoomFactor)
setRenderBufferSize(newWidth, newHeight);
}
else
+ {
fill();
+ }
// reset clip paths
TQDictIterator<CanvasClipPath> itr(m_clipPaths);
diff --git a/ksvg/core/KSVGReader.cc b/ksvg/core/KSVGReader.cc
index 9fef68f7..7a62bb74 100644
--- a/ksvg/core/KSVGReader.cc
+++ b/ksvg/core/KSVGReader.cc
@@ -231,34 +231,40 @@ bool InputHandler::startElement(const TQString &namespaceURI, const TQString &,
// Need this before we can find our ownerSVGElement (AP)
if(m_currentNode != 0)
+ {
m_currentNode->appendChild(*svg);
+ }
else
- // TODO: Those set/get attribute callls have NO effect anymore
- // Convert to the new system, Rob? (Niko)
{
if(Helper::self()->fit())
{ // handle fitting of svg into small drawing area(thumb)
// TODO : aspectratio? and what about svgs that dont provide width and height?
- if(svg->getAttribute("viewBox").string().isEmpty())
+ if(attrs.value("viewBox").isEmpty())
{
SVGLengthImpl *width = SVGSVGElementImpl::createSVGLength();
SVGLengthImpl *height = SVGSVGElementImpl::createSVGLength();
- width->setValueAsString(svg->getAttribute("width").string());
- height->setValueAsString(svg->getAttribute("height").string());
+ width->setValueAsString(attrs.value("width"));
+ height->setValueAsString(attrs.value("height"));
TQString viewbox = TQString("0 0 %1 %2").arg(width->value()).arg(height->value());
//kdDebug(26001) << "VIEWBOX : " << viewbox.latin1() << endl;
- svg->setAttribute("viewBox", viewbox);
+ // HACK
+ // Does the existing attribute need to be deleted before appending the new attribute?
+ const_cast<TQXmlAttributes&>(attrs).append("viewBox", TQString::null, "viewBox", viewbox);
width->deref();
height->deref();
}
- svg->setAttribute("width", TQString::number(Helper::self()->canvas()->width()));
- svg->setAttribute("height", TQString::number(Helper::self()->canvas()->height()));
+ // HACK
+ // Does the existing attribute need to be deleted before appending the new attribute?
+ const_cast<TQXmlAttributes&>(attrs).append("width", TQString::null, "width", TQString::number(Helper::self()->canvas()->width()));
+ const_cast<TQXmlAttributes&>(attrs).append("height", TQString::null, "height", TQString::number(Helper::self()->canvas()->height()));
}
if(!Helper::self()->SVGFragmentId().isEmpty())
{
if(svg->currentView()->parseViewSpec(Helper::self()->SVGFragmentId()))
+ {
svg->setUseCurrentView(true);
+ }
}
}
@@ -397,7 +403,7 @@ bool InputHandler::endElement(const TQString &, const TQString &, const TQString
m_noRendering = false;
bool ok = tests ? tests->ok() : true;
- if(haveCanvas && element && style && ok && style->getDisplay() && style->getVisible() && qName == "pattern" || (shape && shape->directRender()))
+ if((haveCanvas && element && style && ok && style->getDisplay() && style->getVisible() && (qName == "pattern")) || (shape && shape->directRender()))
element->createItem();
}
diff --git a/ksvg/plugin/svgcreator.cpp b/ksvg/plugin/svgcreator.cpp
index 21d687be..521a8b88 100644
--- a/ksvg/plugin/svgcreator.cpp
+++ b/ksvg/plugin/svgcreator.cpp
@@ -54,7 +54,7 @@ bool SVGCreator::create(const TQString &path, int width, int height, TQImage &im
{
KSVG::SVGDocumentImpl *doc = new KSVG::SVGDocumentImpl(false, true);
doc->ref();
-
+
TQPixmap pix(width, height);
pix.fill(TQt::white);
@@ -67,8 +67,9 @@ bool SVGCreator::create(const TQString &path, int width, int height, TQImage &im
m_finished = false;
- while(!m_finished)
+ while(!m_finished) {
kapp->processOneEvent();
+ }
doc->deref();