| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2013 Google Inc. | 2  * Copyright 2013 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 "SkGScalerContext.h" | 8 #include "SkGScalerContext.h" | 
| 9 #include "SkGlyph.h" | 9 #include "SkGlyph.h" | 
| 10 #include "SkPath.h" | 10 #include "SkPath.h" | 
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" | 
| 12 | 12 | 
| 13 class SkGScalerContext : public SkScalerContext { | 13 class SkGScalerContext : public SkScalerContext { | 
| 14 public: | 14 public: | 
| 15     SkGScalerContext(SkGTypeface*, const SkDescriptor*); | 15     SkGScalerContext(SkGTypeface*, const SkDescriptor*); | 
| 16     virtual ~SkGScalerContext(); | 16     virtual ~SkGScalerContext(); | 
| 17 | 17 | 
| 18 protected: | 18 protected: | 
| 19     virtual unsigned generateGlyphCount() SK_OVERRIDE; | 19     virtual unsigned generateGlyphCount() SK_OVERRIDE; | 
| 20     virtual uint16_t generateCharToGlyph(SkUnichar) SK_OVERRIDE; | 20     virtual uint16_t generateCharToGlyph(SkUnichar) SK_OVERRIDE; | 
| 21     virtual void generateAdvance(SkGlyph*) SK_OVERRIDE; | 21     virtual void generateAdvance(SkGlyph*) SK_OVERRIDE; | 
| 22     virtual void generateMetrics(SkGlyph*) SK_OVERRIDE; | 22     virtual void generateMetrics(SkGlyph*) SK_OVERRIDE; | 
| 23     virtual void generateImage(const SkGlyph&) SK_OVERRIDE; | 23     virtual void generateImage(const SkGlyph&) SK_OVERRIDE; | 
| 24     virtual void generatePath(const SkGlyph&, SkPath*) SK_OVERRIDE; | 24     virtual void generatePath(const SkGlyph&, SkPath*) SK_OVERRIDE; | 
| 25     virtual void generateFontMetrics(SkPaint::FontMetrics* mX, | 25     virtual void generateFontMetrics(SkPaint::FontMetrics*) SK_OVERRIDE; | 
| 26                                      SkPaint::FontMetrics* mY) SK_OVERRIDE; |  | 
| 27 | 26 | 
| 28 private: | 27 private: | 
| 29     SkGTypeface*     fFace; | 28     SkGTypeface*     fFace; | 
| 30     SkScalerContext* fProxy; | 29     SkScalerContext* fProxy; | 
| 31     SkMatrix         fMatrix; | 30     SkMatrix         fMatrix; | 
| 32 }; | 31 }; | 
| 33 | 32 | 
| 34 #define STD_SIZE    1 | 33 #define STD_SIZE    1 | 
| 35 | 34 | 
| 36 #include "SkDescriptor.h" | 35 #include "SkDescriptor.h" | 
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 131     } else { | 130     } else { | 
| 132         fProxy->getImage(glyph); | 131         fProxy->getImage(glyph); | 
| 133     } | 132     } | 
| 134 } | 133 } | 
| 135 | 134 | 
| 136 void SkGScalerContext::generatePath(const SkGlyph& glyph, SkPath* path) { | 135 void SkGScalerContext::generatePath(const SkGlyph& glyph, SkPath* path) { | 
| 137     fProxy->getPath(glyph, path); | 136     fProxy->getPath(glyph, path); | 
| 138     path->transform(fMatrix); | 137     path->transform(fMatrix); | 
| 139 } | 138 } | 
| 140 | 139 | 
| 141 void SkGScalerContext::generateFontMetrics(SkPaint::FontMetrics*, | 140 void SkGScalerContext::generateFontMetrics(SkPaint::FontMetrics* metrics) { | 
| 142                                            SkPaint::FontMetrics* metrics) { |  | 
| 143     fProxy->getFontMetrics(metrics); | 141     fProxy->getFontMetrics(metrics); | 
| 144     if (metrics) { | 142     if (metrics) { | 
| 145         SkScalar scale = fMatrix.getScaleY(); | 143         SkScalar scale = fMatrix.getScaleY(); | 
| 146         metrics->fTop = SkScalarMul(metrics->fTop, scale); | 144         metrics->fTop = SkScalarMul(metrics->fTop, scale); | 
| 147         metrics->fAscent = SkScalarMul(metrics->fAscent, scale); | 145         metrics->fAscent = SkScalarMul(metrics->fAscent, scale); | 
| 148         metrics->fDescent = SkScalarMul(metrics->fDescent, scale); | 146         metrics->fDescent = SkScalarMul(metrics->fDescent, scale); | 
| 149         metrics->fBottom = SkScalarMul(metrics->fBottom, scale); | 147         metrics->fBottom = SkScalarMul(metrics->fBottom, scale); | 
| 150         metrics->fLeading = SkScalarMul(metrics->fLeading, scale); | 148         metrics->fLeading = SkScalarMul(metrics->fLeading, scale); | 
| 151         metrics->fAvgCharWidth = SkScalarMul(metrics->fAvgCharWidth, scale); | 149         metrics->fAvgCharWidth = SkScalarMul(metrics->fAvgCharWidth, scale); | 
| 152         metrics->fXMin = SkScalarMul(metrics->fXMin, scale); | 150         metrics->fXMin = SkScalarMul(metrics->fXMin, scale); | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 255 | 253 | 
| 256     friend class SkGFontBuilder; | 254     friend class SkGFontBuilder; | 
| 257     SkGFont(int count, Glyph* array); | 255     SkGFont(int count, Glyph* array); | 
| 258 }; | 256 }; | 
| 259 | 257 | 
| 260 class SkGFontBuilder { | 258 class SkGFontBuilder { | 
| 261 public: | 259 public: | 
| 262 | 260 | 
| 263 }; | 261 }; | 
| 264 #endif | 262 #endif | 
| OLD | NEW | 
|---|