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

Side by Side Diff: gm/variedtext.cpp

Issue 1818043002: SkTypeface::MakeFromName to take SkFontStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Android fix + nit fix Created 4 years, 6 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/typeface.cpp ('k') | gm/verttext2.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 2014 Google Inc. 2 * Copyright 2014 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 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 void onOnceBeforeDraw() override { 46 void onOnceBeforeDraw() override {
47 fPaint.setAntiAlias(true); 47 fPaint.setAntiAlias(true);
48 fPaint.setLCDRenderText(fLCD); 48 fPaint.setLCDRenderText(fLCD);
49 49
50 SkISize size = this->getISize(); 50 SkISize size = this->getISize();
51 SkScalar w = SkIntToScalar(size.fWidth); 51 SkScalar w = SkIntToScalar(size.fWidth);
52 SkScalar h = SkIntToScalar(size.fHeight); 52 SkScalar h = SkIntToScalar(size.fHeight);
53 53
54 static_assert(4 == SK_ARRAY_COUNT(fTypefaces), "typeface_cnt"); 54 static_assert(4 == SK_ARRAY_COUNT(fTypefaces), "typeface_cnt");
55 fTypefaces[0] = sk_tool_utils::create_portable_typeface("sans-serif", Sk Typeface::kNormal); 55 fTypefaces[0] = sk_tool_utils::create_portable_typeface("sans-serif", Sk FontStyle());
56 fTypefaces[1] = sk_tool_utils::create_portable_typeface("sans-serif", Sk Typeface::kBold); 56 fTypefaces[1] = sk_tool_utils::create_portable_typeface("sans-serif",
57 fTypefaces[2] = sk_tool_utils::create_portable_typeface("serif", SkTypef ace::kNormal); 57 SkFontStyle::FromOldStyle(SkTypeface::kBold));
58 fTypefaces[3] = sk_tool_utils::create_portable_typeface("serif", SkTypef ace::kBold); 58 fTypefaces[2] = sk_tool_utils::create_portable_typeface("serif", SkFontS tyle());
59 fTypefaces[3] = sk_tool_utils::create_portable_typeface("serif",
60 SkFontStyle::FromOldStyle(SkTypeface::kBold));
59 61
60 SkRandom random; 62 SkRandom random;
61 for (int i = 0; i < kCnt; ++i) { 63 for (int i = 0; i < kCnt; ++i) {
62 int length = random.nextRangeU(kMinLength, kMaxLength); 64 int length = random.nextRangeU(kMinLength, kMaxLength);
63 char text[kMaxLength]; 65 char text[kMaxLength];
64 for (int j = 0; j < length; ++j) { 66 for (int j = 0; j < length; ++j) {
65 text[j] = (char)random.nextRangeU('!', 'z'); 67 text[j] = (char)random.nextRangeU('!', 'z');
66 } 68 }
67 fStrings[i].set(text, length); 69 fStrings[i].set(text, length);
68 70
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 SkPoint fPositions[kCnt]; 151 SkPoint fPositions[kCnt];
150 SkRect fClipRects[kCnt]; 152 SkRect fClipRects[kCnt];
151 153
152 typedef skiagm::GM INHERITED; 154 typedef skiagm::GM INHERITED;
153 }; 155 };
154 156
155 DEF_GM(return new VariedTextGM(false, false);) 157 DEF_GM(return new VariedTextGM(false, false);)
156 DEF_GM(return new VariedTextGM(true, false);) 158 DEF_GM(return new VariedTextGM(true, false);)
157 DEF_GM(return new VariedTextGM(false, true);) 159 DEF_GM(return new VariedTextGM(false, true);)
158 DEF_GM(return new VariedTextGM(true, true);) 160 DEF_GM(return new VariedTextGM(true, true);)
OLDNEW
« no previous file with comments | « gm/typeface.cpp ('k') | gm/verttext2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698