| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 | 9 |
| 10 #include "Resources.h" | 10 #include "Resources.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace skiagm { | 45 namespace skiagm { |
| 46 | 46 |
| 47 class ColorEmojiGM : public GM { | 47 class ColorEmojiGM : public GM { |
| 48 public: | 48 public: |
| 49 ColorEmojiGM() { } | 49 ColorEmojiGM() { } |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 struct EmojiFont { | 52 struct EmojiFont { |
| 53 SkTypeface* typeface; | 53 SkAutoTUnref<SkTypeface> typeface; |
| 54 const char* text; | 54 const char* text; |
| 55 } emojiFont; | 55 } emojiFont; |
| 56 virtual void onOnceBeforeDraw() override { | 56 virtual void onOnceBeforeDraw() override { |
| 57 emojiFont.typeface = sk_tool_utils::emoji_typeface(); | 57 sk_tool_utils::emoji_typeface(&emojiFont.typeface); |
| 58 emojiFont.text = sk_tool_utils::emoji_sample_text(); | 58 emojiFont.text = sk_tool_utils::emoji_sample_text(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 SkString onShortName() override { | 61 SkString onShortName() override { |
| 62 SkString name("coloremoji"); | 62 SkString name("coloremoji"); |
| 63 name.append(sk_tool_utils::platform_os_emoji()); | 63 name.append(sk_tool_utils::platform_os_emoji()); |
| 64 return name; | 64 return name; |
| 65 } | 65 } |
| 66 | 66 |
| 67 SkISize onISize() override { | 67 SkISize onISize() override { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 paint.setAlpha(0x20); | 148 paint.setAlpha(0x20); |
| 149 canvas->drawText(text, strlen(text), 0, 0, paint); | 149 canvas->drawText(text, strlen(text), 0, 0, paint); |
| 150 canvas->clipRect(clipRects[x]); | 150 canvas->clipRect(clipRects[x]); |
| 151 paint.setAlpha(0xFF); | 151 paint.setAlpha(0xFF); |
| 152 canvas->drawText(text, strlen(text), 0, 0, paint); | 152 canvas->drawText(text, strlen(text), 0, 0, paint); |
| 153 canvas->restore(); | 153 canvas->restore(); |
| 154 canvas->translate(0, bounds.height() + SkIntToScalar(25)); | 154 canvas->translate(0, bounds.height() + SkIntToScalar(25)); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 private: | |
| 159 SkAutoTUnref<SkTypeface> fCBDT_CBLC_Typeface; | |
| 160 SkAutoTUnref<SkTypeface> fSBIX_Typeface; | |
| 161 | |
| 162 typedef GM INHERITED; | 158 typedef GM INHERITED; |
| 163 }; | 159 }; |
| 164 | 160 |
| 165 ////////////////////////////////////////////////////////////////////////////// | 161 ////////////////////////////////////////////////////////////////////////////// |
| 166 | 162 |
| 167 static GM* MyFactory(void*) { return new ColorEmojiGM; } | 163 static GM* MyFactory(void*) { return new ColorEmojiGM; } |
| 168 static GMRegistry reg(MyFactory); | 164 static GMRegistry reg(MyFactory); |
| 169 | 165 |
| 170 } | 166 } |
| OLD | NEW |