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

Side by Side Diff: src/core/SkMatrix.cpp

Issue 734513004: don't normalize after perspective concat (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | no next file » | 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMatrix.h" 8 #include "SkMatrix.h"
9 #include "SkFloatBits.h" 9 #include "SkFloatBits.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 562
563 static inline float muladdmul(float a, float b, float c, float d) { 563 static inline float muladdmul(float a, float b, float c, float d) {
564 return SkDoubleToFloat((double)a * b + (double)c * d); 564 return SkDoubleToFloat((double)a * b + (double)c * d);
565 } 565 }
566 566
567 static inline float rowcol3(const float row[], const float col[]) { 567 static inline float rowcol3(const float row[], const float col[]) {
568 return row[0] * col[0] + row[1] * col[3] + row[2] * col[6]; 568 return row[0] * col[0] + row[1] * col[3] + row[2] * col[6];
569 } 569 }
570 570
571 static void normalize_perspective(SkScalar mat[9]) { 571 static void normalize_perspective(SkScalar mat[9]) {
572 if (SkScalarAbs(mat[SkMatrix::kMPersp2]) > 1) { 572 // If it was interesting to never store the last element, we could divide al l 8 other
573 for (int i = 0; i < 9; i++) 573 // elements here by the 9th, making it 1.0...
574 mat[i] = SkScalarHalf(mat[i]); 574 //
575 } 575 // When SkScalar was SkFixed, we would sometimes rescale the entire matrix t o keep its
576 // component values from getting too large. This is not a concern when using floats/doubles,
577 // so we do nothing now.
576 } 578 }
577 579
578 static bool only_scale_and_translate(unsigned mask) { 580 static bool only_scale_and_translate(unsigned mask) {
579 return 0 == (mask & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)); 581 return 0 == (mask & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask));
580 } 582 }
581 583
582 void SkMatrix::setConcat(const SkMatrix& a, const SkMatrix& b) { 584 void SkMatrix::setConcat(const SkMatrix& a, const SkMatrix& b) {
583 TypeMask aType = a.getType(); 585 TypeMask aType = a.getType();
584 TypeMask bType = b.getType(); 586 TypeMask bType = b.getType();
585 587
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 rotation1->fX = cos1; 1752 rotation1->fX = cos1;
1751 rotation1->fY = sin1; 1753 rotation1->fY = sin1;
1752 } 1754 }
1753 if (rotation2) { 1755 if (rotation2) {
1754 rotation2->fX = cos2; 1756 rotation2->fX = cos2;
1755 rotation2->fY = sin2; 1757 rotation2->fY = sin2;
1756 } 1758 }
1757 1759
1758 return true; 1760 return true;
1759 } 1761 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698