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

Side by Side Diff: src/utils/SkMatrix44.cpp

Issue 37693004: Remove float/double conversions from SkMatrix44's map2_pf (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« 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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "SkMatrix44.h" 8 #include "SkMatrix44.h"
9 9
10 static inline bool eq4(const SkMScalar* SK_RESTRICT a, 10 static inline bool eq4(const SkMScalar* SK_RESTRICT a,
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 dst4[1] = mat[0][1] * sx + mat[1][1] * sy + mat[3][1]; 827 dst4[1] = mat[0][1] * sx + mat[1][1] * sy + mat[3][1];
828 dst4[2] = mat[0][2] * sx + mat[1][2] * sy + mat[3][2]; 828 dst4[2] = mat[0][2] * sx + mat[1][2] * sy + mat[3][2];
829 dst4[3] = 1; 829 dst4[3] = 1;
830 src2 += 2; 830 src2 += 2;
831 dst4 += 4; 831 dst4 += 4;
832 } 832 }
833 } 833 }
834 834
835 static void map2_pf(const SkMScalar mat[][4], const float* SK_RESTRICT src2, 835 static void map2_pf(const SkMScalar mat[][4], const float* SK_RESTRICT src2,
836 int count, float* SK_RESTRICT dst4) { 836 int count, float* SK_RESTRICT dst4) {
837 double r;
838 for (int n = 0; n < count; ++n) { 837 for (int n = 0; n < count; ++n) {
839 double sx = src2[0]; 838 float sx = src2[0];
840 double sy = src2[1]; 839 float sy = src2[1];
841 for (int i = 0; i < 4; i++) { 840 for (int i = 0; i < 4; i++) {
842 r = mat[0][i] * sx + mat[1][i] * sy + mat[3][i]; 841 dst4[i] = mat[0][i] * sx + mat[1][i] * sy + mat[3][i];
843 dst4[i] = SkMScalarToFloat(r);
844 } 842 }
845 src2 += 2; 843 src2 += 2;
846 dst4 += 4; 844 dst4 += 4;
847 } 845 }
848 } 846 }
849 847
850 static void map2_pd(const SkMScalar mat[][4], const double* SK_RESTRICT src2, 848 static void map2_pd(const SkMScalar mat[][4], const double* SK_RESTRICT src2,
851 int count, double* SK_RESTRICT dst4) { 849 int count, double* SK_RESTRICT dst4) {
852 for (int n = 0; n < count; ++n) { 850 for (int n = 0; n < count; ++n) {
853 double sx = src2[0]; 851 double sx = src2[0];
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 dst[SkMatrix::kMScaleX] = SkMScalarToScalar(fMat[0][0]); 945 dst[SkMatrix::kMScaleX] = SkMScalarToScalar(fMat[0][0]);
948 dst[SkMatrix::kMSkewX] = SkMScalarToScalar(fMat[1][0]); 946 dst[SkMatrix::kMSkewX] = SkMScalarToScalar(fMat[1][0]);
949 dst[SkMatrix::kMTransX] = SkMScalarToScalar(fMat[3][0]); 947 dst[SkMatrix::kMTransX] = SkMScalarToScalar(fMat[3][0]);
950 948
951 dst[SkMatrix::kMSkewY] = SkMScalarToScalar(fMat[0][1]); 949 dst[SkMatrix::kMSkewY] = SkMScalarToScalar(fMat[0][1]);
952 dst[SkMatrix::kMScaleY] = SkMScalarToScalar(fMat[1][1]); 950 dst[SkMatrix::kMScaleY] = SkMScalarToScalar(fMat[1][1]);
953 dst[SkMatrix::kMTransY] = SkMScalarToScalar(fMat[3][1]); 951 dst[SkMatrix::kMTransY] = SkMScalarToScalar(fMat[3][1]);
954 952
955 return dst; 953 return dst;
956 } 954 }
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