Add test of tiny text with perspective.

There is an issue with rendering tiny text with SDFs,
and it's unclear which platforms this occurs on. Adding
this to the GM will make it clearer.

Bug: skia:8042
Change-Id: I0596c8e17a3b3cc7d6b51bef33097cfaba3bc64e
Reviewed-on: https://skia-review.googlesource.com/132823
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2018-06-07 09:41:28 -04:00 committed by Skia Commit-Bot
parent 18562b8adb
commit 2525a37c08

View File

@ -179,12 +179,45 @@ protected:
canvas->drawText(text, textLen, 580, 125, paint);
}
// check perspective
{
paint.setLCDRenderText(false);
SkAutoCanvasRestore acr(canvas, true);
SkMatrix persp;
persp.setAll(0.9839f, 0, 0,
0.2246f, 0.6829f, 0,
0.0002352f, -0.0003844f, 1);
canvas->concat(persp);
canvas->translate(1100, -295);
canvas->scale(375, 375);
paint.setTextSize(0.1f);
canvas->drawText(text, textLen, 0, 0, paint);
}
{
paint.setSubpixelText(false);
paint.setAntiAlias(false);
SkAutoCanvasRestore acr(canvas, true);
SkMatrix persp;
persp.setAll(0.9839f, 0, 0,
0.2246f, 0.6829f, 0,
0.0002352f, -0.0003844f, 1);
canvas->concat(persp);
canvas->translate(1075, -245);
canvas->scale(375, 375);
paint.setTextSize(0.1f);
canvas->drawText(text, textLen, 0, 0, paint);
}
// check color emoji
if (fEmojiTypeface) {
paint.setTypeface(fEmojiTypeface);
paint.setTextSize(SkIntToScalar(19));
canvas->drawString(fEmojiText, 670, 90, paint);
SkPaint emojiPaint;
emojiPaint.setSubpixelText(true);
emojiPaint.setAntiAlias(true);
emojiPaint.setTypeface(fEmojiTypeface);
emojiPaint.setTextSize(SkIntToScalar(19));
canvas->drawString(fEmojiText, 670, 90, emojiPaint);
}
// render offscreen buffer
if (surface) {
SkAutoCanvasRestore acr(inputCanvas, true);