diff options
author | reed <reed@google.com> | 2015-12-10 13:44:45 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-10 13:44:45 -0800 |
commit | 70ee31b2fa127eee6c0cea61cf05508e9d3ca7b1 (patch) | |
tree | 37f8350cd24bc973ebaf1d1499d9801966142e7e /gm | |
parent | 96f16e835e32665ea5af605e52715dbf43367291 (diff) |
try adding flag to allow lcd text even in a layer
BUG=skia:
Review URL: https://codereview.chromium.org/1513513002
Diffstat (limited to 'gm')
-rw-r--r-- | gm/lcdtext.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gm/lcdtext.cpp b/gm/lcdtext.cpp index 6daec824f3..e40fb0df18 100644 --- a/gm/lcdtext.cpp +++ b/gm/lcdtext.cpp @@ -126,6 +126,33 @@ protected: private: typedef skiagm::GM INHERITED; }; - DEF_GM( return new LcdTextGM; ) DEF_GM( return new LcdTextSizeGM; ) + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +DEF_SIMPLE_GM(savelayer_lcdtext, canvas, 620, 260) { + SkPaint paint; + paint.setAntiAlias(true); + paint.setLCDRenderText(true); + paint.setTextSize(20); + + canvas->drawText("Hamburgefons", 12, 30, 30, paint); + + const bool gPreserveLCDText[] = { false, true }; + + canvas->translate(0, 20); + for (auto preserve : gPreserveLCDText) { + preserve ? canvas->saveLayerPreserveLCDTextRequests(nullptr, nullptr) + : canvas->saveLayer(nullptr, nullptr); + canvas->drawText("Hamburgefons", 12, 30, 60, paint); + + SkPaint p; + p.setColor(0xFFCCCCCC); + canvas->drawRect(SkRect::MakeLTRB(25, 70, 200, 100), p); + canvas->drawText("Hamburgefons", 12, 30, 90, paint); + + canvas->restore(); + canvas->translate(0, 80); + } +} |