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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
717 this->getSingleMatrix(&A); | 717 this->getSingleMatrix(&A); |
718 | 718 |
719 // 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. |
720 if (A_out) { | 720 if (A_out) { |
721 *A_out = A; | 721 *A_out = A; |
722 } | 722 } |
723 | 723 |
724 // If the 'total' matrix is singular, set the 'scale' to something finite an d zero the matrices. | 724 // If the 'total' matrix is singular, set the 'scale' to something finite an d zero the matrices. |
725 // All underlying ports have issues with zero text size, so use the matricie s to zero. | 725 // All underlying ports have issues with zero text size, so use the matricie s to zero. |
726 | 726 |
727 // Map the vectors [1,1] and [1,-1] (the EM) through the 'total' matrix. | 727 // Map the vectors [0,1], [1,0], [1,1] and [1,-1] (the EM) through the 'tota l' matrix. |
728 // If the length of one of these vectors is less than 1/256 then an EM filli ng square will | 728 // If the length of one of these vectors is less than 1/256 then an EM filli ng square will |
729 // never affect any pixels. | 729 // never affect any pixels. |
730 SkVector diag[2] = { { A.getScaleX() + A.getSkewX(), A.getScaleY() + A.getSk ewY() }, | 730 SkVector diag[4] = { { A.getScaleX() , A.getSk ewY() }, |
jvanverth1
2016/02/25 19:00:33
I think you're multiplying these as row vectors, b
| |
731 { A.getSkewX(), A.getScaleY() }, | |
732 { A.getScaleX() + A.getSkewX(), A.getScaleY() + A.getSk ewY() }, | |
731 { A.getScaleX() - A.getSkewX(), A.getScaleY() - A.getSk ewY() }, }; | 733 { A.getScaleX() - A.getSkewX(), A.getScaleY() - A.getSk ewY() }, }; |
732 if (diag[0].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero || | 734 if (diag[0].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero || |
733 diag[1].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero) | 735 diag[1].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero || |
736 diag[2].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero || | |
737 diag[3].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero) | |
734 { | 738 { |
735 s->fX = SK_Scalar1; | 739 s->fX = SK_Scalar1; |
736 s->fY = SK_Scalar1; | 740 s->fY = SK_Scalar1; |
737 sA->setScale(0, 0); | 741 sA->setScale(0, 0); |
738 if (GsA) { | 742 if (GsA) { |
739 GsA->setScale(0, 0); | 743 GsA->setScale(0, 0); |
740 } | 744 } |
741 if (G_inv) { | 745 if (G_inv) { |
742 G_inv->reset(); | 746 G_inv->reset(); |
743 } | 747 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
868 | 872 |
869 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 873 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
870 bool allowFailure) const { | 874 bool allowFailure) const { |
871 SkScalerContext* c = this->onCreateScalerContext(desc); | 875 SkScalerContext* c = this->onCreateScalerContext(desc); |
872 | 876 |
873 if (!c && !allowFailure) { | 877 if (!c && !allowFailure) { |
874 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); | 878 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); |
875 } | 879 } |
876 return c; | 880 return c; |
877 } | 881 } |
OLD | NEW |