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 "SkAdvancedTypefaceMetrics.h" | 8 #include "SkAdvancedTypefaceMetrics.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
690 } | 690 } |
691 | 691 |
692 void SkTypeface_FreeType::onFilterRec(SkScalerContextRec* rec) const { | 692 void SkTypeface_FreeType::onFilterRec(SkScalerContextRec* rec) const { |
693 //BOGUS: http://code.google.com/p/chromium/issues/detail?id=121119 | 693 //BOGUS: http://code.google.com/p/chromium/issues/detail?id=121119 |
694 //Cap the requested size as larger sizes give bogus values. | 694 //Cap the requested size as larger sizes give bogus values. |
695 //Remove when http://code.google.com/p/skia/issues/detail?id=554 is fixed. | 695 //Remove when http://code.google.com/p/skia/issues/detail?id=554 is fixed. |
696 if (rec->fTextSize > SkIntToScalar(1 << 14)) { | 696 if (rec->fTextSize > SkIntToScalar(1 << 14)) { |
697 rec->fTextSize = SkIntToScalar(1 << 14); | 697 rec->fTextSize = SkIntToScalar(1 << 14); |
698 } | 698 } |
699 | 699 |
700 AutoFTAccess fta(this); | 700 { |
701 if (!gFTLibrary->isLCDSupported() && isLCD(*rec)) { | 701 // TODO: re-work so that FreeType is set-up and selected by the SkFontMg r. |
702 // If the runtime Freetype library doesn't support LCD mode, we disable | 702 SkAutoMutexAcquire ama(gFTMutex); |
703 // it here. | 703 ref_ft_library(); |
704 rec->fMaskFormat = SkMask::kA8_Format; | 704 if (!gFTLibrary->isLCDSupported() && isLCD(*rec)) { |
reed1
2015/01/21 19:29:34
maybe move the isLCD() check outside of the mutex-
| |
705 // If the runtime Freetype library doesn't support LCD, disable it h ere. | |
706 rec->fMaskFormat = SkMask::kA8_Format; | |
707 } | |
708 unref_ft_library(); | |
705 } | 709 } |
706 | 710 |
707 SkPaint::Hinting h = rec->getHinting(); | 711 SkPaint::Hinting h = rec->getHinting(); |
708 if (SkPaint::kFull_Hinting == h && !isLCD(*rec)) { | 712 if (SkPaint::kFull_Hinting == h && !isLCD(*rec)) { |
709 // collapse full->normal hinting if we're not doing LCD | 713 // collapse full->normal hinting if we're not doing LCD |
710 h = SkPaint::kNormal_Hinting; | 714 h = SkPaint::kNormal_Hinting; |
711 } | 715 } |
712 if ((rec->fFlags & SkScalerContext::kSubpixelPositioning_Flag)) { | 716 if ((rec->fFlags & SkScalerContext::kSubpixelPositioning_Flag)) { |
713 if (SkPaint::kNo_Hinting != h) { | 717 if (SkPaint::kNo_Hinting != h) { |
714 h = SkPaint::kSlight_Hinting; | 718 h = SkPaint::kSlight_Hinting; |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1717 if (style) { | 1721 if (style) { |
1718 *style = SkFontStyle(weight, width, slant); | 1722 *style = SkFontStyle(weight, width, slant); |
1719 } | 1723 } |
1720 if (isFixedPitch) { | 1724 if (isFixedPitch) { |
1721 *isFixedPitch = FT_IS_FIXED_WIDTH(face); | 1725 *isFixedPitch = FT_IS_FIXED_WIDTH(face); |
1722 } | 1726 } |
1723 | 1727 |
1724 FT_Done_Face(face); | 1728 FT_Done_Face(face); |
1725 return true; | 1729 return true; |
1726 } | 1730 } |
OLD | NEW |