FuzzCanvas: do textToglyphs right
Bug: skia:8635 Change-Id: I6ceec131ae9cc5796a5aba6d5cfdb16de4831a45 Reviewed-on: https://skia-review.googlesource.com/c/178261 Commit-Queue: Hal Canary <halcanary@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com> Auto-Submit: Hal Canary <halcanary@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
b79ba57f20
commit
fc97f222ff
@ -995,24 +995,26 @@ static sk_sp<SkTextBlob> make_fuzz_textblob(Fuzz* fuzz) {
|
||||
const SkTextBlobBuilder::RunBuffer* buffer;
|
||||
uint8_t runType;
|
||||
fuzz->nextRange(&runType, (uint8_t)0, (uint8_t)2);
|
||||
const void* textPtr = text.begin();
|
||||
size_t textLen = SkToSizeT(text.count());
|
||||
switch (runType) {
|
||||
case 0:
|
||||
fuzz->next(&x, &y);
|
||||
// TODO: Test other variations of this.
|
||||
buffer = &textBlobBuilder.allocRun(font, glyphCount, x, y);
|
||||
memcpy(buffer->glyphs, text.begin(), SkToSizeT(text.count()));
|
||||
(void)font.textToGlyphs(textPtr, textLen, encoding, buffer->glyphs, glyphCount);
|
||||
break;
|
||||
case 1:
|
||||
fuzz->next(&y);
|
||||
// TODO: Test other variations of this.
|
||||
buffer = &textBlobBuilder.allocRunPosH(font, glyphCount, y);
|
||||
memcpy(buffer->glyphs, text.begin(), SkToSizeT(text.count()));
|
||||
(void)font.textToGlyphs(textPtr, textLen, encoding, buffer->glyphs, glyphCount);
|
||||
fuzz->nextN(buffer->pos, glyphCount);
|
||||
break;
|
||||
case 2:
|
||||
// TODO: Test other variations of this.
|
||||
buffer = &textBlobBuilder.allocRunPos(font, glyphCount);
|
||||
memcpy(buffer->glyphs, text.begin(), SkToSizeT(text.count()));
|
||||
(void)font.textToGlyphs(textPtr, textLen, encoding, buffer->glyphs, glyphCount);
|
||||
fuzz->nextN(buffer->pos, glyphCount * 2);
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user