gfx/skia/patches/archive/getpostextpath.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/patches/archive/getpostextpath.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,70 @@
     1.4 +diff --git a/gfx/skia/include/core/SkPaint.h b/gfx/skia/include/core/SkPaint.h
     1.5 +--- a/gfx/skia/include/core/SkPaint.h
     1.6 ++++ b/gfx/skia/include/core/SkPaint.h
     1.7 +@@ -836,16 +836,19 @@ public:
     1.8 + 
     1.9 +     /** Return the path (outline) for the specified text.
    1.10 +         Note: just like SkCanvas::drawText, this will respect the Align setting
    1.11 +               in the paint.
    1.12 +     */
    1.13 +     void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
    1.14 +                      SkPath* path) const;
    1.15 + 
    1.16 ++    void getPosTextPath(const void* text, size_t length, 
    1.17 ++                        const SkPoint pos[], SkPath* path) const;
    1.18 ++
    1.19 + #ifdef SK_BUILD_FOR_ANDROID
    1.20 +     const SkGlyph& getUnicharMetrics(SkUnichar);
    1.21 +     const void* findImage(const SkGlyph&);
    1.22 + 
    1.23 +     uint32_t getGenerationID() const;
    1.24 + #endif
    1.25 + 
    1.26 +     // returns true if the paint's settings (e.g. xfermode + alpha) resolve to
    1.27 +diff --git a/gfx/skia/src/core/SkPaint.cpp b/gfx/skia/src/core/SkPaint.cpp
    1.28 +--- a/gfx/skia/src/core/SkPaint.cpp
    1.29 ++++ b/gfx/skia/src/core/SkPaint.cpp
    1.30 +@@ -1242,16 +1242,43 @@ void SkPaint::getTextPath(const void* te
    1.31 +     const SkPath*   iterPath;
    1.32 +     while ((iterPath = iter.next(&xpos)) != NULL) {
    1.33 +         matrix.postTranslate(xpos - prevXPos, 0);
    1.34 +         path->addPath(*iterPath, matrix);
    1.35 +         prevXPos = xpos;
    1.36 +     }
    1.37 + }
    1.38 + 
    1.39 ++void SkPaint::getPosTextPath(const void* textData, size_t length,
    1.40 ++                             const SkPoint pos[], SkPath* path) const {
    1.41 ++    SkASSERT(length == 0 || textData != NULL);
    1.42 ++
    1.43 ++    const char* text = (const char*)textData;
    1.44 ++    if (text == NULL || length == 0 || path == NULL) {
    1.45 ++        return;
    1.46 ++    }
    1.47 ++
    1.48 ++    SkTextToPathIter    iter(text, length, *this, false, true);
    1.49 ++    SkMatrix            matrix;
    1.50 ++    SkPoint             prevPos;
    1.51 ++    prevPos.set(0, 0);
    1.52 ++
    1.53 ++    matrix.setScale(iter.getPathScale(), iter.getPathScale());
    1.54 ++    path->reset();
    1.55 ++
    1.56 ++    unsigned int    i = 0;
    1.57 ++    const SkPath*   iterPath;
    1.58 ++    while ((iterPath = iter.next(NULL)) != NULL) {
    1.59 ++        matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
    1.60 ++        path->addPath(*iterPath, matrix);
    1.61 ++        prevPos = pos[i];
    1.62 ++        i++;
    1.63 ++    }
    1.64 ++}
    1.65 ++
    1.66 + static void add_flattenable(SkDescriptor* desc, uint32_t tag,
    1.67 +                             SkFlattenableWriteBuffer* buffer) {
    1.68 +     buffer->flatten(desc->addEntry(tag, buffer->size(), NULL));
    1.69 + }
    1.70 + 
    1.71 + // SkFontHost can override this choice in FilterRec()
    1.72 + static SkMask::Format computeMaskFormat(const SkPaint& paint) {
    1.73 +     uint32_t flags = paint.getFlags();

mercurial