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

Side by Side Diff: include/core/SkMatrix.h

Issue 620973003: Revert of specialize setConcat for scale+translate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months 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 | « no previous file | src/core/SkMatrix.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 #ifndef SkMatrix_DEFINED 10 #ifndef SkMatrix_DEFINED
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 kAllMasks = kTranslate_Mask | 639 kAllMasks = kTranslate_Mask |
640 kScale_Mask | 640 kScale_Mask |
641 kAffine_Mask | 641 kAffine_Mask |
642 kPerspective_Mask | 642 kPerspective_Mask |
643 kRectStaysRect_Mask 643 kRectStaysRect_Mask
644 }; 644 };
645 645
646 SkScalar fMat[9]; 646 SkScalar fMat[9];
647 mutable SkTRacy<uint32_t> fTypeMask; 647 mutable SkTRacy<uint32_t> fTypeMask;
648 648
649 void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty) {
650 fMat[kMScaleX] = sx;
651 fMat[kMSkewX] = 0;
652 fMat[kMTransX] = tx;
653
654 fMat[kMSkewY] = 0;
655 fMat[kMScaleY] = sy;
656 fMat[kMTransY] = ty;
657
658 fMat[kMPersp0] = 0;
659 fMat[kMPersp1] = 0;
660 fMat[kMPersp2] = 1;
661
662 unsigned mask = 0;
663 if (sx != 1 || sy != 1) {
664 mask |= kScale_Mask;
665 }
666 if (tx || ty) {
667 mask |= kTranslate_Mask;
668 }
669 this->setTypeMask(mask | kRectStaysRect_Mask);
670 }
671
672 uint8_t computeTypeMask() const; 649 uint8_t computeTypeMask() const;
673 uint8_t computePerspectiveTypeMask() const; 650 uint8_t computePerspectiveTypeMask() const;
674 651
675 void setTypeMask(int mask) { 652 void setTypeMask(int mask) {
676 // allow kUnknown or a valid mask 653 // allow kUnknown or a valid mask
677 SkASSERT(kUnknown_Mask == mask || (mask & kAllMasks) == mask || 654 SkASSERT(kUnknown_Mask == mask || (mask & kAllMasks) == mask ||
678 ((kUnknown_Mask | kOnlyPerspectiveValid_Mask) & mask) 655 ((kUnknown_Mask | kOnlyPerspectiveValid_Mask) & mask)
679 == (kUnknown_Mask | kOnlyPerspectiveValid_Mask)); 656 == (kUnknown_Mask | kOnlyPerspectiveValid_Mask));
680 fTypeMask = SkToU8(mask); 657 fTypeMask = SkToU8(mask);
681 } 658 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], 711 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[],
735 int count); 712 int count);
736 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); 713 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int);
737 714
738 static const MapPtsProc gMapPtsProcs[]; 715 static const MapPtsProc gMapPtsProcs[];
739 716
740 friend class SkPerspIter; 717 friend class SkPerspIter;
741 }; 718 };
742 719
743 #endif 720 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkMatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698