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

Side by Side Diff: gm/fontscalerdistortable.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/fontmgr.cpp ('k') | gm/gammatext.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 #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
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 paint.setTypeface(sk_sp<SkTypeface>(fontMgr->createFromStream(
62 distortable->duplicate(), SkFontMgr::FontParameters().setAxe s(axes, 1))); 62 distortable->duplicate(), SkFontMgr::FontParameters().se tAxes(axes, 1))));
63 paint.setTypeface(typeface);
64 63
65 SkAutoCanvasRestore acr(canvas, true); 64 SkAutoCanvasRestore acr(canvas, true);
66 canvas->translate(SkIntToScalar(30 + i * 100), SkIntToScalar(20) ); 65 canvas->translate(SkIntToScalar(30 + i * 100), SkIntToScalar(20) );
67 rotate_about(canvas, SkIntToScalar(i * 5), x, y * 10); 66 rotate_about(canvas, SkIntToScalar(i * 5), x, y * 10);
68 67
69 { 68 {
70 SkPaint p; 69 SkPaint p;
71 p.setAntiAlias(true); 70 p.setAntiAlias(true);
72 SkRect r; 71 SkRect r;
73 r.set(x - SkIntToScalar(3), SkIntToScalar(15), 72 r.set(x - SkIntToScalar(3), SkIntToScalar(15),
(...skipping 15 matching lines...) Expand all
89 private: 88 private:
90 typedef GM INHERITED; 89 typedef GM INHERITED;
91 }; 90 };
92 91
93 ////////////////////////////////////////////////////////////////////////////// 92 //////////////////////////////////////////////////////////////////////////////
94 93
95 static GM* MyFactory(void*) { return new FontScalerDistortableGM; } 94 static GM* MyFactory(void*) { return new FontScalerDistortableGM; }
96 static GMRegistry reg(MyFactory); 95 static GMRegistry reg(MyFactory);
97 96
98 } 97 }
OLDNEW
« no previous file with comments | « gm/fontmgr.cpp ('k') | gm/gammatext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698