gfx/skia/patches/archive/0001-Bug-687189-Implement-SkPaint-getPosTextPath.patch

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 From 27a914815e757ed12523edf968c9da134dabeaf8 Mon Sep 17 00:00:00 2001
     2 From: George Wright <gwright@mozilla.com>
     3 Date: Fri, 18 May 2012 14:10:44 -0400
     4 Subject: [PATCH 01/10]     Bug 755869 - [4] Re-apply bug 687189 - Implement
     5  SkPaint::getPosTextPath r=mattwoodrow
     7 ---
     8  gfx/skia/include/core/SkPaint.h |    3 +++
     9  gfx/skia/src/core/SkPaint.cpp   |   27 +++++++++++++++++++++++++++
    10  2 files changed, 30 insertions(+), 0 deletions(-)
    12 diff --git a/gfx/skia/include/core/SkPaint.h b/gfx/skia/include/core/SkPaint.h
    13 index 1930db1..ff37d77 100644
    14 --- a/gfx/skia/include/core/SkPaint.h
    15 +++ b/gfx/skia/include/core/SkPaint.h
    16 @@ -813,6 +813,9 @@ public:
    17      void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
    18                       SkPath* path) const;
    20 +    void getPosTextPath(const void* text, size_t length, 
    21 +                        const SkPoint pos[], SkPath* path) const;
    22 +
    23  #ifdef SK_BUILD_FOR_ANDROID
    24      const SkGlyph& getUnicharMetrics(SkUnichar);
    25      const SkGlyph& getGlyphMetrics(uint16_t);
    26 diff --git a/gfx/skia/src/core/SkPaint.cpp b/gfx/skia/src/core/SkPaint.cpp
    27 index 1b74fa1..4c119aa 100644
    28 --- a/gfx/skia/src/core/SkPaint.cpp
    29 +++ b/gfx/skia/src/core/SkPaint.cpp
    30 @@ -1355,6 +1355,33 @@ void SkPaint::getTextPath(const void* textData, size_t length,
    31      }
    32  }
    34 +void SkPaint::getPosTextPath(const void* textData, size_t length,
    35 +                             const SkPoint pos[], SkPath* path) const {
    36 +    SkASSERT(length == 0 || textData != NULL);
    37 +
    38 +    const char* text = (const char*)textData;
    39 +    if (text == NULL || length == 0 || path == NULL) {
    40 +        return;
    41 +    }
    42 +
    43 +    SkTextToPathIter    iter(text, length, *this, false);
    44 +    SkMatrix            matrix;
    45 +    SkPoint             prevPos;
    46 +    prevPos.set(0, 0);
    47 +
    48 +    matrix.setScale(iter.getPathScale(), iter.getPathScale());
    49 +    path->reset();
    50 +
    51 +    unsigned int    i = 0;
    52 +    const SkPath*   iterPath;
    53 +    while ((iterPath = iter.next(NULL)) != NULL) {
    54 +        matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
    55 +        path->addPath(*iterPath, matrix);
    56 +        prevPos = pos[i];
    57 +        i++;
    58 +    }
    59 +}
    60 +
    61  static void add_flattenable(SkDescriptor* desc, uint32_t tag,
    62                              SkFlattenableWriteBuffer* buffer) {
    63      buffer->flatten(desc->addEntry(tag, buffer->size(), NULL));
    64 -- 
    65 1.7.5.4

mercurial