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

Side by Side Diff: gm/twopointradial.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/tilemodes_scaled.cpp ('k') | gm/typeface.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 2012 Google Inc. 2 * Copyright 2012 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 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 12 matching lines...) Expand all
23 SkIntToScalar(100)); 23 SkIntToScalar(100));
24 24
25 SkPoint c0 = { d0[0], d0[1] }; 25 SkPoint c0 = { d0[0], d0[1] };
26 SkScalar r0 = d0[2]; 26 SkScalar r0 = d0[2];
27 SkPoint c1 = { d1[0], d1[1] }; 27 SkPoint c1 = { d1[0], d1[1] };
28 SkScalar r1 = d1[2]; 28 SkScalar r1 = d1[2];
29 29
30 SkColor colors[] = { SK_ColorGREEN, SK_ColorRED }; 30 SkColor colors[] = { SK_ColorGREEN, SK_ColorRED };
31 SkPaint paint; 31 SkPaint paint;
32 paint.setAntiAlias(true); 32 paint.setAntiAlias(true);
33 sk_tool_utils::set_portable_typeface(&paint);
33 34
34 SkString str; 35 SkString str;
35 str.printf("%g,%g,%g %g,%g,%g", 36 str.printf("%g,%g,%g %g,%g,%g",
36 SkScalarToFloat(c0.fX), SkScalarToFloat(c0.fY), SkScalarToFloat(r 0), 37 SkScalarToFloat(c0.fX), SkScalarToFloat(c0.fY), SkScalarToFloat(r 0),
37 SkScalarToFloat(c1.fX), SkScalarToFloat(c1.fY), SkScalarToFloat(r 1)); 38 SkScalarToFloat(c1.fX), SkScalarToFloat(c1.fY), SkScalarToFloat(r 1));
38 canvas->drawText(str.c_str(), str.size(), 39 canvas->drawText(str.c_str(), str.size(),
39 bounds.fLeft, bounds.fTop - paint.getTextSize()/2, paint); 40 bounds.fLeft, bounds.fTop - paint.getTextSize()/2, paint);
40 41
41 paint.setShader(SkGradientShader::CreateTwoPointConical(c0, r0, c1, r1, 42 paint.setShader(SkGradientShader::CreateTwoPointConical(c0, r0, c1, r1,
42 colors, NULL, 2, 43 colors, NULL, 2,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 canvas->translate(0, DY); 103 canvas->translate(0, DY);
103 } 104 }
104 } 105 }
105 }; 106 };
106 107
107 ////////////////////////////////////////////////////////////////////////////// 108 //////////////////////////////////////////////////////////////////////////////
108 109
109 static skiagm::GM* F(void*) { return new TwoPointRadialGM; } 110 static skiagm::GM* F(void*) { return new TwoPointRadialGM; }
110 111
111 static skiagm::GMRegistry gR(F); 112 static skiagm::GMRegistry gR(F);
OLDNEW
« no previous file with comments | « gm/tilemodes_scaled.cpp ('k') | gm/typeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698