OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkScalerContext.h" | 10 #include "SkScalerContext.h" |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 } | 792 } |
793 } | 793 } |
794 } | 794 } |
795 } | 795 } |
796 | 796 |
797 void SkScalerContext::getPath(const SkGlyph& glyph, SkPath* path) { | 797 void SkScalerContext::getPath(const SkGlyph& glyph, SkPath* path) { |
798 this->internalGetPath(glyph, NULL, path, NULL); | 798 this->internalGetPath(glyph, NULL, path, NULL); |
799 } | 799 } |
800 | 800 |
801 void SkScalerContext::getFontMetrics(SkPaint::FontMetrics* fm) { | 801 void SkScalerContext::getFontMetrics(SkPaint::FontMetrics* fm) { |
802 // All of this complexity should go away when we change generateFontMetrics | 802 this->generateFontMetrics(fm); |
803 // to just take one parameter (since it knows if it is vertical or not) | |
804 SkPaint::FontMetrics* mx = NULL; | |
805 SkPaint::FontMetrics* my = NULL; | |
806 if (fRec.fFlags & kVertical_Flag) { | |
807 mx = fm; | |
808 } else { | |
809 my = fm; | |
810 } | |
811 this->generateFontMetrics(mx, my); | |
812 } | 803 } |
813 | 804 |
814 SkUnichar SkScalerContext::generateGlyphToChar(uint16_t glyph) { | 805 SkUnichar SkScalerContext::generateGlyphToChar(uint16_t glyph) { |
815 return 0; | 806 return 0; |
816 } | 807 } |
817 | 808 |
818 /////////////////////////////////////////////////////////////////////////////// | 809 /////////////////////////////////////////////////////////////////////////////// |
819 | 810 |
820 void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath, | 811 void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath, |
821 SkPath* devPath, SkMatrix* fillToDevMatrix) { | 812 SkPath* devPath, SkMatrix* fillToDevMatrix) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 return 0; | 948 return 0; |
958 } | 949 } |
959 virtual void generateAdvance(SkGlyph* glyph) SK_OVERRIDE { | 950 virtual void generateAdvance(SkGlyph* glyph) SK_OVERRIDE { |
960 glyph->zeroMetrics(); | 951 glyph->zeroMetrics(); |
961 } | 952 } |
962 virtual void generateMetrics(SkGlyph* glyph) SK_OVERRIDE { | 953 virtual void generateMetrics(SkGlyph* glyph) SK_OVERRIDE { |
963 glyph->zeroMetrics(); | 954 glyph->zeroMetrics(); |
964 } | 955 } |
965 virtual void generateImage(const SkGlyph& glyph) SK_OVERRIDE {} | 956 virtual void generateImage(const SkGlyph& glyph) SK_OVERRIDE {} |
966 virtual void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE {} | 957 virtual void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE {} |
967 virtual void generateFontMetrics(SkPaint::FontMetrics* mx, | 958 virtual void generateFontMetrics(SkPaint::FontMetrics* metrics) SK_OVERRIDE
{ |
968 SkPaint::FontMetrics* my) SK_OVERRIDE { | 959 if (metrics) { |
969 if (mx) { | 960 sk_bzero(metrics, sizeof(*metrics)); |
970 sk_bzero(mx, sizeof(*mx)); | |
971 } | |
972 if (my) { | |
973 sk_bzero(my, sizeof(*my)); | |
974 } | 961 } |
975 } | 962 } |
976 }; | 963 }; |
977 | 964 |
978 extern SkScalerContext* SkCreateColorScalerContext(const SkDescriptor* desc); | 965 extern SkScalerContext* SkCreateColorScalerContext(const SkDescriptor* desc); |
979 | 966 |
980 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 967 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
981 bool allowFailure) const { | 968 bool allowFailure) const { |
982 SkScalerContext* c = this->onCreateScalerContext(desc); | 969 SkScalerContext* c = this->onCreateScalerContext(desc); |
983 | 970 |
984 if (!c && !allowFailure) { | 971 if (!c && !allowFailure) { |
985 c = SkNEW_ARGS(SkScalerContext_Empty, | 972 c = SkNEW_ARGS(SkScalerContext_Empty, |
986 (const_cast<SkTypeface*>(this), desc)); | 973 (const_cast<SkTypeface*>(this), desc)); |
987 } | 974 } |
988 return c; | 975 return c; |
989 } | 976 } |
OLD | NEW |