michael@0: diff --git a/gfx/skia/include/core/SkPaint.h b/gfx/skia/include/core/SkPaint.h michael@0: --- a/gfx/skia/include/core/SkPaint.h michael@0: +++ b/gfx/skia/include/core/SkPaint.h michael@0: @@ -836,16 +836,19 @@ public: michael@0: michael@0: /** Return the path (outline) for the specified text. michael@0: Note: just like SkCanvas::drawText, this will respect the Align setting michael@0: in the paint. michael@0: */ michael@0: void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y, michael@0: SkPath* path) const; michael@0: michael@0: + void getPosTextPath(const void* text, size_t length, michael@0: + const SkPoint pos[], SkPath* path) const; michael@0: + michael@0: #ifdef SK_BUILD_FOR_ANDROID michael@0: const SkGlyph& getUnicharMetrics(SkUnichar); michael@0: const void* findImage(const SkGlyph&); michael@0: michael@0: uint32_t getGenerationID() const; michael@0: #endif michael@0: michael@0: // returns true if the paint's settings (e.g. xfermode + alpha) resolve to michael@0: diff --git a/gfx/skia/src/core/SkPaint.cpp b/gfx/skia/src/core/SkPaint.cpp michael@0: --- a/gfx/skia/src/core/SkPaint.cpp michael@0: +++ b/gfx/skia/src/core/SkPaint.cpp michael@0: @@ -1242,16 +1242,43 @@ void SkPaint::getTextPath(const void* te michael@0: const SkPath* iterPath; michael@0: while ((iterPath = iter.next(&xpos)) != NULL) { michael@0: matrix.postTranslate(xpos - prevXPos, 0); michael@0: path->addPath(*iterPath, matrix); michael@0: prevXPos = xpos; michael@0: } michael@0: } michael@0: michael@0: +void SkPaint::getPosTextPath(const void* textData, size_t length, michael@0: + const SkPoint pos[], SkPath* path) const { michael@0: + SkASSERT(length == 0 || textData != NULL); michael@0: + michael@0: + const char* text = (const char*)textData; michael@0: + if (text == NULL || length == 0 || path == NULL) { michael@0: + return; michael@0: + } michael@0: + michael@0: + SkTextToPathIter iter(text, length, *this, false, true); michael@0: + SkMatrix matrix; michael@0: + SkPoint prevPos; michael@0: + prevPos.set(0, 0); michael@0: + michael@0: + matrix.setScale(iter.getPathScale(), iter.getPathScale()); michael@0: + path->reset(); michael@0: + michael@0: + unsigned int i = 0; michael@0: + const SkPath* iterPath; michael@0: + while ((iterPath = iter.next(NULL)) != NULL) { michael@0: + matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY); michael@0: + path->addPath(*iterPath, matrix); michael@0: + prevPos = pos[i]; michael@0: + i++; michael@0: + } michael@0: +} michael@0: + michael@0: static void add_flattenable(SkDescriptor* desc, uint32_t tag, michael@0: SkFlattenableWriteBuffer* buffer) { michael@0: buffer->flatten(desc->addEntry(tag, buffer->size(), NULL)); michael@0: } michael@0: michael@0: // SkFontHost can override this choice in FilterRec() michael@0: static SkMask::Format computeMaskFormat(const SkPaint& paint) { michael@0: uint32_t flags = paint.getFlags();