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

Unified Diff: gm/mixedtextblobs.cpp

Issue 1248703004: make color emoji gm portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more 565 color fixes Created 5 years, 5 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 | « gm/dftext.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/mixedtextblobs.cpp
diff --git a/gm/mixedtextblobs.cpp b/gm/mixedtextblobs.cpp
index ab7beb909b5d3a32afd682ccd21177660bb0bf8f..ead1b2497525f0fcb550d490cc1e9d4d854aa490 100644
--- a/gm/mixedtextblobs.cpp
+++ b/gm/mixedtextblobs.cpp
@@ -39,14 +39,8 @@ public:
protected:
void onOnceBeforeDraw() override {
-#ifndef SK_BUILD_FOR_MAC
- fEmojiTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf"));
- fEmojiText = "Emoji!!!";
-#else
- fEmojiTypeface.reset(SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kNormal));
- fEmojiText = "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" // 💰🏡🎅
- "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A\x80"; // 🍪🍕🚀
-#endif
+ fEmojiTypeface.reset(sk_tool_utils::emoji_typeface());
+ fEmojiText = sk_tool_utils::emoji_sample_text();
fReallyBigATypeface.reset(GetResourceAsTypeface("/fonts/ReallyBigA.ttf"));
SkTextBlobBuilder builder;
@@ -83,13 +77,15 @@ protected:
yOffset += bounds.height();
// color emoji
- paint.setSubpixelText(false);
- paint.setLCDRenderText(false);
- paint.setTypeface(fEmojiTypeface);
- text = fEmojiText;
- paint.measureText(text, strlen(text), &bounds);
- sk_tool_utils::add_to_text_blob(&builder, text, paint, xOffset - bounds.width() * 0.3f,
- yOffset);
+ if (fEmojiTypeface) {
+ paint.setSubpixelText(false);
+ paint.setLCDRenderText(false);
+ paint.setTypeface(fEmojiTypeface);
+ text = fEmojiText;
+ paint.measureText(text, strlen(text), &bounds);
+ sk_tool_utils::add_to_text_blob(&builder, text, paint, xOffset - bounds.width() * 0.3f,
+ yOffset);
+ }
// Corrupted font
paint.setTextSize(12);
@@ -100,7 +96,9 @@ protected:
}
SkString onShortName() override {
- return SkString("mixedtextblobs");
+ SkString name("mixedtextblobs");
+ name.append(sk_tool_utils::platform_os_emoji());
+ return name;
}
SkISize onISize() override {
@@ -109,7 +107,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
- canvas->drawColor(SK_ColorGRAY);
+ canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorGRAY));
SkPaint paint;
« no previous file with comments | « gm/dftext.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698