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

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

Issue 1006173005: add SkMatrix::decomposeScale (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add unittest Created 5 years, 9 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/SkBitmapProcState.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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 SkScalar getMaxScale() const; 617 SkScalar getMaxScale() const;
618 618
619 /** 619 /**
620 * Gets both the min and max scale factors. The min scale factor is scaleFac tors[0] and the max 620 * Gets both the min and max scale factors. The min scale factor is scaleFac tors[0] and the max
621 * is scaleFactors[1]. If the matrix has perspective false will be returned and scaleFactors 621 * is scaleFactors[1]. If the matrix has perspective false will be returned and scaleFactors
622 * will be unchanged. 622 * will be unchanged.
623 */ 623 */
624 bool getMinMaxScales(SkScalar scaleFactors[2]) const; 624 bool getMinMaxScales(SkScalar scaleFactors[2]) const;
625 625
626 /** 626 /**
627 * Attempt to decompose this matrix into a scale-only component and whateve r remains, where
628 * the scale component is to be applied first.
629 *
630 * M -> Remaining * Scale
631 *
632 * On success, return true and assign the scale and remaining components (a ssuming their
633 * respective parameters are not null). On failure return false and ignore the parameters.
634 *
635 * Possible reasons to fail: perspective, one or more scale factors are zer o.
636 */
637 bool decomposeScale(SkSize* scale, SkMatrix* remaining = NULL) const;
638
639 /**
627 * Return a reference to a const identity matrix 640 * Return a reference to a const identity matrix
628 */ 641 */
629 static const SkMatrix& I(); 642 static const SkMatrix& I();
630 643
631 /** 644 /**
632 * Return a reference to a const matrix that is "invalid", one that could 645 * Return a reference to a const matrix that is "invalid", one that could
633 * never be used. 646 * never be used.
634 */ 647 */
635 static const SkMatrix& InvalidMatrix(); 648 static const SkMatrix& InvalidMatrix();
636 649
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], 784 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[],
772 int count); 785 int count);
773 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); 786 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int);
774 787
775 static const MapPtsProc gMapPtsProcs[]; 788 static const MapPtsProc gMapPtsProcs[];
776 789
777 friend class SkPerspIter; 790 friend class SkPerspIter;
778 }; 791 };
779 792
780 #endif 793 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmapProcState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698