aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-12-10 13:44:45 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-10 13:44:45 -0800
commit70ee31b2fa127eee6c0cea61cf05508e9d3ca7b1 (patch)
tree37f8350cd24bc973ebaf1d1499d9801966142e7e /gm
parent96f16e835e32665ea5af605e52715dbf43367291 (diff)
try adding flag to allow lcd text even in a layer
Diffstat (limited to 'gm')
-rw-r--r--gm/lcdtext.cpp29
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);
+ }
+}