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

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

Issue 1607853003: don't preround in bitmap scaling setup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « 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 "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkBitmapController.h" 9 #include "SkBitmapController.h"
10 #include "SkBitmapProcState.h" 10 #include "SkBitmapProcState.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // a faster path in this case. 166 // a faster path in this case.
167 167
168 // This code will only execute if the matrix has some scale component; 168 // This code will only execute if the matrix has some scale component;
169 // if it's already pure translate then we won't do this inversion. 169 // if it's already pure translate then we won't do this inversion.
170 170
171 if (matrix_only_scale_translate(fInvMatrix)) { 171 if (matrix_only_scale_translate(fInvMatrix)) {
172 SkMatrix forward; 172 SkMatrix forward;
173 if (fInvMatrix.invert(&forward)) { 173 if (fInvMatrix.invert(&forward)) {
174 if (clampClamp ? just_trans_clamp(forward, fPixmap) 174 if (clampClamp ? just_trans_clamp(forward, fPixmap)
175 : just_trans_general(forward)) { 175 : just_trans_general(forward)) {
176 #ifdef SK_SUPPORT_LEGACY_TRANSLATEROUNDHACK
176 SkScalar tx = -SkScalarRoundToScalar(forward.getTranslateX()); 177 SkScalar tx = -SkScalarRoundToScalar(forward.getTranslateX());
177 SkScalar ty = -SkScalarRoundToScalar(forward.getTranslateY()); 178 SkScalar ty = -SkScalarRoundToScalar(forward.getTranslateY());
178 fInvMatrix.setTranslate(tx, ty); 179 fInvMatrix.setTranslate(tx, ty);
180 #else
181 fInvMatrix.setTranslate(-forward.getTranslateX(), -forward.getTr anslateY());
182 #endif
179 } 183 }
180 } 184 }
181 } 185 }
182 186
183 fInvProc = fInvMatrix.getMapXYProc(); 187 fInvProc = fInvMatrix.getMapXYProc();
184 fInvType = fInvMatrix.getType(); 188 fInvType = fInvMatrix.getType();
185 fInvSx = SkScalarToFixed(fInvMatrix.getScaleX()); 189 fInvSx = SkScalarToFixed(fInvMatrix.getScaleX());
186 fInvSxFractionalInt = SkScalarToFractionalInt(fInvMatrix.getScaleX()); 190 fInvSxFractionalInt = SkScalarToFractionalInt(fInvMatrix.getScaleX());
187 fInvKy = SkScalarToFixed(fInvMatrix.getSkewY()); 191 fInvKy = SkScalarToFixed(fInvMatrix.getSkewY());
188 fInvKyFractionalInt = SkScalarToFractionalInt(fInvMatrix.getSkewY()); 192 fInvKyFractionalInt = SkScalarToFractionalInt(fInvMatrix.getSkewY());
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 fx += dx; 827 fx += dx;
824 } 828 }
825 } else { 829 } else {
826 for (int i = 0; i < count; ++i) { 830 for (int i = 0; i < count; ++i) {
827 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; 831 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)];
828 fx += dx; 832 fx += dx;
829 } 833 }
830 } 834 }
831 } 835 }
832 836
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