| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(NULL != fScaledBitmap.getPixels()); |
| 192 fScaledBitmap.setImmutable(); |
| 192 SkBitmapCache::Add(fOrigBitmap, roundedDestWidth, roundedDestHeight,
fScaledBitmap); | 193 SkBitmapCache::Add(fOrigBitmap, roundedDestWidth, roundedDestHeight,
fScaledBitmap); |
| 193 } | 194 } |
| 194 | 195 |
| 195 SkASSERT(NULL != fScaledBitmap.getPixels()); | 196 SkASSERT(NULL != fScaledBitmap.getPixels()); |
| 196 fBitmap = &fScaledBitmap; | 197 fBitmap = &fScaledBitmap; |
| 197 | 198 |
| 198 // set the inv matrix type to translate-only; | 199 // set the inv matrix type to translate-only; |
| 199 fInvMatrix.setTranslate(fInvMatrix.getTranslateX() / fInvMatrix.getScale
X(), | 200 fInvMatrix.setTranslate(fInvMatrix.getTranslateX() / fInvMatrix.getScale
X(), |
| 200 fInvMatrix.getTranslateY() / fInvMatrix.getScale
Y()); | 201 fInvMatrix.getTranslateY() / fInvMatrix.getScale
Y()); |
| 201 | 202 |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 } else { | 1008 } else { |
| 1008 size >>= 2; | 1009 size >>= 2; |
| 1009 } | 1010 } |
| 1010 | 1011 |
| 1011 if (fFilterLevel != SkPaint::kNone_FilterLevel) { | 1012 if (fFilterLevel != SkPaint::kNone_FilterLevel) { |
| 1012 size >>= 1; | 1013 size >>= 1; |
| 1013 } | 1014 } |
| 1014 | 1015 |
| 1015 return size; | 1016 return size; |
| 1016 } | 1017 } |
| OLD | NEW |