Clean up textblobrandomfont.
The middle set of text is generated by rendering into a surface and then blitting that to the canvas to generate a certain kind of text generation. However, we are rendering with a -0.05 rotation and using nearest-neighbor sampling, which produces nasty artifacts unrelated to text. Changed the sample to render into the surface with the rotation, and blit back with no rotation. Bug: skia:7115 Change-Id: Iac1338f556cacc6c617ca14a625c649a6e7b9a48 Reviewed-on: https://skia-review.googlesource.com/130027 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
8a8dd33e18
commit
30f64e4512
@ -120,33 +120,39 @@ protected:
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
SkCanvas* c = surface->getCanvas();
|
||||
SkCanvas* surfaceCanvas = surface->getCanvas();
|
||||
|
||||
SkScalar stride = SkScalarCeilToScalar(fBlob->bounds().height());
|
||||
SkScalar yOffset = 5;
|
||||
for (int i = 0; i < 1; i++) {
|
||||
// fiddle the canvas to force regen of textblobs
|
||||
canvas->rotate(i % 2 ? 0.0f : -0.05f);
|
||||
|
||||
canvas->drawTextBlob(fBlob, 10, yOffset, paint);
|
||||
yOffset += stride;
|
||||
canvas->save();
|
||||
// Originally we would alternate between rotating and not to force blob regeneration,
|
||||
// but that code seems to have rotted. Keeping the rotate to match the old GM as
|
||||
// much as possible, and it seems like a reasonable stress test for transformed
|
||||
// color emoji.
|
||||
canvas->rotate(-0.05f);
|
||||
canvas->drawTextBlob(fBlob, 10, yOffset, paint);
|
||||
yOffset += stride;
|
||||
canvas->restore();
|
||||
|
||||
// this will test lcd masks when not requested
|
||||
// on cpu this currently causes unspecified behavior, so avoid until it is fixed
|
||||
if (canvas->getGrContext()) {
|
||||
c->drawTextBlob(fBlob, 10, yOffset, paint);
|
||||
surface->draw(canvas, 0, 0, nullptr);
|
||||
}
|
||||
yOffset += stride;
|
||||
|
||||
// free gpu resources and verify
|
||||
if (canvas->getGrContext()) {
|
||||
canvas->getGrContext()->freeGpuResources();
|
||||
}
|
||||
|
||||
canvas->drawTextBlob(fBlob, 10, yOffset, paint);
|
||||
yOffset += stride;
|
||||
// this will test lcd masks when not requested
|
||||
// on cpu this currently causes unspecified behavior, so avoid until it is fixed
|
||||
if (canvas->getGrContext()) {
|
||||
// Rotate in the surface canvas, not the final canvas, to avoid aliasing
|
||||
surfaceCanvas->rotate(-0.05f);
|
||||
surfaceCanvas->drawTextBlob(fBlob, 10, yOffset, paint);
|
||||
surface->draw(canvas, 0, 0, nullptr);
|
||||
}
|
||||
yOffset += stride;
|
||||
|
||||
// free gpu resources and verify
|
||||
if (canvas->getGrContext()) {
|
||||
canvas->getGrContext()->freeGpuResources();
|
||||
}
|
||||
|
||||
canvas->rotate(-0.05f);
|
||||
canvas->drawTextBlob(fBlob, 10, yOffset, paint);
|
||||
yOffset += stride;
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user