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.

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

mercurial