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

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

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 years 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 | « src/core/SkBitmapFilter.cpp ('k') | src/core/SkFDot6.h » ('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 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #include "SkBitmapProcState.h" 8 #include "SkBitmapProcState.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkFilterProc.h" 10 #include "SkFilterProc.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 */ 191 */
192 192
193 SkScalar scaleSqd = effective_matrix_scale_sqrd(fInvMatrix); 193 SkScalar scaleSqd = effective_matrix_scale_sqrd(fInvMatrix);
194 194
195 if (SkPaint::kHigh_FilterLevel == fFilterLevel) { 195 if (SkPaint::kHigh_FilterLevel == fFilterLevel) {
196 // Set the limit at 0.25 for the CTM... if the CTM is scaling smaller 196 // Set the limit at 0.25 for the CTM... if the CTM is scaling smaller
197 // than this, then the mipmaps quality may be greater (certainly faster) 197 // than this, then the mipmaps quality may be greater (certainly faster)
198 // so we only keep High quality if the scale is greater than this. 198 // so we only keep High quality if the scale is greater than this.
199 // 199 //
200 // Since we're dealing with the inverse, we compare against its inverse. 200 // Since we're dealing with the inverse, we compare against its inverse.
201 const SkScalar bicubicLimit = SkFloatToScalar(4.0f); 201 const SkScalar bicubicLimit = 4.0f;
202 const SkScalar bicubicLimitSqd = bicubicLimit * bicubicLimit; 202 const SkScalar bicubicLimitSqd = bicubicLimit * bicubicLimit;
203 if (scaleSqd < bicubicLimitSqd) { // use bicubic scanline 203 if (scaleSqd < bicubicLimitSqd) { // use bicubic scanline
204 return false; 204 return false;
205 } 205 }
206 206
207 // else set the filter-level to Medium, since we're scaling down and 207 // else set the filter-level to Medium, since we're scaling down and
208 // want to reqeust mipmaps 208 // want to reqeust mipmaps
209 fFilterLevel = SkPaint::kMedium_FilterLevel; 209 fFilterLevel = SkPaint::kMedium_FilterLevel;
210 } 210 }
211 211
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 } else { 982 } else {
983 size >>= 2; 983 size >>= 2;
984 } 984 }
985 985
986 if (fFilterLevel != SkPaint::kNone_FilterLevel) { 986 if (fFilterLevel != SkPaint::kNone_FilterLevel) {
987 size >>= 1; 987 size >>= 1;
988 } 988 }
989 989
990 return size; 990 return size;
991 } 991 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapFilter.cpp ('k') | src/core/SkFDot6.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698