mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 755869 - [4] Re-apply bug 687189 - Implement SkPaint::getPosTextPath r=mattwoodrow
This commit is contained in:
parent
4d320037ae
commit
8dab82b9bf
@ -813,6 +813,9 @@ public:
|
||||
void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
|
||||
SkPath* path) const;
|
||||
|
||||
void getPosTextPath(const void* text, size_t length,
|
||||
const SkPoint pos[], SkPath* path) const;
|
||||
|
||||
#ifdef SK_BUILD_FOR_ANDROID
|
||||
const SkGlyph& getUnicharMetrics(SkUnichar);
|
||||
const SkGlyph& getGlyphMetrics(uint16_t);
|
||||
|
@ -1355,6 +1355,33 @@ void SkPaint::getTextPath(const void* textData, size_t length,
|
||||
}
|
||||
}
|
||||
|
||||
void SkPaint::getPosTextPath(const void* textData, size_t length,
|
||||
const SkPoint pos[], SkPath* path) const {
|
||||
SkASSERT(length == 0 || textData != NULL);
|
||||
|
||||
const char* text = (const char*)textData;
|
||||
if (text == NULL || length == 0 || path == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
SkTextToPathIter iter(text, length, *this, false);
|
||||
SkMatrix matrix;
|
||||
SkPoint prevPos;
|
||||
prevPos.set(0, 0);
|
||||
|
||||
matrix.setScale(iter.getPathScale(), iter.getPathScale());
|
||||
path->reset();
|
||||
|
||||
unsigned int i = 0;
|
||||
const SkPath* iterPath;
|
||||
while ((iterPath = iter.next(NULL)) != NULL) {
|
||||
matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
|
||||
path->addPath(*iterPath, matrix);
|
||||
prevPos = pos[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
static void add_flattenable(SkDescriptor* desc, uint32_t tag,
|
||||
SkFlattenableWriteBuffer* buffer) {
|
||||
buffer->flatten(desc->addEntry(tag, buffer->size(), NULL));
|
||||
|
Loading…
Reference in New Issue
Block a user