| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |