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

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

Issue 2264433002: Revert of Fast path translate() in SkCanvas and SkLiteDL. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « src/core/SkLiteRecorder.cpp ('k') | 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 "SkFloatBits.h" 8 #include "SkFloatBits.h"
9 #include "SkMatrix.h" 9 #include "SkMatrix.h"
10 #include "SkNx.h" 10 #include "SkNx.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } else { 283 } else {
284 this->reset(); 284 this->reset();
285 } 285 }
286 } 286 }
287 287
288 void SkMatrix::preTranslate(SkScalar dx, SkScalar dy) { 288 void SkMatrix::preTranslate(SkScalar dx, SkScalar dy) {
289 if (!dx && !dy) { 289 if (!dx && !dy) {
290 return; 290 return;
291 } 291 }
292 292
293 if (fTypeMask <= kTranslate_Mask) { 293 if (this->hasPerspective()) {
294 fMat[kMTransX] += dx;
295 fMat[kMTransY] += dy;
296 this->setTypeMask((fMat[kMTransX] != 0 || fMat[kMTransY] != 0) ? kTransl ate_Mask
297 : kIdenti ty_Mask);
298 } else if (this->hasPerspective()) {
299 SkMatrix m; 294 SkMatrix m;
300 m.setTranslate(dx, dy); 295 m.setTranslate(dx, dy);
301 this->preConcat(m); 296 this->preConcat(m);
302 } else { 297 } else {
303 fMat[kMTransX] += sdot(fMat[kMScaleX], dx, fMat[kMSkewX], dy); 298 fMat[kMTransX] += sdot(fMat[kMScaleX], dx, fMat[kMSkewX], dy);
304 fMat[kMTransY] += sdot(fMat[kMSkewY], dx, fMat[kMScaleY], dy); 299 fMat[kMTransY] += sdot(fMat[kMSkewY], dx, fMat[kMScaleY], dy);
305 this->setTypeMask(kUnknown_Mask | kOnlyPerspectiveValid_Mask); 300 this->setTypeMask(kUnknown_Mask | kOnlyPerspectiveValid_Mask);
306 } 301 }
307 } 302 }
308 303
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 1093
1099 tmp.fMat[kMTransX] = tmp.fMat[kMTransY] = 0; 1094 tmp.fMat[kMTransX] = tmp.fMat[kMTransY] = 0;
1100 tmp.clearTypeMask(kTranslate_Mask); 1095 tmp.clearTypeMask(kTranslate_Mask);
1101 tmp.mapPoints(dst, src, count); 1096 tmp.mapPoints(dst, src, count);
1102 } 1097 }
1103 } 1098 }
1104 1099
1105 void SkMatrix::mapRectScaleTranslate(SkRect* dst, const SkRect& src) const { 1100 void SkMatrix::mapRectScaleTranslate(SkRect* dst, const SkRect& src) const {
1106 SkASSERT(dst); 1101 SkASSERT(dst);
1107 SkASSERT(this->isScaleTranslate()); 1102 SkASSERT(this->isScaleTranslate());
1108 1103
1109 SkScalar sx = fMat[kMScaleX]; 1104 SkScalar sx = fMat[kMScaleX];
1110 SkScalar sy = fMat[kMScaleY]; 1105 SkScalar sy = fMat[kMScaleY];
1111 SkScalar tx = fMat[kMTransX]; 1106 SkScalar tx = fMat[kMTransX];
1112 SkScalar ty = fMat[kMTransY]; 1107 SkScalar ty = fMat[kMTransY];
1113 Sk4f scale(sx, sy, sx, sy); 1108 Sk4f scale(sx, sy, sx, sy);
1114 Sk4f trans(tx, ty, tx, ty); 1109 Sk4f trans(tx, ty, tx, ty);
1115 1110
1116 Sk4f ltrb = Sk4f::Load(&src.fLeft) * scale + trans; 1111 Sk4f ltrb = Sk4f::Load(&src.fLeft) * scale + trans;
1117 // need to sort so we're not inverted 1112 // need to sort so we're not inverted
1118 Sk4f rblt(ltrb[2], ltrb[3], ltrb[0], ltrb[1]); 1113 Sk4f rblt(ltrb[2], ltrb[3], ltrb[0], ltrb[1]);
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 const SkScalar m10 = -m01; 1886 const SkScalar m10 = -m01;
1892 const SkScalar m11 = m00; 1887 const SkScalar m11 = m00;
1893 const SkScalar m12 = fTy; 1888 const SkScalar m12 = fTy;
1894 1889
1895 quad[0].set(m02, m12); 1890 quad[0].set(m02, m12);
1896 quad[1].set(m00 * width + m02, m10 * width + m12); 1891 quad[1].set(m00 * width + m02, m10 * width + m12);
1897 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m 12); 1892 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m 12);
1898 quad[3].set(m01 * height + m02, m11 * height + m12); 1893 quad[3].set(m01 * height + m02, m11 * height + m12);
1899 #endif 1894 #endif
1900 } 1895 }
OLDNEW
« no previous file with comments | « src/core/SkLiteRecorder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698