Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: src/core/SkScalerContext.cpp

Issue 752183002: Use text size on Mac. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkScalerContext.h ('k') | src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkScalerContext.h ('k') | src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698