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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 void SkScalerContextRec::getMatrixFrom2x2(SkMatrix* dst) const { | 693 void SkScalerContextRec::getMatrixFrom2x2(SkMatrix* dst) const { |
694 dst->setAll(fPost2x2[0][0], fPost2x2[0][1], 0, | 694 dst->setAll(fPost2x2[0][0], fPost2x2[0][1], 0, |
695 fPost2x2[1][0], fPost2x2[1][1], 0, | 695 fPost2x2[1][0], fPost2x2[1][1], 0, |
696 0, 0, SkScalarToPersp(SK_Scalar1)); | 696 0, 0, SkScalarToPersp(SK_Scalar1)); |
697 } | 697 } |
698 | 698 |
699 void SkScalerContextRec::getLocalMatrix(SkMatrix* m) const { | 699 void SkScalerContextRec::getLocalMatrix(SkMatrix* m) const { |
700 SkPaint::SetTextMatrix(m, fTextSize, fPreScaleX, fPreSkewX); | 700 SkPaint::SetTextMatrix(m, fTextSize, fPreScaleX, fPreSkewX); |
701 } | 701 } |
702 | 702 |
| 703 void SkScalerContextRec::getLocalMatrixWithoutTextSize(SkMatrix* m) const { |
| 704 SkPaint::SetTextMatrix(m, SK_Scalar1, fPreScaleX, fPreSkewX); |
| 705 } |
| 706 |
703 void SkScalerContextRec::getSingleMatrix(SkMatrix* m) const { | 707 void SkScalerContextRec::getSingleMatrix(SkMatrix* m) const { |
704 this->getLocalMatrix(m); | 708 this->getLocalMatrix(m); |
705 | 709 |
706 // now concat the device matrix | 710 // now concat the device matrix |
707 SkMatrix deviceMatrix; | 711 SkMatrix deviceMatrix; |
708 this->getMatrixFrom2x2(&deviceMatrix); | 712 this->getMatrixFrom2x2(&deviceMatrix); |
709 m->postConcat(deviceMatrix); | 713 m->postConcat(deviceMatrix); |
710 } | 714 } |
711 | 715 |
| 716 void SkScalerContextRec::getSingleMatrixWithoutTextSize(SkMatrix* m) const { |
| 717 this->getLocalMatrixWithoutTextSize(m); |
| 718 |
| 719 // now concat the device matrix |
| 720 SkMatrix deviceMatrix; |
| 721 this->getMatrixFrom2x2(&deviceMatrix); |
| 722 m->postConcat(deviceMatrix); |
| 723 } |
| 724 |
712 SkAxisAlignment SkComputeAxisAlignmentForHText(const SkMatrix& matrix) { | 725 SkAxisAlignment SkComputeAxisAlignmentForHText(const SkMatrix& matrix) { |
713 SkASSERT(!matrix.hasPerspective()); | 726 SkASSERT(!matrix.hasPerspective()); |
714 | 727 |
715 if (0 == matrix[SkMatrix::kMSkewY]) { | 728 if (0 == matrix[SkMatrix::kMSkewY]) { |
716 return kX_SkAxisAlignment; | 729 return kX_SkAxisAlignment; |
717 } | 730 } |
718 if (0 == matrix[SkMatrix::kMScaleX]) { | 731 if (0 == matrix[SkMatrix::kMScaleX]) { |
719 return kY_SkAxisAlignment; | 732 return kY_SkAxisAlignment; |
720 } | 733 } |
721 return kNone_SkAxisAlignment; | 734 return kNone_SkAxisAlignment; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 770 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
758 bool allowFailure) const { | 771 bool allowFailure) const { |
759 SkScalerContext* c = this->onCreateScalerContext(desc); | 772 SkScalerContext* c = this->onCreateScalerContext(desc); |
760 | 773 |
761 if (!c && !allowFailure) { | 774 if (!c && !allowFailure) { |
762 c = SkNEW_ARGS(SkScalerContext_Empty, | 775 c = SkNEW_ARGS(SkScalerContext_Empty, |
763 (const_cast<SkTypeface*>(this), desc)); | 776 (const_cast<SkTypeface*>(this), desc)); |
764 } | 777 } |
765 return c; | 778 return c; |
766 } | 779 } |
OLD | NEW |