OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkTypes.h" // Keep this before any #ifdef ... | 8 #include "SkTypes.h" // Keep this before any #ifdef ... |
9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "SkFontDescriptor.h" | 28 #include "SkFontDescriptor.h" |
29 #include "SkFontMgr.h" | 29 #include "SkFontMgr.h" |
30 #include "SkGlyph.h" | 30 #include "SkGlyph.h" |
31 #include "SkMaskGamma.h" | 31 #include "SkMaskGamma.h" |
32 #include "SkMutex.h" | 32 #include "SkMutex.h" |
33 #include "SkOTTable_glyf.h" | 33 #include "SkOTTable_glyf.h" |
34 #include "SkOTTable_head.h" | 34 #include "SkOTTable_head.h" |
35 #include "SkOTTable_hhea.h" | 35 #include "SkOTTable_hhea.h" |
36 #include "SkOTTable_loca.h" | 36 #include "SkOTTable_loca.h" |
37 #include "SkOTUtils.h" | 37 #include "SkOTUtils.h" |
38 #include "SkOncePtr.h" | 38 #include "SkOnce.h" |
39 #include "SkPaint.h" | 39 #include "SkPaint.h" |
40 #include "SkPath.h" | 40 #include "SkPath.h" |
41 #include "SkSFNTHeader.h" | 41 #include "SkSFNTHeader.h" |
42 #include "SkStream.h" | 42 #include "SkStream.h" |
43 #include "SkString.h" | 43 #include "SkString.h" |
44 #include "SkTemplates.h" | 44 #include "SkTemplates.h" |
45 #include "SkTypefaceCache.h" | 45 #include "SkTypefaceCache.h" |
46 #include "SkTypeface_mac.h" | 46 #include "SkTypeface_mac.h" |
47 #include "SkUtils.h" | 47 #include "SkUtils.h" |
48 #include "SkUtils.h" | 48 #include "SkUtils.h" |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 | 771 |
772 typedef decltype(legacy_CTFontDrawGlyphs) CTFontDrawGlyphsProc; | 772 typedef decltype(legacy_CTFontDrawGlyphs) CTFontDrawGlyphsProc; |
773 | 773 |
774 static CTFontDrawGlyphsProc* choose_CTFontDrawGlyphs() { | 774 static CTFontDrawGlyphsProc* choose_CTFontDrawGlyphs() { |
775 if (void* real = dlsym(RTLD_DEFAULT, "CTFontDrawGlyphs")) { | 775 if (void* real = dlsym(RTLD_DEFAULT, "CTFontDrawGlyphs")) { |
776 return (CTFontDrawGlyphsProc*)real; | 776 return (CTFontDrawGlyphsProc*)real; |
777 } | 777 } |
778 return &legacy_CTFontDrawGlyphs; | 778 return &legacy_CTFontDrawGlyphs; |
779 } | 779 } |
780 | 780 |
781 SK_DECLARE_STATIC_ONCE_PTR(CTFontDrawGlyphsProc, gCTFontDrawGlyphs); | |
782 | |
783 CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph&
glyph, | 781 CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph&
glyph, |
784 CGGlyph glyphID, size_t* rowBytesPtr, | 782 CGGlyph glyphID, size_t* rowBytesPtr, |
785 bool generateA8FromLCD) { | 783 bool generateA8FromLCD) { |
786 auto ctFontDrawGlyphs = gCTFontDrawGlyphs.get(choose_CTFontDrawGlyphs); | 784 static SkOnce once; |
| 785 static CTFontDrawGlyphsProc* ctFontDrawGlyphs; |
| 786 once([]{ ctFontDrawGlyphs = choose_CTFontDrawGlyphs(); }); |
787 | 787 |
788 if (!fRGBSpace) { | 788 if (!fRGBSpace) { |
789 //It doesn't appear to matter what color space is specified. | 789 //It doesn't appear to matter what color space is specified. |
790 //Regular blends and antialiased text are always (s*a + d*(1-a)) | 790 //Regular blends and antialiased text are always (s*a + d*(1-a)) |
791 //and smoothed text is always g=2.0. | 791 //and smoothed text is always g=2.0. |
792 fRGBSpace.reset(CGColorSpaceCreateDeviceRGB()); | 792 fRGBSpace.reset(CGColorSpaceCreateDeviceRGB()); |
793 } | 793 } |
794 | 794 |
795 // default to kBW_Format | 795 // default to kBW_Format |
796 bool doAA = false; | 796 bool doAA = false; |
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 | 2575 |
2576 return SkSafeRef(GetDefaultFace()); | 2576 return SkSafeRef(GetDefaultFace()); |
2577 } | 2577 } |
2578 }; | 2578 }; |
2579 | 2579 |
2580 /////////////////////////////////////////////////////////////////////////////// | 2580 /////////////////////////////////////////////////////////////////////////////// |
2581 | 2581 |
2582 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } | 2582 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } |
2583 | 2583 |
2584 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 2584 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
OLD | NEW |