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

Side by Side Diff: gm/dftext.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « gm/colortypexfermode.cpp ('k') | gm/fontcache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 #include "gm.h" 7 #include "gm.h"
8 #include "Resources.h" 8 #include "Resources.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
11 #include "SkSurface.h" 11 #include "SkSurface.h"
12 #include "SkTypeface.h" 12 #include "SkTypeface.h"
13 13
14 class DFTextGM : public skiagm::GM { 14 class DFTextGM : public skiagm::GM {
15 public: 15 public:
16 DFTextGM() { 16 DFTextGM() {
17 this->setBGColor(0xFFFFFFFF); 17 this->setBGColor(0xFFFFFFFF);
18 } 18 }
19 19
20 protected: 20 protected:
21 void onOnceBeforeDraw() override { 21 void onOnceBeforeDraw() override {
22 sk_tool_utils::emoji_typeface(&fEmojiTypeface); 22 fEmojiTypeface = sk_tool_utils::emoji_typeface();
23 fEmojiText = sk_tool_utils::emoji_sample_text(); 23 fEmojiText = sk_tool_utils::emoji_sample_text();
24 } 24 }
25 25
26 SkString onShortName() override { 26 SkString onShortName() override {
27 SkString name("dftext"); 27 SkString name("dftext");
28 name.append(sk_tool_utils::platform_os_emoji()); 28 name.append(sk_tool_utils::platform_os_emoji());
29 return name; 29 return name;
30 } 30 }
31 31
32 SkISize onISize() override { 32 SkISize onISize() override {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (surface) { 203 if (surface) {
204 SkAutoCanvasRestore acr(inputCanvas, true); 204 SkAutoCanvasRestore acr(inputCanvas, true);
205 // since we prepended this matrix already, we blit using identity 205 // since we prepended this matrix already, we blit using identity
206 inputCanvas->resetMatrix(); 206 inputCanvas->resetMatrix();
207 inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nul lptr); 207 inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nul lptr);
208 } 208 }
209 #endif 209 #endif
210 } 210 }
211 211
212 private: 212 private:
213 SkAutoTUnref<SkTypeface> fEmojiTypeface; 213 sk_sp<SkTypeface> fEmojiTypeface;
214 const char* fEmojiText; 214 const char* fEmojiText;
215 215
216 typedef skiagm::GM INHERITED; 216 typedef skiagm::GM INHERITED;
217 }; 217 };
218 218
219 DEF_GM(return new DFTextGM;) 219 DEF_GM(return new DFTextGM;)
OLDNEW
« no previous file with comments | « gm/colortypexfermode.cpp ('k') | gm/fontcache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698