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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 } | 849 } |
850 | 850 |
851 /////////////////////////////////////////////////////////////////////////////// | 851 /////////////////////////////////////////////////////////////////////////////// |
852 | 852 |
853 class SkScalerContext_Empty : public SkScalerContext { | 853 class SkScalerContext_Empty : public SkScalerContext { |
854 public: | 854 public: |
855 SkScalerContext_Empty(SkTypeface* face, const SkDescriptor* desc) | 855 SkScalerContext_Empty(SkTypeface* face, const SkDescriptor* desc) |
856 : SkScalerContext(face, desc) {} | 856 : SkScalerContext(face, desc) {} |
857 | 857 |
858 protected: | 858 protected: |
859 virtual unsigned generateGlyphCount() SK_OVERRIDE { | 859 unsigned generateGlyphCount() SK_OVERRIDE { |
860 return 0; | 860 return 0; |
861 } | 861 } |
862 virtual uint16_t generateCharToGlyph(SkUnichar uni) SK_OVERRIDE { | 862 uint16_t generateCharToGlyph(SkUnichar uni) SK_OVERRIDE { |
863 return 0; | 863 return 0; |
864 } | 864 } |
865 virtual void generateAdvance(SkGlyph* glyph) SK_OVERRIDE { | 865 void generateAdvance(SkGlyph* glyph) SK_OVERRIDE { |
866 glyph->zeroMetrics(); | 866 glyph->zeroMetrics(); |
867 } | 867 } |
868 virtual void generateMetrics(SkGlyph* glyph) SK_OVERRIDE { | 868 void generateMetrics(SkGlyph* glyph) SK_OVERRIDE { |
869 glyph->zeroMetrics(); | 869 glyph->zeroMetrics(); |
870 } | 870 } |
871 virtual void generateImage(const SkGlyph& glyph) SK_OVERRIDE {} | 871 void generateImage(const SkGlyph& glyph) SK_OVERRIDE {} |
872 virtual void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE {} | 872 void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE {} |
873 virtual void generateFontMetrics(SkPaint::FontMetrics* metrics) SK_OVERRIDE
{ | 873 void generateFontMetrics(SkPaint::FontMetrics* metrics) SK_OVERRIDE { |
874 if (metrics) { | 874 if (metrics) { |
875 sk_bzero(metrics, sizeof(*metrics)); | 875 sk_bzero(metrics, sizeof(*metrics)); |
876 } | 876 } |
877 } | 877 } |
878 }; | 878 }; |
879 | 879 |
880 extern SkScalerContext* SkCreateColorScalerContext(const SkDescriptor* desc); | 880 extern SkScalerContext* SkCreateColorScalerContext(const SkDescriptor* desc); |
881 | 881 |
882 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 882 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
883 bool allowFailure) const { | 883 bool allowFailure) const { |
884 SkScalerContext* c = this->onCreateScalerContext(desc); | 884 SkScalerContext* c = this->onCreateScalerContext(desc); |
885 | 885 |
886 if (!c && !allowFailure) { | 886 if (!c && !allowFailure) { |
887 c = SkNEW_ARGS(SkScalerContext_Empty, | 887 c = SkNEW_ARGS(SkScalerContext_Empty, |
888 (const_cast<SkTypeface*>(this), desc)); | 888 (const_cast<SkTypeface*>(this), desc)); |
889 } | 889 } |
890 return c; | 890 return c; |
891 } | 891 } |
OLD | NEW |