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

Side by Side Diff: samplecode/SampleText.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 2011 Google Inc. 2 * Copyright 2011 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 SkPaint paint; 115 SkPaint paint;
116 // const uint16_t glyphs[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,1 7,18,19 }; 116 // const uint16_t glyphs[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,1 7,18,19 };
117 int index = fHints % SK_ARRAY_COUNT(gHints); 117 int index = fHints % SK_ARRAY_COUNT(gHints);
118 index = 1; 118 index = 1;
119 // const char* style = gHints[index].fName; 119 // const char* style = gHints[index].fName;
120 120
121 // canvas->translate(0, SkIntToScalar(50)); 121 // canvas->translate(0, SkIntToScalar(50));
122 122
123 // canvas->drawText(style, strlen(style), SkIntToScalar(20), SkIntToScala r(20), paint); 123 // canvas->drawText(style, strlen(style), SkIntToScalar(20), SkIntToScala r(20), paint);
124 124
125 paint.setTypeface(SkTypeface::MakeFromFile("/skimages/samplefont.ttf")); 125 SkSafeUnref(paint.setTypeface(SkTypeface::CreateFromFile("/skimages/samp lefont.ttf")));
126 paint.setAntiAlias(true); 126 paint.setAntiAlias(true);
127 paint.setFlags(paint.getFlags() | gHints[index].fFlags); 127 paint.setFlags(paint.getFlags() | gHints[index].fFlags);
128 128
129 SkRect clip; 129 SkRect clip;
130 clip.set(SkIntToScalar(25), SkIntToScalar(34), SkIntToScalar(88), SkIntT oScalar(155)); 130 clip.set(SkIntToScalar(25), SkIntToScalar(34), SkIntToScalar(88), SkIntT oScalar(155));
131 131
132 const char* text = "Hamburgefons"; 132 const char* text = "Hamburgefons";
133 size_t length = strlen(text); 133 size_t length = strlen(text);
134 134
135 SkScalar y = SkIntToScalar(0); 135 SkScalar y = SkIntToScalar(0);
(...skipping 25 matching lines...) Expand all
161 int fHints; 161 int fHints;
162 SkScalar fClickX; 162 SkScalar fClickX;
163 163
164 typedef SampleView INHERITED; 164 typedef SampleView INHERITED;
165 }; 165 };
166 166
167 ////////////////////////////////////////////////////////////////////////////// 167 //////////////////////////////////////////////////////////////////////////////
168 168
169 static SkView* MyFactory() { return new TextSpeedView; } 169 static SkView* MyFactory() { return new TextSpeedView; }
170 static SkViewRegister reg(MyFactory); 170 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698