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

Side by Side Diff: gm/colortype.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/all_bitmap_configs.cpp ('k') | gm/colortypexfermode.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 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 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
11 #include "../src/fonts/SkGScalerContext.h" 11 #include "../src/fonts/SkGScalerContext.h"
12 12
13 class ColorTypeGM : public skiagm::GM { 13 class ColorTypeGM : public skiagm::GM {
14 public: 14 public:
15 ColorTypeGM() {} 15 ColorTypeGM() {}
16 16
17 protected: 17 protected:
18 void onOnceBeforeDraw() override { 18 void onOnceBeforeDraw() override {
19 const SkColor colors[] = { 19 const SkColor colors[] = {
20 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, 20 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE,
21 SK_ColorMAGENTA, SK_ColorCYAN, SK_ColorYELLOW 21 SK_ColorMAGENTA, SK_ColorCYAN, SK_ColorYELLOW
22 }; 22 };
23 SkMatrix local; 23 SkMatrix local;
24 local.setRotate(180); 24 local.setRotate(180);
25 SkPaint paint; 25 SkPaint paint;
26 paint.setAntiAlias(true); 26 paint.setAntiAlias(true);
27 paint.setShader(SkGradientShader::MakeSweep(0, 0, colors, nullptr, SK_AR RAY_COUNT(colors), 27 paint.setShader(SkGradientShader::MakeSweep(0, 0, colors, nullptr, SK_AR RAY_COUNT(colors),
28 0, &local)); 28 0, &local));
29 29
30 sk_sp<SkTypeface> orig(sk_tool_utils::create_portable_typeface("serif", SkTypeface::kBold)); 30 sk_sp<SkTypeface> orig(sk_tool_utils::create_portable_typeface(
31 "serif", SkFontStyle::FromOldStyle(SkTypeface ::kBold)));
31 if (nullptr == orig) { 32 if (nullptr == orig) {
32 orig = SkTypeface::MakeDefault(); 33 orig = SkTypeface::MakeDefault();
33 } 34 }
34 fColorType = sk_make_sp<SkGTypeface>(std::move(orig), paint); 35 fColorType = sk_make_sp<SkGTypeface>(std::move(orig), paint);
35 } 36 }
36 37
37 SkString onShortName() override { 38 SkString onShortName() override {
38 return SkString("colortype"); 39 return SkString("colortype");
39 } 40 }
40 41
(...skipping 13 matching lines...) Expand all
54 } 55 }
55 } 56 }
56 57
57 private: 58 private:
58 sk_sp<SkTypeface> fColorType; 59 sk_sp<SkTypeface> fColorType;
59 60
60 typedef skiagm::GM INHERITED; 61 typedef skiagm::GM INHERITED;
61 }; 62 };
62 63
63 DEF_GM(return new ColorTypeGM;) 64 DEF_GM(return new ColorTypeGM;)
OLDNEW
« no previous file with comments | « gm/all_bitmap_configs.cpp ('k') | gm/colortypexfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698