| OLD | NEW |
| 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 "SkBitmapProcState.h" | 9 #include "SkBitmapProcState.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 SkBitmapScaler::RESIZE_BEST, | 181 SkBitmapScaler::RESIZE_BEST, |
| 182 roundedDestWidth, | 182 roundedDestWidth, |
| 183 roundedDestHeight, | 183 roundedDestHeight, |
| 184 SkResourceCache::GetAllocator())) { | 184 SkResourceCache::GetAllocator())) { |
| 185 // we failed to create fScaledBitmap, so just return and let | 185 // we failed to create fScaledBitmap, so just return and let |
| 186 // the scanline proc handle it. | 186 // the scanline proc handle it. |
| 187 return false; | 187 return false; |
| 188 | 188 |
| 189 } | 189 } |
| 190 | 190 |
| 191 SkASSERT(NULL != fScaledBitmap.getPixels()); | 191 SkASSERT(fScaledBitmap.getPixels()); |
| 192 fScaledBitmap.setImmutable(); | 192 fScaledBitmap.setImmutable(); |
| 193 SkBitmapCache::Add(fOrigBitmap, roundedDestWidth, roundedDestHeight,
fScaledBitmap); | 193 SkBitmapCache::Add(fOrigBitmap, roundedDestWidth, roundedDestHeight,
fScaledBitmap); |
| 194 } | 194 } |
| 195 | 195 |
| 196 SkASSERT(NULL != fScaledBitmap.getPixels()); | 196 SkASSERT(fScaledBitmap.getPixels()); |
| 197 fBitmap = &fScaledBitmap; | 197 fBitmap = &fScaledBitmap; |
| 198 | 198 |
| 199 // set the inv matrix type to translate-only; | 199 // set the inv matrix type to translate-only; |
| 200 fInvMatrix.setTranslate(fInvMatrix.getTranslateX() / fInvMatrix.getScale
X(), | 200 fInvMatrix.setTranslate(fInvMatrix.getTranslateX() / fInvMatrix.getScale
X(), |
| 201 fInvMatrix.getTranslateY() / fInvMatrix.getScale
Y()); | 201 fInvMatrix.getTranslateY() / fInvMatrix.getScale
Y()); |
| 202 | 202 |
| 203 #ifndef SK_IGNORE_PROPER_FRACTIONAL_SCALING | 203 #ifndef SK_IGNORE_PROPER_FRACTIONAL_SCALING |
| 204 // reintroduce any fractional scaling missed by our integral scale done
above. | 204 // reintroduce any fractional scaling missed by our integral scale done
above. |
| 205 | 205 |
| 206 float fractionalScaleX = roundedDestWidth/trueDestWidth; | 206 float fractionalScaleX = roundedDestWidth/trueDestWidth; |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 } else { | 1006 } else { |
| 1007 size >>= 2; | 1007 size >>= 2; |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 if (fFilterLevel != SkPaint::kNone_FilterLevel) { | 1010 if (fFilterLevel != SkPaint::kNone_FilterLevel) { |
| 1011 size >>= 1; | 1011 size >>= 1; |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 return size; | 1014 return size; |
| 1015 } | 1015 } |
| OLD | NEW |