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 #include <vector> | 9 #include <vector> |
10 #ifdef SK_BUILD_FOR_MAC | 10 #ifdef SK_BUILD_FOR_MAC |
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 memcpy(dstData, CFDataGetBytePtr(srcData) + offset, length); | 1825 memcpy(dstData, CFDataGetBytePtr(srcData) + offset, length); |
1826 } | 1826 } |
1827 return length; | 1827 return length; |
1828 } | 1828 } |
1829 | 1829 |
1830 SkScalerContext* SkTypeface_Mac::onCreateScalerContext(const SkDescriptor* desc)
const { | 1830 SkScalerContext* SkTypeface_Mac::onCreateScalerContext(const SkDescriptor* desc)
const { |
1831 return new SkScalerContext_Mac(const_cast<SkTypeface_Mac*>(this), desc); | 1831 return new SkScalerContext_Mac(const_cast<SkTypeface_Mac*>(this), desc); |
1832 } | 1832 } |
1833 | 1833 |
1834 void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const { | 1834 void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const { |
1835 unsigned flagsWeDontSupport = SkScalerContext::kDevKernText_Flag | | 1835 if (rec->fFlags & SkScalerContext::kLCD_BGROrder_Flag || |
1836 SkScalerContext::kAutohinting_Flag; | 1836 rec->fFlags & SkScalerContext::kLCD_Vertical_Flag) |
| 1837 { |
| 1838 rec->fMaskFormat = SkMask::kA8_Format; |
| 1839 // Render the glyphs as close as possible to what was requested. |
| 1840 // The above turns off subpixel rendering, but the user requested it. |
| 1841 // Normal hinting will cause the A8 masks to be generated from CoreGraph
ics subpixel masks. |
| 1842 // See comments below for more details. |
| 1843 rec->setHinting(SkPaint::kNormal_Hinting); |
| 1844 } |
| 1845 |
| 1846 unsigned flagsWeDontSupport = SkScalerContext::kDevKernText_Flag | |
| 1847 SkScalerContext::kAutohinting_Flag | |
| 1848 SkScalerContext::kLCD_BGROrder_Flag | |
| 1849 SkScalerContext::kLCD_Vertical_Flag; |
1837 | 1850 |
1838 rec->fFlags &= ~flagsWeDontSupport; | 1851 rec->fFlags &= ~flagsWeDontSupport; |
1839 | 1852 |
1840 bool lcdSupport = supports_LCD(); | 1853 bool lcdSupport = supports_LCD(); |
1841 | 1854 |
1842 // Only two levels of hinting are supported. | 1855 // Only two levels of hinting are supported. |
1843 // kNo_Hinting means avoid CoreGraphics outline dilation. | 1856 // kNo_Hinting means avoid CoreGraphics outline dilation. |
1844 // kNormal_Hinting means CoreGraphics outline dilation is allowed. | 1857 // kNormal_Hinting means CoreGraphics outline dilation is allowed. |
1845 // If there is no lcd support, hinting (dilation) cannot be supported. | 1858 // If there is no lcd support, hinting (dilation) cannot be supported. |
1846 SkPaint::Hinting hinting = rec->getHinting(); | 1859 SkPaint::Hinting hinting = rec->getHinting(); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 return NULL; | 2221 return NULL; |
2209 } | 2222 } |
2210 return create_from_dataProvider(pr); | 2223 return create_from_dataProvider(pr); |
2211 } | 2224 } |
2212 }; | 2225 }; |
2213 | 2226 |
2214 SkFontMgr* SkFontMgr::Factory() { | 2227 SkFontMgr* SkFontMgr::Factory() { |
2215 return SkNEW(SkFontMgr_Mac); | 2228 return SkNEW(SkFontMgr_Mac); |
2216 } | 2229 } |
2217 #endif | 2230 #endif |
OLD | NEW |