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

Side by Side Diff: gm/fontscaler.cpp

Issue 568843002: Fix scaling issue with distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase to ToT Created 6 years, 3 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/dftext.cpp ('k') | gyp/gmslides.gypi » ('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 #include "gm.h" 7 #include "gm.h"
8 #include "SkTypeface.h" 8 #include "SkTypeface.h"
9 9
10 namespace skiagm { 10 namespace skiagm {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 { 66 {
67 SkPaint p; 67 SkPaint p;
68 p.setAntiAlias(true); 68 p.setAntiAlias(true);
69 SkRect r; 69 SkRect r;
70 r.set(x - SkIntToScalar(3), SkIntToScalar(15), 70 r.set(x - SkIntToScalar(3), SkIntToScalar(15),
71 x - SkIntToScalar(1), SkIntToScalar(280)); 71 x - SkIntToScalar(1), SkIntToScalar(280));
72 canvas->drawRect(r, p); 72 canvas->drawRect(r, p);
73 } 73 }
74 74
75 int index = 0;
76 for (int ps = 6; ps <= 22; ps++) { 75 for (int ps = 6; ps <= 22; ps++) {
77 paint.setTextSize(SkIntToScalar(ps)); 76 paint.setTextSize(SkIntToScalar(ps));
78 canvas->drawText(text, textLen, x, y, paint); 77 canvas->drawText(text, textLen, x, y, paint);
79 y += paint.getFontMetrics(NULL); 78 y += paint.getFontMetrics(NULL);
80 index += 1;
81 } 79 }
82 } 80 }
83 canvas->translate(0, SkIntToScalar(360)); 81 canvas->translate(0, SkIntToScalar(360));
84 paint.setSubpixelText(true); 82 paint.setSubpixelText(true);
85 } 83 }
86 } 84 }
87 85
88 private: 86 private:
89 typedef GM INHERITED; 87 typedef GM INHERITED;
90 }; 88 };
91 89
92 ////////////////////////////////////////////////////////////////////////////// 90 //////////////////////////////////////////////////////////////////////////////
93 91
94 static GM* MyFactory(void*) { return new FontScalerGM; } 92 static GM* MyFactory(void*) { return new FontScalerGM; }
95 static GMRegistry reg(MyFactory); 93 static GMRegistry reg(MyFactory);
96 94
97 } 95 }
OLDNEW
« no previous file with comments | « gm/dftext.cpp ('k') | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698