From bf16940d33208409d17b76bceb6d27b77675bea6 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 20 Feb 2015 07:57:29 -0600 Subject: Allow QDistanceField to be directly constructed from a QPainterPath. Enables optimization in the case of an already existing QPainterPath. Change-Id: I7f038673ce245ea19e400e6d2c728f07cb55e366 Task-number: QTBUG-42853 Reviewed-by: Lars Knoll Reviewed-by: Yoann Lopes Reviewed-by: Gunnar Sletta --- src/gui/text/qdistancefield.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/gui/text/qdistancefield.cpp') diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index 471a39a6e1..4d189786a1 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -833,6 +833,17 @@ QDistanceField::QDistanceField(QFontEngine *fontEngine, glyph_t glyph, bool doub setGlyph(fontEngine, glyph, doubleResolution); } +QDistanceField::QDistanceField(const QPainterPath &path, glyph_t glyph, bool doubleResolution) +{ + QPainterPath dfPath = path; + dfPath.translate(-dfPath.boundingRect().topLeft()); + dfPath.setFillRule(Qt::WindingFill); + + d = QDistanceFieldData::create(dfPath, doubleResolution); + d->glyph = glyph; +} + + QDistanceField::QDistanceField(QDistanceFieldData *data) : d(data) { -- cgit v1.2.3