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

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

Issue 298473002: Add function to get both min and max scale factors from matrix (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Address comments Created 6 years, 7 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 | Annotate | Revision Log
« 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 * @param length Amount of memory available in the buffer 556 * @param length Amount of memory available in the buffer
557 * @return number of bytes read (must be a multiple of 4) or 557 * @return number of bytes read (must be a multiple of 4) or
558 * 0 if there was not enough memory available 558 * 0 if there was not enough memory available
559 */ 559 */
560 size_t readFromMemory(const void* buffer, size_t length); 560 size_t readFromMemory(const void* buffer, size_t length);
561 561
562 SkDEVCODE(void dump() const;) 562 SkDEVCODE(void dump() const;)
563 SK_TO_STRING_NONVIRT() 563 SK_TO_STRING_NONVIRT()
564 564
565 /** 565 /**
566 * Calculates the minimum scaling factor of the matrix. If the matrix has 566 * Calculates the minimum scaling factor of the matrix as computed from the SVD of the upper
567 * perspective -1 is returned. 567 * left 2x2. If the matrix has perspective -1 is returned.
568 * 568 *
569 * @return minumum scale factor 569 * @return minumum scale factor
570 */ 570 */
571 SkScalar getMinScale() const; 571 SkScalar getMinScale() const;
572 572
573 /** 573 /**
574 * Calculates the maximum scale factor of the matrix. If the matrix has 574 * Calculates the maximum scaling factor of the matrix as computed from the SVD of the upper
575 * perspective -1 is returned. 575 * left 2x2. If the matrix has perspective -1 is returned.
576 * 576 *
577 * @return maximum scale factor 577 * @return maximum scale factor
578 */ 578 */
579 SkScalar getMaxScale() const; 579 SkScalar getMaxScale() const;
580 580
581 /** 581 /**
582 * Gets both the min and max scale factors. The min scale factor is scaleFac tors[0] and the max
583 * is scaleFactors[1]. If the matrix has perspective false will be returned and scaleFactors
584 * will be unchanged.
585 */
586 bool getMinMaxScales(SkScalar scaleFactors[2]) const;
587
588 /**
582 * Return a reference to a const identity matrix 589 * Return a reference to a const identity matrix
583 */ 590 */
584 static const SkMatrix& I(); 591 static const SkMatrix& I();
585 592
586 /** 593 /**
587 * Return a reference to a const matrix that is "invalid", one that could 594 * Return a reference to a const matrix that is "invalid", one that could
588 * never be used. 595 * never be used.
589 */ 596 */
590 static const SkMatrix& InvalidMatrix(); 597 static const SkMatrix& InvalidMatrix();
591 598
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], 710 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[],
704 int count); 711 int count);
705 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); 712 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int);
706 713
707 static const MapPtsProc gMapPtsProcs[]; 714 static const MapPtsProc gMapPtsProcs[];
708 715
709 friend class SkPerspIter; 716 friend class SkPerspIter;
710 }; 717 };
711 718
712 #endif 719 #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