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

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

Issue 2111703002: speed up maprect for scale+trans case (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: apply comments from #14 Created 4 years, 5 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 | « bench/MatrixBench.cpp ('k') | 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 bottom-right, and bottom-left points transformed by the matrix. 554 bottom-right, and bottom-left points transformed by the matrix.
555 @param dst Where the transformed quad is written. 555 @param dst Where the transformed quad is written.
556 @param rect The original rectangle to be transformed. 556 @param rect The original rectangle to be transformed.
557 */ 557 */
558 void mapRectToQuad(SkPoint dst[4], const SkRect& rect) const { 558 void mapRectToQuad(SkPoint dst[4], const SkRect& rect) const {
559 // This could potentially be faster if we only transformed each x and y of the rect once. 559 // This could potentially be faster if we only transformed each x and y of the rect once.
560 rect.toQuad(dst); 560 rect.toQuad(dst);
561 this->mapPoints(dst, 4); 561 this->mapPoints(dst, 4);
562 } 562 }
563 563
564 /**
565 * Maps a rect to another rect, asserting (in debug mode) that the matrix o nly contains
566 * scale and translate elements. If it contains other elements, the results are undefined.
567 */
568 void mapRectScaleTranslate(SkRect* dst, const SkRect& src) const;
569
564 /** Return the mean radius of a circle after it has been mapped by 570 /** Return the mean radius of a circle after it has been mapped by
565 this matrix. NOTE: in perspective this value assumes the circle 571 this matrix. NOTE: in perspective this value assumes the circle
566 has its center at the origin. 572 has its center at the origin.
567 */ 573 */
568 SkScalar mapRadius(SkScalar radius) const; 574 SkScalar mapRadius(SkScalar radius) const;
569 575
570 typedef void (*MapXYProc)(const SkMatrix& mat, SkScalar x, SkScalar y, 576 typedef void (*MapXYProc)(const SkMatrix& mat, SkScalar x, SkScalar y,
571 SkPoint* result); 577 SkPoint* result);
572 578
573 static MapXYProc GetMapXYProc(TypeMask mask) { 579 static MapXYProc GetMapXYProc(TypeMask mask) {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 836
831 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int ); 837 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int );
832 838
833 static const MapPtsProc gMapPtsProcs[]; 839 static const MapPtsProc gMapPtsProcs[];
834 840
835 friend class SkPerspIter; 841 friend class SkPerspIter;
836 }; 842 };
837 SK_END_REQUIRE_DENSE 843 SK_END_REQUIRE_DENSE
838 844
839 #endif 845 #endif
OLDNEW
« no previous file with comments | « bench/MatrixBench.cpp ('k') | src/core/SkMatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698