[Panel-devel] SVG render size patch

Matt Williams matt at milliams.com
Mon May 28 17:11:36 CEST 2007


At the moment, the implementation of resize() in Plasma::Svg seems a bit
flawed. There are two separate issues I've uncovered. The first is
possibly a design choice but the second really should be changed:

1) When the Svg is rendered, it is always rendered to its native
resolution. Then, you can scale it up by passing a larger QRectF to
Plasma::Svg::paint(QPainter* painter, const QRectF& rect, const QString&
elementID). However, since the Svg isn't rendered at the larger scale, it
looks pretty crap and pixellated when it gets too big.
However, rendering the SVG file at a large size is pretty slow so I can
see why the decision was made. The fix for this issue is the line (87) in
Private::findInCache() and renders the SVG to the size given by
Svg::elementSize() which is set through Svg::resize().

2) The second problem, and the one that must be fixed was likely caused
when the QMatrix was removed from the Svg::paint() argument list.
Basically in the paint() function, the passed QRectF is used both to
select a part of the pixmap (rendered from the Svg) to draw as well as
defining the area to draw it to on the QPainter. The change (at around
line 159) fixes this by always choosing to draw the whole pixmap (while
still allowing it to be drawn _to_ a custom QRectF).

What are your thoughts, particularly on point 1?

Regards,
Matt Williams
http://milliams.com



More information about the Panel-devel mailing list