jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
Hal Canary | c640d0d | 2018-06-13 09:59:02 -0400 | [diff] [blame] | 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
| 9 | #include "include/core/SkCanvas.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 10 | #include "include/core/SkColor.h" |
| 11 | #include "include/core/SkColorSpace.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "include/core/SkFont.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 13 | #include "include/core/SkFontStyle.h" |
| 14 | #include "include/core/SkFontTypes.h" |
| 15 | #include "include/core/SkImageInfo.h" |
| 16 | #include "include/core/SkMatrix.h" |
| 17 | #include "include/core/SkPaint.h" |
| 18 | #include "include/core/SkPoint.h" |
| 19 | #include "include/core/SkRect.h" |
| 20 | #include "include/core/SkRefCnt.h" |
| 21 | #include "include/core/SkScalar.h" |
| 22 | #include "include/core/SkSize.h" |
| 23 | #include "include/core/SkString.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 24 | #include "include/core/SkSurface.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 25 | #include "include/core/SkSurfaceProps.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 26 | #include "include/core/SkTextBlob.h" |
| 27 | #include "include/core/SkTypeface.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 28 | #include "include/core/SkTypes.h" |
| 29 | #include "include/private/SkTemplates.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 30 | #include "include/private/SkTo.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 31 | #include "tools/ToolUtils.h" |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 32 | |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 33 | #include <string.h> |
| 34 | |
| 35 | class GrContext; |
| 36 | |
jvanverth | fca302c | 2014-10-20 13:12:54 -0700 | [diff] [blame] | 37 | class DFTextGM : public skiagm::GM { |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 38 | public: |
| 39 | DFTextGM() { |
| 40 | this->setBGColor(0xFFFFFFFF); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 44 | void onOnceBeforeDraw() override { |
Mike Klein | ea3f014 | 2019-03-20 11:12:10 -0500 | [diff] [blame] | 45 | fEmojiTypeface = ToolUtils::emoji_typeface(); |
| 46 | fEmojiText = ToolUtils::emoji_sample_text(); |
jvanverth | fca302c | 2014-10-20 13:12:54 -0700 | [diff] [blame] | 47 | } |
| 48 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 49 | SkString onShortName() override { |
Mike Klein | bea1f94 | 2019-03-08 11:11:55 -0600 | [diff] [blame] | 50 | return SkString("dftext"); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 51 | } |
| 52 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 53 | SkISize onISize() override { |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 54 | return SkISize::Make(1024, 768); |
| 55 | } |
| 56 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 57 | virtual void onDraw(SkCanvas* inputCanvas) override { |
jvanverth | ed14f1d | 2014-10-06 12:50:54 -0700 | [diff] [blame] | 58 | SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f }; |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 59 | SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f }; |
| 60 | |
| 61 | // set up offscreen rendering with distance field text |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 62 | GrContext* ctx = inputCanvas->getGrContext(); |
brianosman | 52ede1d | 2016-06-20 08:25:02 -0700 | [diff] [blame] | 63 | SkISize size = onISize(); |
| 64 | SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType, |
Mike Reed | 693fdbd | 2017-01-12 10:13:40 -0500 | [diff] [blame] | 65 | inputCanvas->imageInfo().refColorSpace()); |
brianosman | 3a0dbde | 2016-07-26 11:36:05 -0700 | [diff] [blame] | 66 | SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag, |
reed | 4a8126e | 2014-09-22 07:29:03 -0700 | [diff] [blame] | 67 | SkSurfaceProps::kLegacyFontHost_InitType); |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 68 | auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props)); |
| 69 | SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas; |
jvanverth | f9669f4 | 2014-10-07 07:59:45 -0700 | [diff] [blame] | 70 | // init our new canvas with the old canvas's matrix |
| 71 | canvas->setMatrix(inputCanvas->getTotalMatrix()); |
jvanverth | 76ce81e | 2014-09-22 14:26:53 -0700 | [diff] [blame] | 72 | // apply global scale to test glyph positioning |
| 73 | canvas->scale(1.05f, 1.05f); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 74 | canvas->clear(0xffffffff); |
| 75 | |
| 76 | SkPaint paint; |
| 77 | paint.setAntiAlias(true); |
jvanverth | 4854d13 | 2015-06-22 06:46:56 -0700 | [diff] [blame] | 78 | |
Mike Klein | ea3f014 | 2019-03-20 11:12:10 -0500 | [diff] [blame] | 79 | SkFont font(ToolUtils::create_portable_typeface("serif", SkFontStyle())); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 80 | font.setSubpixel(true); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 81 | |
| 82 | const char* text = "Hamburgefons"; |
| 83 | const size_t textLen = strlen(text); |
| 84 | |
| 85 | // check scaling up |
| 86 | SkScalar x = SkIntToScalar(0); |
| 87 | SkScalar y = SkIntToScalar(78); |
| 88 | for (size_t i = 0; i < SK_ARRAY_COUNT(textSizes); ++i) { |
| 89 | SkAutoCanvasRestore acr(canvas, true); |
| 90 | canvas->translate(x, y); |
| 91 | canvas->scale(scales[i], scales[i]); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 92 | font.setSize(textSizes[i]); |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 93 | canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, 0, 0, font, paint); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 94 | y += font.getMetrics(nullptr)*scales[i]; |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | // check rotation |
| 98 | for (size_t i = 0; i < 5; ++i) { |
| 99 | SkScalar rotX = SkIntToScalar(10); |
| 100 | SkScalar rotY = y; |
| 101 | |
| 102 | SkAutoCanvasRestore acr(canvas, true); |
| 103 | canvas->translate(SkIntToScalar(10 + i * 200), -80); |
bungeman | 7438bfc | 2016-07-12 15:01:19 -0700 | [diff] [blame] | 104 | canvas->rotate(SkIntToScalar(i * 5), rotX, rotY); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 105 | for (int ps = 6; ps <= 32; ps += 3) { |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 106 | font.setSize(SkIntToScalar(ps)); |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 107 | canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, rotX, rotY, font, paint); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 108 | rotY += font.getMetrics(nullptr); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 109 | } |
| 110 | } |
| 111 | |
| 112 | // check scaling down |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 113 | font.setEdging(SkFont::Edging::kSubpixelAntiAlias); |
jvanverth | 76ce81e | 2014-09-22 14:26:53 -0700 | [diff] [blame] | 114 | x = SkIntToScalar(680); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 115 | y = SkIntToScalar(20); |
| 116 | size_t arraySize = SK_ARRAY_COUNT(textSizes); |
| 117 | for (size_t i = 0; i < arraySize; ++i) { |
| 118 | SkAutoCanvasRestore acr(canvas, true); |
| 119 | canvas->translate(x, y); |
| 120 | SkScalar scaleFactor = SkScalarInvert(scales[arraySize - i - 1]); |
| 121 | canvas->scale(scaleFactor, scaleFactor); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 122 | font.setSize(textSizes[i]); |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 123 | canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, 0, 0, font, paint); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 124 | y += font.getMetrics(nullptr)*scaleFactor; |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 125 | } |
| 126 | |
jvanverth | 76ce81e | 2014-09-22 14:26:53 -0700 | [diff] [blame] | 127 | // check pos text |
| 128 | { |
| 129 | SkAutoCanvasRestore acr(canvas, true); |
| 130 | |
| 131 | canvas->scale(2.0f, 2.0f); |
| 132 | |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 133 | SkAutoTArray<SkGlyphID> glyphs(SkToInt(textLen)); |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 134 | int count = font.textToGlyphs(text, textLen, SkTextEncoding::kUTF8, glyphs.get(), textLen); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 135 | SkAutoTArray<SkPoint> pos(count); |
| 136 | font.setSize(textSizes[0]); |
| 137 | font.getPos(glyphs.get(), count, pos.get(), {340, 75}); |
jvanverth | 76ce81e | 2014-09-22 14:26:53 -0700 | [diff] [blame] | 138 | |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 139 | auto blob = SkTextBlob::MakeFromPosText(glyphs.get(), count * sizeof(SkGlyphID), |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 140 | pos.get(), font, SkTextEncoding::kGlyphID); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 141 | canvas->drawTextBlob(blob, 0, 0, paint); |
jvanverth | 76ce81e | 2014-09-22 14:26:53 -0700 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 145 | // check gamma-corrected blending |
| 146 | const SkColor fg[] = { |
| 147 | 0xFFFFFFFF, |
| 148 | 0xFFFFFF00, 0xFFFF00FF, 0xFF00FFFF, |
| 149 | 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, |
| 150 | 0xFF000000, |
| 151 | }; |
| 152 | |
caryclark | c3dcb67 | 2015-07-21 12:27:36 -0700 | [diff] [blame] | 153 | paint.setColor(0xFFF7F3F7); |
caryclark | ba9757a | 2015-07-23 14:07:58 -0700 | [diff] [blame] | 154 | SkRect r = SkRect::MakeLTRB(670, 215, 820, 397); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 155 | canvas->drawRect(r, paint); |
| 156 | |
jvanverth | 76ce81e | 2014-09-22 14:26:53 -0700 | [diff] [blame] | 157 | x = SkIntToScalar(680); |
caryclark | ba9757a | 2015-07-23 14:07:58 -0700 | [diff] [blame] | 158 | y = SkIntToScalar(235); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 159 | font.setSize(SkIntToScalar(19)); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 160 | for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { |
| 161 | paint.setColor(fg[i]); |
| 162 | |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 163 | canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, x, y, font, paint); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 164 | y += font.getMetrics(nullptr); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 165 | } |
| 166 | |
caryclark | c3dcb67 | 2015-07-21 12:27:36 -0700 | [diff] [blame] | 167 | paint.setColor(0xFF181C18); |
caryclark | ba9757a | 2015-07-23 14:07:58 -0700 | [diff] [blame] | 168 | r = SkRect::MakeLTRB(820, 215, 970, 397); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 169 | canvas->drawRect(r, paint); |
| 170 | |
jvanverth | 76ce81e | 2014-09-22 14:26:53 -0700 | [diff] [blame] | 171 | x = SkIntToScalar(830); |
caryclark | ba9757a | 2015-07-23 14:07:58 -0700 | [diff] [blame] | 172 | y = SkIntToScalar(235); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 173 | font.setSize(SkIntToScalar(19)); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 174 | for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { |
| 175 | paint.setColor(fg[i]); |
| 176 | |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 177 | canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, x, y, font, paint); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 178 | y += font.getMetrics(nullptr); |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 179 | } |
| 180 | |
jvanverth | 354eba5 | 2015-03-16 11:32:49 -0700 | [diff] [blame] | 181 | // check skew |
| 182 | { |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 183 | font.setEdging(SkFont::Edging::kAntiAlias); |
jvanverth | 354eba5 | 2015-03-16 11:32:49 -0700 | [diff] [blame] | 184 | SkAutoCanvasRestore acr(canvas, true); |
| 185 | canvas->skew(0.0f, 0.151515f); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 186 | font.setSize(SkIntToScalar(32)); |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 187 | canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, 745, 70, font, paint); |
jvanverth | 354eba5 | 2015-03-16 11:32:49 -0700 | [diff] [blame] | 188 | } |
| 189 | { |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 190 | font.setEdging(SkFont::Edging::kSubpixelAntiAlias); |
jvanverth | 354eba5 | 2015-03-16 11:32:49 -0700 | [diff] [blame] | 191 | SkAutoCanvasRestore acr(canvas, true); |
| 192 | canvas->skew(0.5f, 0.0f); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 193 | font.setSize(SkIntToScalar(32)); |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 194 | canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, 580, 125, font, paint); |
jvanverth | 354eba5 | 2015-03-16 11:32:49 -0700 | [diff] [blame] | 195 | } |
| 196 | |
Jim Van Verth | 2525a37 | 2018-06-07 09:41:28 -0400 | [diff] [blame] | 197 | // check perspective |
| 198 | { |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 199 | font.setEdging(SkFont::Edging::kAntiAlias); |
Jim Van Verth | 2525a37 | 2018-06-07 09:41:28 -0400 | [diff] [blame] | 200 | SkAutoCanvasRestore acr(canvas, true); |
| 201 | SkMatrix persp; |
| 202 | persp.setAll(0.9839f, 0, 0, |
| 203 | 0.2246f, 0.6829f, 0, |
| 204 | 0.0002352f, -0.0003844f, 1); |
| 205 | canvas->concat(persp); |
| 206 | canvas->translate(1100, -295); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 207 | font.setSize(37.5f); |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 208 | canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, 0, 0, font, paint); |
Jim Van Verth | 2525a37 | 2018-06-07 09:41:28 -0400 | [diff] [blame] | 209 | } |
| 210 | { |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 211 | font.setSubpixel(false); |
| 212 | font.setEdging(SkFont::Edging::kAlias); |
Jim Van Verth | 2525a37 | 2018-06-07 09:41:28 -0400 | [diff] [blame] | 213 | SkAutoCanvasRestore acr(canvas, true); |
| 214 | SkMatrix persp; |
| 215 | persp.setAll(0.9839f, 0, 0, |
| 216 | 0.2246f, 0.6829f, 0, |
| 217 | 0.0002352f, -0.0003844f, 1); |
| 218 | canvas->concat(persp); |
| 219 | canvas->translate(1075, -245); |
Jim Van Verth | 4ba1a6f | 2018-06-07 19:54:17 +0000 | [diff] [blame] | 220 | canvas->scale(375, 375); |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 221 | font.setSize(0.1f); |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 222 | canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, 0, 0, font, paint); |
Jim Van Verth | 2525a37 | 2018-06-07 09:41:28 -0400 | [diff] [blame] | 223 | } |
| 224 | |
jvanverth | fca302c | 2014-10-20 13:12:54 -0700 | [diff] [blame] | 225 | // check color emoji |
caryclark | c3dcb67 | 2015-07-21 12:27:36 -0700 | [diff] [blame] | 226 | if (fEmojiTypeface) { |
Mike Reed | 42e7a7e | 2018-12-13 16:42:53 -0500 | [diff] [blame] | 227 | SkFont emoiFont; |
| 228 | emoiFont.setSubpixel(true); |
| 229 | emoiFont.setTypeface(fEmojiTypeface); |
| 230 | emoiFont.setSize(SkIntToScalar(19)); |
Ben Wagner | 51e15a6 | 2019-05-07 15:38:46 -0400 | [diff] [blame] | 231 | canvas->drawSimpleText(fEmojiText, strlen(fEmojiText), SkTextEncoding::kUTF8, 670, 90, emoiFont, paint); |
caryclark | c3dcb67 | 2015-07-21 12:27:36 -0700 | [diff] [blame] | 232 | } |
Jim Van Verth | 2525a37 | 2018-06-07 09:41:28 -0400 | [diff] [blame] | 233 | |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 234 | // render offscreen buffer |
jvanverth | 76ce81e | 2014-09-22 14:26:53 -0700 | [diff] [blame] | 235 | if (surface) { |
jvanverth | f9669f4 | 2014-10-07 07:59:45 -0700 | [diff] [blame] | 236 | SkAutoCanvasRestore acr(inputCanvas, true); |
| 237 | // since we prepended this matrix already, we blit using identity |
| 238 | inputCanvas->resetMatrix(); |
reed | 9ce9d67 | 2016-03-17 10:51:11 -0700 | [diff] [blame] | 239 | inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nullptr); |
jvanverth | 76ce81e | 2014-09-22 14:26:53 -0700 | [diff] [blame] | 240 | } |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | private: |
bungeman | 13b9c95 | 2016-05-12 10:09:30 -0700 | [diff] [blame] | 244 | sk_sp<SkTypeface> fEmojiTypeface; |
caryclark | c3dcb67 | 2015-07-21 12:27:36 -0700 | [diff] [blame] | 245 | const char* fEmojiText; |
jvanverth | fca302c | 2014-10-20 13:12:54 -0700 | [diff] [blame] | 246 | |
| 247 | typedef skiagm::GM INHERITED; |
jvanverth | 9564ce6 | 2014-09-16 05:45:19 -0700 | [diff] [blame] | 248 | }; |
| 249 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 250 | DEF_GM(return new DFTextGM;) |