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

Unified Diff: gm/lcdtext.cpp

Issue 1513513002: try adding flag to allow lcd text even in a layer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: hobgoblins Created 5 years 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 | include/core/SkCanvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/lcdtext.cpp
diff --git a/gm/lcdtext.cpp b/gm/lcdtext.cpp
index 6daec824f32639de4f55d85a03a2f2a2fafa6c54..e40fb0df18234d06baf2f63731b197bdb6e0f436 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);
+ }
+}
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698