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

Side by Side Diff: gm/poly2poly.cpp

Issue 407183003: add portable and canonical font support for DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add atexit; rename to create_... Created 6 years, 4 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/pictureimagefilter.cpp ('k') | gm/quadpaths.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 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 "gm.h" 8 #include "gm.h"
9 9
10 class SkJSCanvas { 10 class SkJSCanvas {
(...skipping 19 matching lines...) Expand all
30 30
31 private: 31 private:
32 SkCanvas* fTarget; 32 SkCanvas* fTarget;
33 SkPaint fFillPaint; 33 SkPaint fFillPaint;
34 SkPaint fStrokePaint; 34 SkPaint fStrokePaint;
35 SkPath fPath; 35 SkPath fPath;
36 }; 36 };
37 37
38 SkJSCanvas::SkJSCanvas(SkCanvas* target) : fTarget(target) { 38 SkJSCanvas::SkJSCanvas(SkCanvas* target) : fTarget(target) {
39 fFillPaint.setAntiAlias(true); 39 fFillPaint.setAntiAlias(true);
40 sk_tool_utils::set_portable_typeface(&fFillPaint);
40 fStrokePaint.setAntiAlias(true); 41 fStrokePaint.setAntiAlias(true);
41 fStrokePaint.setStyle(SkPaint::kStroke_Style); 42 fStrokePaint.setStyle(SkPaint::kStroke_Style);
42 fStrokePaint.setStrokeWidth(SK_Scalar1); 43 fStrokePaint.setStrokeWidth(SK_Scalar1);
43 } 44 }
44 45
45 SkJSCanvas::~SkJSCanvas() {} 46 SkJSCanvas::~SkJSCanvas() {}
46 47
47 void SkJSCanvas::save() { fTarget->save(); } 48 void SkJSCanvas::save() { fTarget->save(); }
48 void SkJSCanvas::restore() { fTarget->restore(); } 49 void SkJSCanvas::restore() { fTarget->restore(); }
49 50
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 canvas->drawText(str.c_str(), str.size(), x, y, *paint); 223 canvas->drawText(str.c_str(), str.size(), x, y, *paint);
223 224
224 canvas->restore(); 225 canvas->restore();
225 } 226 }
226 227
227 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 228 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
228 if (false) { test_stroke(canvas); return; } 229 if (false) { test_stroke(canvas); return; }
229 230
230 SkPaint paint; 231 SkPaint paint;
231 paint.setAntiAlias(true); 232 paint.setAntiAlias(true);
233 sk_tool_utils::set_portable_typeface(&paint);
232 paint.setStrokeWidth(SkIntToScalar(4)); 234 paint.setStrokeWidth(SkIntToScalar(4));
233 paint.setTextSize(SkIntToScalar(40)); 235 paint.setTextSize(SkIntToScalar(40));
234 paint.setTextAlign(SkPaint::kCenter_Align); 236 paint.setTextAlign(SkPaint::kCenter_Align);
235 237
236 canvas->save(); 238 canvas->save();
237 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); 239 canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
238 // translate (1 point) 240 // translate (1 point)
239 const int src1[] = { 0, 0 }; 241 const int src1[] = { 0, 0 };
240 const int dst1[] = { 5, 5 }; 242 const int dst1[] = { 5, 5 };
241 doDraw(canvas, &paint, src1, dst1, 1); 243 doDraw(canvas, &paint, src1, dst1, 1);
(...skipping 24 matching lines...) Expand all
266 canvas->restore(); 268 canvas->restore();
267 } 269 }
268 270
269 private: 271 private:
270 typedef skiagm::GM INHERITED; 272 typedef skiagm::GM INHERITED;
271 }; 273 };
272 274
273 ////////////////////////////////////////////////////////////////////////////// 275 //////////////////////////////////////////////////////////////////////////////
274 276
275 DEF_GM( return new Poly2PolyGM; ) 277 DEF_GM( return new Poly2PolyGM; )
OLDNEW
« no previous file with comments | « gm/pictureimagefilter.cpp ('k') | gm/quadpaths.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698