OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |