Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: gm/textblobgeometrychange.cpp

Issue 1868553005: alternate textblobgeometrychange fix... just make our own surface if needed (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dm Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/dm_flags.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/textblobgeometrychange.cpp
diff --git a/gm/textblobgeometrychange.cpp b/gm/textblobgeometrychange.cpp
index b1c5b179880663716864060e1d812a58c719fa0f..b02bc07bf090bf50f9b1ce03656c607d74572a88 100644
--- a/gm/textblobgeometrychange.cpp
+++ b/gm/textblobgeometrychange.cpp
@@ -47,28 +47,24 @@ protected:
uint32_t allowSRGBInputs = canvas->getProps(&canvasProps)
? canvasProps.flags() & SkSurfaceProps::kAllowSRGBInputs_Flag : 0;
SkSurfaceProps props(allowSRGBInputs, kUnknown_SkPixelGeometry);
- auto surface(canvas->makeSurface(info, &props));
- if (surface) {
- SkCanvas* c = surface->getCanvas();
-
- // LCD text on white background
- SkRect rect = SkRect::MakeLTRB(0.f, 0.f, SkIntToScalar(kWidth), kHeight / 2.f);
- SkPaint rectPaint;
- rectPaint.setColor(0xffffffff);
- canvas->drawRect(rect, rectPaint);
- canvas->drawTextBlob(blob.get(), 10, 50, paint);
-
- // This should not look garbled since we should disable LCD text in this case
- // (i.e., unknown pixel geometry)
- c->clear(0x00ffffff);
- c->drawTextBlob(blob.get(), 10, 150, paint);
- surface->draw(canvas, 0, 0, nullptr);
- } else {
- const char* text = "This test requires a surface";
- size_t len = strlen(text);
- SkPaint paint;
- canvas->drawText(text, len, 10, 100, paint);
+ auto surface = canvas->makeSurface(info, &props);
+ if (!surface) {
+ surface = SkSurface::MakeRaster(info, &props);
}
+ SkCanvas* c = surface->getCanvas();
+
+ // LCD text on white background
+ SkRect rect = SkRect::MakeLTRB(0.f, 0.f, SkIntToScalar(kWidth), kHeight / 2.f);
+ SkPaint rectPaint;
+ rectPaint.setColor(0xffffffff);
+ canvas->drawRect(rect, rectPaint);
+ canvas->drawTextBlob(blob.get(), 10, 50, paint);
+
+ // This should not look garbled since we should disable LCD text in this case
+ // (i.e., unknown pixel geometry)
+ c->clear(0x00ffffff);
+ c->drawTextBlob(blob.get(), 10, 150, paint);
+ surface->draw(canvas, 0, 0, nullptr);
}
private:
« no previous file with comments | « no previous file | tools/dm_flags.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698