OLD | NEW |
---|---|
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 #include "gm.h" | 7 #include "gm.h" |
8 #include "Resources.h" | 8 #include "Resources.h" |
9 #include "SkFixed.h" | 9 #include "SkFixed.h" |
10 #include "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 const size_t textLen = strlen(text); | 51 const size_t textLen = strlen(text); |
52 | 52 |
53 for (int j = 0; j < 2; ++j) { | 53 for (int j = 0; j < 2; ++j) { |
54 for (int i = 0; i < 5; ++i) { | 54 for (int i = 0; i < 5; ++i) { |
55 SkScalar x = SkIntToScalar(10); | 55 SkScalar x = SkIntToScalar(10); |
56 SkScalar y = SkIntToScalar(20); | 56 SkScalar y = SkIntToScalar(20); |
57 | 57 |
58 SkFourByteTag tag = SkSetFourByteTag('w','g','h','t'); | 58 SkFourByteTag tag = SkSetFourByteTag('w','g','h','t'); |
59 SkScalar styleValue = SkDoubleToScalar(0.5 + (5*j + i) * ((2.0 - 0.5) / (2 * 5))); | 59 SkScalar styleValue = SkDoubleToScalar(0.5 + (5*j + i) * ((2.0 - 0.5) / (2 * 5))); |
60 SkFontMgr::FontParameters::Axis axes[] = { { tag, styleValue } } ; | 60 SkFontMgr::FontParameters::Axis axes[] = { { tag, styleValue } } ; |
61 SkAutoTUnref<SkTypeface> typeface(fontMgr->createFromStream( | 61 sk_sp<SkTypeface> typeface(fontMgr->createFromStream( |
62 distortable->duplicate(), SkFontMgr::FontParameters().setAxe s(axes, 1))); | 62 distortable->duplicate(), SkFontMgr::FontParameters().setAxe s(axes, 1))); |
63 paint.setTypeface(typeface); | 63 paint.setTypeface(typeface); |
tomhudson
2016/04/29 21:10:36
std::move(), if we're going to get rid of setTypef
bungeman-skia
2016/04/29 22:03:23
Missed that one. Done.
| |
64 | 64 |
65 SkAutoCanvasRestore acr(canvas, true); | 65 SkAutoCanvasRestore acr(canvas, true); |
66 canvas->translate(SkIntToScalar(30 + i * 100), SkIntToScalar(20) ); | 66 canvas->translate(SkIntToScalar(30 + i * 100), SkIntToScalar(20) ); |
67 rotate_about(canvas, SkIntToScalar(i * 5), x, y * 10); | 67 rotate_about(canvas, SkIntToScalar(i * 5), x, y * 10); |
68 | 68 |
69 { | 69 { |
70 SkPaint p; | 70 SkPaint p; |
71 p.setAntiAlias(true); | 71 p.setAntiAlias(true); |
72 SkRect r; | 72 SkRect r; |
73 r.set(x - SkIntToScalar(3), SkIntToScalar(15), | 73 r.set(x - SkIntToScalar(3), SkIntToScalar(15), |
(...skipping 15 matching lines...) Expand all Loading... | |
89 private: | 89 private: |
90 typedef GM INHERITED; | 90 typedef GM INHERITED; |
91 }; | 91 }; |
92 | 92 |
93 ////////////////////////////////////////////////////////////////////////////// | 93 ////////////////////////////////////////////////////////////////////////////// |
94 | 94 |
95 static GM* MyFactory(void*) { return new FontScalerDistortableGM; } | 95 static GM* MyFactory(void*) { return new FontScalerDistortableGM; } |
96 static GMRegistry reg(MyFactory); | 96 static GMRegistry reg(MyFactory); |
97 | 97 |
98 } | 98 } |
OLD | NEW |