Bug 498873 - Remove use of unnecessary QPen pointer. r=pavlov

This commit is contained in:
Tobias Hunger 2009-06-17 13:21:04 +02:00
Родитель 70c501e572
Коммит cbf6875757
1 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@ -1038,8 +1038,8 @@ struct PatternToBrushConverter {
struct PatternToPenConverter { struct PatternToPenConverter {
PatternToPenConverter (const cairo_pattern_t *source, PatternToPenConverter (const cairo_pattern_t *source,
cairo_stroke_style_t *style) cairo_stroke_style_t *style) :
: mBrushConverter(source) mBrushConverter(source)
{ {
Qt::PenJoinStyle join = Qt::MiterJoin; Qt::PenJoinStyle join = Qt::MiterJoin;
Qt::PenCapStyle cap = Qt::SquareCap; Qt::PenCapStyle cap = Qt::SquareCap;
@ -1068,8 +1068,8 @@ struct PatternToPenConverter {
break; break;
} }
mPen = new QPen (mBrushConverter, style->line_width, Qt::SolidLine, cap, join); mPen = QPen(mBrushConverter, style->line_width, Qt::SolidLine, cap, join);
mPen->setMiterLimit (style->miter_limit); mPen.setMiterLimit (style->miter_limit);
if (style->dash && style->num_dashes) { if (style->dash && style->num_dashes) {
Qt::PenStyle pstyle = Qt::NoPen; Qt::PenStyle pstyle = Qt::NoPen;
@ -1090,7 +1090,7 @@ struct PatternToPenConverter {
} }
if (pstyle != Qt::NoPen) { if (pstyle != Qt::NoPen) {
mPen->setStyle(pstyle); mPen.setStyle(pstyle);
return; return;
} }
@ -1107,20 +1107,18 @@ struct PatternToPenConverter {
} }
} }
mPen->setDashPattern (dashes); mPen.setDashPattern(dashes);
mPen->setDashOffset (style->dash_offset / style->line_width); mPen.setDashOffset(style->dash_offset / style->line_width);
} }
} }
~PatternToPenConverter() { ~PatternToPenConverter() { }
delete mPen;
}
operator QPen& () { operator QPen& () {
return *mPen; return mPen;
} }
QPen *mPen; QPen mPen;
PatternToBrushConverter mBrushConverter; PatternToBrushConverter mBrushConverter;
}; };