Commit 5d972b8e authored by Thomas Zander's avatar Thomas Zander

Fix memory leak and return a struct by value instead of by reference.

svn path=/trunk/koffice/; revision=644557
parent 7b507791
......@@ -61,7 +61,7 @@ void KoLineBorder::fillStyle( KoGenStyle &style, KoShapeSavingContext &context )
style.addPropertyPt( "svg:stroke-width", lineWidth() );
}
KoInsets* KoLineBorder::borderInsets(const KoShape *shape, KoInsets &insets) {
void KoLineBorder::borderInsets(const KoShape *shape, KoInsets &insets) {
Q_UNUSED(shape);
double lineWidth = d->pen.widthF();
if(lineWidth < 0)
......@@ -71,7 +71,6 @@ KoInsets* KoLineBorder::borderInsets(const KoShape *shape, KoInsets &insets) {
insets.bottom = lineWidth;
insets.left = lineWidth;
insets.right = lineWidth;
return &insets;
}
bool KoLineBorder::hasTransparency() {
......
......@@ -77,7 +77,7 @@ public:
void setColor( const QColor & color );
virtual void fillStyle( KoGenStyle &style, KoShapeSavingContext &context );
virtual KoInsets* borderInsets(const KoShape *shape, KoInsets &insets);
virtual void borderInsets(const KoShape *shape, KoInsets &insets);
virtual bool hasTransparency();
virtual void paintBorder(KoShape *shape, QPainter &painter, const KoViewConverter &converter);
......
......@@ -389,7 +389,7 @@ void KoShape::repaint() const {
{
QRectF rect(QPointF(0, 0), size() );
if(d->border) {
KoInsets insets(0, 0, 0, 0);
KoInsets insets;
d->border->borderInsets(this, insets);
rect.adjust(-insets.left, -insets.top, insets.right, insets.bottom);
}
......
......@@ -59,9 +59,9 @@ public:
* @param shape the shape the insets will be calculated for
* Note that the KoInsets is a new object that you are responsible to delete afterwards.
*/
KoInsets* borderInsets(const KoShape *shape) {
KoInsets *insets = new KoInsets(0, 0, 0, 0);
borderInsets(shape, *insets);
KoInsets borderInsets(const KoShape *shape) {
KoInsets insets;
borderInsets(shape, insets);
return insets;
}
/**
......@@ -69,7 +69,7 @@ public:
* @param shape the shape the insets will be calculated for
* @param insets the insets object that will be filled and returned.
*/
virtual KoInsets* borderInsets(const KoShape *shape, KoInsets &insets) = 0;
virtual void borderInsets(const KoShape *shape, KoInsets &insets) = 0;
/**
* Returns true if there is some transparency, false if the border is fully opaque.
* @return if the border is transparent.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment