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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 fMatrix22.yy = SkScalarToFixed(SkScalarMul(m.getScaleY(), inv)); | 787 fMatrix22.yy = SkScalarToFixed(SkScalarMul(m.getScaleY(), inv)); |
788 | 788 |
789 fMatrix22Scalar.setScaleX(SkScalarMul(m.getScaleX(), inv)); | 789 fMatrix22Scalar.setScaleX(SkScalarMul(m.getScaleX(), inv)); |
790 fMatrix22Scalar.setSkewX(-SkScalarMul(m.getSkewX(), inv)); | 790 fMatrix22Scalar.setSkewX(-SkScalarMul(m.getSkewX(), inv)); |
791 fMatrix22Scalar.setSkewY(-SkScalarMul(m.getSkewY(), inv)); | 791 fMatrix22Scalar.setSkewY(-SkScalarMul(m.getSkewY(), inv)); |
792 fMatrix22Scalar.setScaleY(SkScalarMul(m.getScaleY(), inv)); | 792 fMatrix22Scalar.setScaleY(SkScalarMul(m.getScaleY(), inv)); |
793 } else { | 793 } else { |
794 fMatrix22.xx = fMatrix22.yy = SK_Fixed1; | 794 fMatrix22.xx = fMatrix22.yy = SK_Fixed1; |
795 fMatrix22.xy = fMatrix22.yx = 0; | 795 fMatrix22.xy = fMatrix22.yx = 0; |
796 } | 796 } |
797 | |
798 #ifdef SK_SUPPORT_HINTING_SCALE_FACTOR | |
799 if (fRec.getHinting() == SkPaint::kNo_Hinting) { | |
800 fScale.set(sx, sy); | |
801 fScaleX = SkScalarToFixed(sx); | |
802 fScaleY = SkScalarToFixed(sy); | |
803 } else { | |
804 SkScalar hintingScaleFactor = fRec.fHintingScaleFactor; | |
805 | |
806 fScale.set(sx / hintingScaleFactor, sy / hintingScaleFactor); | |
807 fScaleX = SkScalarToFixed(fScale.fX); | |
808 fScaleY = SkScalarToFixed(fScale.fY); | |
809 | |
810 fMatrix22.xx *= hintingScaleFactor; | |
811 fMatrix22.xy *= hintingScaleFactor; | |
812 fMatrix22.yx *= hintingScaleFactor; | |
813 fMatrix22.yy *= hintingScaleFactor; | |
814 | |
815 fMatrix22Scalar.setScaleX(fMatrix22Scalar.getScaleX() * hintingScaleFact
or); | |
816 fMatrix22Scalar.setSkewX(fMatrix22Scalar..getSkewX() * hintingScaleFacto
r); | |
817 fMatrix22Scalar.setSkewY(fMatrix22Scalar..getSkewY() * hintingScaleFacto
r); | |
818 fMatrix22Scalar.setScaleY(fMatrix22Scalar..getScaleY() * hintingScaleFac
tor); | |
819 } | |
820 #else | |
821 fScale.set(sx, sy); | 797 fScale.set(sx, sy); |
822 fScaleX = SkScalarToFixed(sx); | 798 fScaleX = SkScalarToFixed(sx); |
823 fScaleY = SkScalarToFixed(sy); | 799 fScaleY = SkScalarToFixed(sy); |
824 #endif | |
825 | 800 |
826 fLCDIsVert = SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag); | 801 fLCDIsVert = SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag); |
827 | 802 |
828 // compute the flags we send to Load_Glyph | 803 // compute the flags we send to Load_Glyph |
829 { | 804 { |
830 FT_Int32 loadFlags = FT_LOAD_DEFAULT; | 805 FT_Int32 loadFlags = FT_LOAD_DEFAULT; |
831 bool linearMetrics = SkToBool(fRec.fFlags & SkScalerContext::kSubpixelPo
sitioning_Flag); | 806 bool linearMetrics = SkToBool(fRec.fFlags & SkScalerContext::kSubpixelPo
sitioning_Flag); |
832 | 807 |
833 if (SkMask::kBW_Format == fRec.fMaskFormat) { | 808 if (SkMask::kBW_Format == fRec.fMaskFormat) { |
834 // See http://code.google.com/p/chromium/issues/detail?id=43252#c24 | 809 // See http://code.google.com/p/chromium/issues/detail?id=43252#c24 |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 *style = (SkTypeface::Style) tempStyle; | 1501 *style = (SkTypeface::Style) tempStyle; |
1527 } | 1502 } |
1528 if (isFixedPitch) { | 1503 if (isFixedPitch) { |
1529 *isFixedPitch = FT_IS_FIXED_WIDTH(face); | 1504 *isFixedPitch = FT_IS_FIXED_WIDTH(face); |
1530 } | 1505 } |
1531 | 1506 |
1532 FT_Done_Face(face); | 1507 FT_Done_Face(face); |
1533 FT_Done_FreeType(library); | 1508 FT_Done_FreeType(library); |
1534 return true; | 1509 return true; |
1535 } | 1510 } |
OLD | NEW |