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

Side by Side Diff: src/fonts/SkTestScalerContext.cpp

Issue 370463002: Remove vertical/horizontal metrics selection. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Mac. Created 6 years, 5 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 | « src/fonts/SkGScalerContext.cpp ('k') | src/ports/SkFontHost_FreeType.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 2014 Google Inc. 2 * Copyright 2014 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDescriptor.h" 10 #include "SkDescriptor.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 SkPaint paint; 216 SkPaint paint;
217 paint.setAntiAlias(true); 217 paint.setAntiAlias(true);
218 canvas.drawPath(path, paint); 218 canvas.drawPath(path, paint);
219 } 219 }
220 220
221 virtual void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE { 221 virtual void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE {
222 fFace->getPath(glyph, path); 222 fFace->getPath(glyph, path);
223 path->transform(fMatrix); 223 path->transform(fMatrix);
224 } 224 }
225 225
226 virtual void generateFontMetrics(SkPaint::FontMetrics* , 226 virtual void generateFontMetrics(SkPaint::FontMetrics* metrics) SK_OVERRIDE {
227 SkPaint::FontMetrics* metrics) SK_OVERRIDE {
228 fFace->getFontMetrics(metrics); 227 fFace->getFontMetrics(metrics);
229 if (metrics) { 228 if (metrics) {
230 SkScalar scale = fMatrix.getScaleY(); 229 SkScalar scale = fMatrix.getScaleY();
231 metrics->fTop = SkScalarMul(metrics->fTop, scale); 230 metrics->fTop = SkScalarMul(metrics->fTop, scale);
232 metrics->fAscent = SkScalarMul(metrics->fAscent, scale); 231 metrics->fAscent = SkScalarMul(metrics->fAscent, scale);
233 metrics->fDescent = SkScalarMul(metrics->fDescent, scale); 232 metrics->fDescent = SkScalarMul(metrics->fDescent, scale);
234 metrics->fBottom = SkScalarMul(metrics->fBottom, scale); 233 metrics->fBottom = SkScalarMul(metrics->fBottom, scale);
235 metrics->fLeading = SkScalarMul(metrics->fLeading, scale); 234 metrics->fLeading = SkScalarMul(metrics->fLeading, scale);
236 metrics->fAvgCharWidth = SkScalarMul(metrics->fAvgCharWidth, scale); 235 metrics->fAvgCharWidth = SkScalarMul(metrics->fAvgCharWidth, scale);
237 metrics->fXMin = SkScalarMul(metrics->fXMin, scale); 236 metrics->fXMin = SkScalarMul(metrics->fXMin, scale);
238 metrics->fXMax = SkScalarMul(metrics->fXMax, scale); 237 metrics->fXMax = SkScalarMul(metrics->fXMax, scale);
239 metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale); 238 metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale);
240 } 239 }
241 } 240 }
242 241
243 private: 242 private:
244 SkTestTypeface* fFace; 243 SkTestTypeface* fFace;
245 SkMatrix fMatrix; 244 SkMatrix fMatrix;
246 }; 245 };
247 246
248 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const { 247 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const {
249 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d esc)); 248 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d esc));
250 } 249 }
OLDNEW
« no previous file with comments | « src/fonts/SkGScalerContext.cpp ('k') | src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698