Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | diff --git a/gfx/skia/include/core/SkPaint.h b/gfx/skia/include/core/SkPaint.h |
michael@0 | 2 | --- a/gfx/skia/include/core/SkPaint.h |
michael@0 | 3 | +++ b/gfx/skia/include/core/SkPaint.h |
michael@0 | 4 | @@ -836,16 +836,19 @@ public: |
michael@0 | 5 | |
michael@0 | 6 | /** Return the path (outline) for the specified text. |
michael@0 | 7 | Note: just like SkCanvas::drawText, this will respect the Align setting |
michael@0 | 8 | in the paint. |
michael@0 | 9 | */ |
michael@0 | 10 | void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y, |
michael@0 | 11 | SkPath* path) const; |
michael@0 | 12 | |
michael@0 | 13 | + void getPosTextPath(const void* text, size_t length, |
michael@0 | 14 | + const SkPoint pos[], SkPath* path) const; |
michael@0 | 15 | + |
michael@0 | 16 | #ifdef SK_BUILD_FOR_ANDROID |
michael@0 | 17 | const SkGlyph& getUnicharMetrics(SkUnichar); |
michael@0 | 18 | const void* findImage(const SkGlyph&); |
michael@0 | 19 | |
michael@0 | 20 | uint32_t getGenerationID() const; |
michael@0 | 21 | #endif |
michael@0 | 22 | |
michael@0 | 23 | // returns true if the paint's settings (e.g. xfermode + alpha) resolve to |
michael@0 | 24 | diff --git a/gfx/skia/src/core/SkPaint.cpp b/gfx/skia/src/core/SkPaint.cpp |
michael@0 | 25 | --- a/gfx/skia/src/core/SkPaint.cpp |
michael@0 | 26 | +++ b/gfx/skia/src/core/SkPaint.cpp |
michael@0 | 27 | @@ -1242,16 +1242,43 @@ void SkPaint::getTextPath(const void* te |
michael@0 | 28 | const SkPath* iterPath; |
michael@0 | 29 | while ((iterPath = iter.next(&xpos)) != NULL) { |
michael@0 | 30 | matrix.postTranslate(xpos - prevXPos, 0); |
michael@0 | 31 | path->addPath(*iterPath, matrix); |
michael@0 | 32 | prevXPos = xpos; |
michael@0 | 33 | } |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | +void SkPaint::getPosTextPath(const void* textData, size_t length, |
michael@0 | 37 | + const SkPoint pos[], SkPath* path) const { |
michael@0 | 38 | + SkASSERT(length == 0 || textData != NULL); |
michael@0 | 39 | + |
michael@0 | 40 | + const char* text = (const char*)textData; |
michael@0 | 41 | + if (text == NULL || length == 0 || path == NULL) { |
michael@0 | 42 | + return; |
michael@0 | 43 | + } |
michael@0 | 44 | + |
michael@0 | 45 | + SkTextToPathIter iter(text, length, *this, false, true); |
michael@0 | 46 | + SkMatrix matrix; |
michael@0 | 47 | + SkPoint prevPos; |
michael@0 | 48 | + prevPos.set(0, 0); |
michael@0 | 49 | + |
michael@0 | 50 | + matrix.setScale(iter.getPathScale(), iter.getPathScale()); |
michael@0 | 51 | + path->reset(); |
michael@0 | 52 | + |
michael@0 | 53 | + unsigned int i = 0; |
michael@0 | 54 | + const SkPath* iterPath; |
michael@0 | 55 | + while ((iterPath = iter.next(NULL)) != NULL) { |
michael@0 | 56 | + matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY); |
michael@0 | 57 | + path->addPath(*iterPath, matrix); |
michael@0 | 58 | + prevPos = pos[i]; |
michael@0 | 59 | + i++; |
michael@0 | 60 | + } |
michael@0 | 61 | +} |
michael@0 | 62 | + |
michael@0 | 63 | static void add_flattenable(SkDescriptor* desc, uint32_t tag, |
michael@0 | 64 | SkFlattenableWriteBuffer* buffer) { |
michael@0 | 65 | buffer->flatten(desc->addEntry(tag, buffer->size(), NULL)); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | // SkFontHost can override this choice in FilterRec() |
michael@0 | 69 | static SkMask::Format computeMaskFormat(const SkPaint& paint) { |
michael@0 | 70 | uint32_t flags = paint.getFlags(); |