| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 uint16_t generateCharToGlyph(SkUnichar uni) SK_OVERRIDE { | 208 uint16_t generateCharToGlyph(SkUnichar uni) SK_OVERRIDE { |
| 209 uint16_t glyph; | 209 uint16_t glyph; |
| 210 (void) fFace->onCharsToGlyphs((const void *) &uni, SkTypeface::kUTF16_En
coding, &glyph, 1); | 210 (void) fFace->onCharsToGlyphs((const void *) &uni, SkTypeface::kUTF16_En
coding, &glyph, 1); |
| 211 return glyph; | 211 return glyph; |
| 212 } | 212 } |
| 213 | 213 |
| 214 void generateAdvance(SkGlyph* glyph) SK_OVERRIDE { | 214 void generateAdvance(SkGlyph* glyph) SK_OVERRIDE { |
| 215 fFace->getAdvance(glyph); | 215 fFace->getAdvance(glyph); |
| 216 | 216 |
| 217 SkVector advance; | 217 const SkVector advance = fMatrix.mapXY(SkFixedToScalar(glyph->fAdvanceX)
, |
| 218 fMatrix.mapXY(SkFixedToScalar(glyph->fAdvanceX), | 218 SkFixedToScalar(glyph->fAdvanceY)
); |
| 219 SkFixedToScalar(glyph->fAdvanceY), &advance); | |
| 220 glyph->fAdvanceX = SkScalarToFixed(advance.fX); | 219 glyph->fAdvanceX = SkScalarToFixed(advance.fX); |
| 221 glyph->fAdvanceY = SkScalarToFixed(advance.fY); | 220 glyph->fAdvanceY = SkScalarToFixed(advance.fY); |
| 222 } | 221 } |
| 223 | 222 |
| 224 void generateMetrics(SkGlyph* glyph) SK_OVERRIDE { | 223 void generateMetrics(SkGlyph* glyph) SK_OVERRIDE { |
| 225 fFace->getMetrics(glyph); | 224 fFace->getMetrics(glyph); |
| 226 | 225 |
| 227 SkVector advance; | 226 const SkVector advance = fMatrix.mapXY(SkFixedToScalar(glyph->fAdvanceX)
, |
| 228 fMatrix.mapXY(SkFixedToScalar(glyph->fAdvanceX), | 227 SkFixedToScalar(glyph->fAdvanceY)
); |
| 229 SkFixedToScalar(glyph->fAdvanceY), &advance); | |
| 230 glyph->fAdvanceX = SkScalarToFixed(advance.fX); | 228 glyph->fAdvanceX = SkScalarToFixed(advance.fX); |
| 231 glyph->fAdvanceY = SkScalarToFixed(advance.fY); | 229 glyph->fAdvanceY = SkScalarToFixed(advance.fY); |
| 232 | 230 |
| 233 SkPath path; | 231 SkPath path; |
| 234 fFace->getPath(*glyph, &path); | 232 fFace->getPath(*glyph, &path); |
| 235 path.transform(fMatrix); | 233 path.transform(fMatrix); |
| 236 | 234 |
| 237 SkRect storage; | 235 SkRect storage; |
| 238 const SkPaint paint; | 236 const SkPaint paint; |
| 239 const SkRect& newBounds = paint.doComputeFastBounds(path.getBounds(), | 237 const SkRect& newBounds = paint.doComputeFastBounds(path.getBounds(), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 286 } |
| 289 | 287 |
| 290 private: | 288 private: |
| 291 SkTestTypeface* fFace; | 289 SkTestTypeface* fFace; |
| 292 SkMatrix fMatrix; | 290 SkMatrix fMatrix; |
| 293 }; | 291 }; |
| 294 | 292 |
| 295 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc)
const { | 293 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc)
const { |
| 296 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d
esc)); | 294 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d
esc)); |
| 297 } | 295 } |
| OLD | NEW |