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

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

Issue 1532963002: Make SkMatrix::get*Scale[s]() fail on NaN (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add SK_WARN_UNUSED_RESULT Created 5 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 | « 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 * @return number of bytes read (must be a multiple of 4) or 628 * @return number of bytes read (must be a multiple of 4) or
629 * 0 if there was not enough memory available 629 * 0 if there was not enough memory available
630 */ 630 */
631 size_t readFromMemory(const void* buffer, size_t length); 631 size_t readFromMemory(const void* buffer, size_t length);
632 632
633 void dump() const; 633 void dump() const;
634 void toString(SkString*) const; 634 void toString(SkString*) const;
635 635
636 /** 636 /**
637 * Calculates the minimum scaling factor of the matrix as computed from the SVD of the upper 637 * Calculates the minimum scaling factor of the matrix as computed from the SVD of the upper
638 * left 2x2. If the matrix has perspective -1 is returned. 638 * left 2x2. If the max scale factor cannot be computed (for example overflo w or perspective)
639 * -1 is returned.
639 * 640 *
640 * @return minumum scale factor 641 * @return minimum scale factor
641 */ 642 */
642 SkScalar getMinScale() const; 643 SkScalar getMinScale() const;
643 644
644 /** 645 /**
645 * Calculates the maximum scaling factor of the matrix as computed from the SVD of the upper 646 * Calculates the maximum scaling factor of the matrix as computed from the SVD of the upper
646 * left 2x2. If the matrix has perspective -1 is returned. 647 * left 2x2. If the max scale factor cannot be computed (for example overflo w or perspective)
648 * -1 is returned.
647 * 649 *
648 * @return maximum scale factor 650 * @return maximum scale factor
649 */ 651 */
650 SkScalar getMaxScale() const; 652 SkScalar getMaxScale() const;
651 653
652 /** 654 /**
653 * Gets both the min and max scale factors. The min scale factor is scaleFac tors[0] and the max 655 * Gets both the min and max scale factors. The min scale factor is scaleFac tors[0] and the max
654 * is scaleFactors[1]. If the matrix has perspective false will be returned and scaleFactors 656 * is scaleFactors[1]. If the min/max scale factors cannot be computed false is returned and the
655 * will be unchanged. 657 * values of scaleFactors[] are undefined.
656 */ 658 */
657 bool getMinMaxScales(SkScalar scaleFactors[2]) const; 659 bool SK_WARN_UNUSED_RESULT getMinMaxScales(SkScalar scaleFactors[2]) const;
658 660
659 /** 661 /**
660 * Attempt to decompose this matrix into a scale-only component and whateve r remains, where 662 * Attempt to decompose this matrix into a scale-only component and whateve r remains, where
661 * the scale component is to be applied first. 663 * the scale component is to be applied first.
662 * 664 *
663 * M -> Remaining * Scale 665 * M -> Remaining * Scale
664 * 666 *
665 * On success, return true and assign the scale and remaining components (a ssuming their 667 * On success, return true and assign the scale and remaining components (a ssuming their
666 * respective parameters are not null). On failure return false and ignore the parameters. 668 * respective parameters are not null). On failure return false and ignore the parameters.
667 * 669 *
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 825
824 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int ); 826 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int );
825 827
826 static const MapPtsProc gMapPtsProcs[]; 828 static const MapPtsProc gMapPtsProcs[];
827 829
828 friend class SkPerspIter; 830 friend class SkPerspIter;
829 }; 831 };
830 SK_END_REQUIRE_DENSE 832 SK_END_REQUIRE_DENSE
831 833
832 #endif 834 #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