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

Side by Side Diff: gm/textblobmixedsizes.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/textblob.cpp ('k') | gm/textblobrandomfont.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 2015 Google Inc. 2 * Copyright 2015 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"
11 #include "SkBlurMask.h" 11 #include "SkBlurMask.h"
12 #include "SkBlurMaskFilter.h" 12 #include "SkBlurMaskFilter.h"
13 #include "SkCanvas.h" 13 #include "SkCanvas.h"
14 #include "SkGradientShader.h" 14 #include "SkGradientShader.h"
15 #include "SkImage.h" 15 #include "SkImage.h"
16 #include "SkRandom.h" 16 #include "SkRandom.h"
17 #include "SkStream.h" 17 #include "SkStream.h"
18 #include "SkSurface.h" 18 #include "SkSurface.h"
19 #include "SkTextBlob.h" 19 #include "SkTextBlob.h"
20 #include "SkTypeface.h" 20 #include "SkTypeface.h"
21 21
22 namespace skiagm { 22 namespace skiagm {
23 class TextBlobMixedSizes : public GM { 23 class TextBlobMixedSizes : public GM {
24 public: 24 public:
25 // This gm tests that textblobs of mixed sizes with a large glyph will rende r properly 25 // This gm tests that textblobs of mixed sizes with a large glyph will rende r properly
26 TextBlobMixedSizes(bool useDFT) : fUseDFT(useDFT) {} 26 TextBlobMixedSizes(bool useDFT) : fUseDFT(useDFT) {}
27 27
28 protected: 28 protected:
29 void onOnceBeforeDraw() override { 29 void onOnceBeforeDraw() override {
30 SkAutoTUnref<SkTypeface> typeface(GetResourceAsTypeface("/fonts/HangingS .ttf"));
31 SkTextBlobBuilder builder; 30 SkTextBlobBuilder builder;
32 31
33 // make textblob. To stress distance fields, we choose sizes appropriat ely 32 // make textblob. To stress distance fields, we choose sizes appropriat ely
34 SkPaint paint; 33 SkPaint paint;
35 paint.setAntiAlias(true); 34 paint.setAntiAlias(true);
36 paint.setSubpixelText(true); 35 paint.setSubpixelText(true);
37 paint.setLCDRenderText(true); 36 paint.setLCDRenderText(true);
38 paint.setTypeface(typeface); 37 paint.setTypeface(MakeResourceAsTypeface("/fonts/HangingS.ttf"));
39 38
40 const char* text = "Skia"; 39 const char* text = "Skia";
41 40
42 // extra large 41 // extra large
43 paint.setTextSize(262); 42 paint.setTextSize(262);
44 43
45 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, 0); 44 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, 0);
46 45
47 // large 46 // large
48 SkRect bounds; 47 SkRect bounds;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 typedef GM INHERITED; 188 typedef GM INHERITED;
190 }; 189 };
191 190
192 ////////////////////////////////////////////////////////////////////////////// 191 //////////////////////////////////////////////////////////////////////////////
193 192
194 DEF_GM( return new TextBlobMixedSizes(false); ) 193 DEF_GM( return new TextBlobMixedSizes(false); )
195 #if SK_SUPPORT_GPU 194 #if SK_SUPPORT_GPU
196 DEF_GM( return new TextBlobMixedSizes(true); ) 195 DEF_GM( return new TextBlobMixedSizes(true); )
197 #endif 196 #endif
198 } 197 }
OLDNEW
« no previous file with comments | « gm/textblob.cpp ('k') | gm/textblobrandomfont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698