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, 1); | 696 0, 0, 1); |
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 | |
707 void SkScalerContextRec::getSingleMatrix(SkMatrix* m) const { | 703 void SkScalerContextRec::getSingleMatrix(SkMatrix* m) const { |
708 this->getLocalMatrix(m); | 704 this->getLocalMatrix(m); |
709 | 705 |
710 // now concat the device matrix | 706 // now concat the device matrix |
711 SkMatrix deviceMatrix; | 707 SkMatrix deviceMatrix; |
712 this->getMatrixFrom2x2(&deviceMatrix); | 708 this->getMatrixFrom2x2(&deviceMatrix); |
713 m->postConcat(deviceMatrix); | 709 m->postConcat(deviceMatrix); |
714 } | 710 } |
715 | 711 |
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 | |
725 void SkScalerContextRec::computeMatrices(PreMatrixScale preMatrixScale, SkVector
* s, SkMatrix* sA, | 712 void SkScalerContextRec::computeMatrices(PreMatrixScale preMatrixScale, SkVector
* s, SkMatrix* sA, |
726 SkMatrix* GsA, SkMatrix* G_inv, SkMatri
x* A_out) | 713 SkMatrix* GsA, SkMatrix* G_inv, SkMatri
x* A_out) |
727 { | 714 { |
728 // A is the 'total' matrix. | 715 // A is the 'total' matrix. |
729 SkMatrix A; | 716 SkMatrix A; |
730 this->getSingleMatrix(&A); | 717 this->getSingleMatrix(&A); |
731 | 718 |
732 // The caller may find the 'total' matrix useful when dealing directly with
EM sizes. | 719 // The caller may find the 'total' matrix useful when dealing directly with
EM sizes. |
733 if (A_out) { | 720 if (A_out) { |
734 *A_out = A; | 721 *A_out = A; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 869 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
883 bool allowFailure) const { | 870 bool allowFailure) const { |
884 SkScalerContext* c = this->onCreateScalerContext(desc); | 871 SkScalerContext* c = this->onCreateScalerContext(desc); |
885 | 872 |
886 if (!c && !allowFailure) { | 873 if (!c && !allowFailure) { |
887 c = SkNEW_ARGS(SkScalerContext_Empty, | 874 c = SkNEW_ARGS(SkScalerContext_Empty, |
888 (const_cast<SkTypeface*>(this), desc)); | 875 (const_cast<SkTypeface*>(this), desc)); |
889 } | 876 } |
890 return c; | 877 return c; |
891 } | 878 } |
OLD | NEW |