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

Side by Side Diff: gm/fontscalerdistortable.cpp

Issue 1974783002: Revert of Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
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 paint.setTypeface(sk_sp<SkTypeface>(fontMgr->createFromStream( 61 SkAutoTUnref<SkTypeface> typeface(fontMgr->createFromStream(
62 distortable->duplicate(), SkFontMgr::FontParameters().se tAxes(axes, 1)))); 62 distortable->duplicate(), SkFontMgr::FontParameters().setAxe s(axes, 1)));
63 paint.setTypeface(typeface);
63 64
64 SkAutoCanvasRestore acr(canvas, true); 65 SkAutoCanvasRestore acr(canvas, true);
65 canvas->translate(SkIntToScalar(30 + i * 100), SkIntToScalar(20) ); 66 canvas->translate(SkIntToScalar(30 + i * 100), SkIntToScalar(20) );
66 rotate_about(canvas, SkIntToScalar(i * 5), x, y * 10); 67 rotate_about(canvas, SkIntToScalar(i * 5), x, y * 10);
67 68
68 { 69 {
69 SkPaint p; 70 SkPaint p;
70 p.setAntiAlias(true); 71 p.setAntiAlias(true);
71 SkRect r; 72 SkRect r;
72 r.set(x - SkIntToScalar(3), SkIntToScalar(15), 73 r.set(x - SkIntToScalar(3), SkIntToScalar(15),
(...skipping 15 matching lines...) Expand all
88 private: 89 private:
89 typedef GM INHERITED; 90 typedef GM INHERITED;
90 }; 91 };
91 92
92 ////////////////////////////////////////////////////////////////////////////// 93 //////////////////////////////////////////////////////////////////////////////
93 94
94 static GM* MyFactory(void*) { return new FontScalerDistortableGM; } 95 static GM* MyFactory(void*) { return new FontScalerDistortableGM; }
95 static GMRegistry reg(MyFactory); 96 static GMRegistry reg(MyFactory);
96 97
97 } 98 }
OLDNEW
« no previous file with comments | « gm/fontmgr.cpp ('k') | gm/gammatext.cpp » ('j') | src/ports/SkFontMgr_android.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698