| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 fScaledCacheID = SkScaledImageCache::AddAndLock(fOrigBitmap, | 292 fScaledCacheID = SkScaledImageCache::AddAndLock(fOrigBitmap, |
| 293 SK_Scalar1, SK_Scala
r1, | 293 SK_Scalar1, SK_Scala
r1, |
| 294 fScaledBitmap); | 294 fScaledBitmap); |
| 295 if (!fScaledCacheID) { | 295 if (!fScaledCacheID) { |
| 296 fScaledBitmap.reset(); | 296 fScaledBitmap.reset(); |
| 297 return false; | 297 return false; |
| 298 } | 298 } |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 fScaledBitmap.lockPixels(); // just 'cause the cache made a copy :( | 301 fScaledBitmap.lockPixels(); // just 'cause the cache made a copy :( |
| 302 if (!fScaledBitmap.getPixels()) { |
| 303 // TODO: find out how this can happen, and add a unittest to exercise |
| 304 // inspired by BUG=chromium:295895 |
| 305 return false; |
| 306 } |
| 302 fBitmap = &fScaledBitmap; | 307 fBitmap = &fScaledBitmap; |
| 303 return true; | 308 return true; |
| 304 } | 309 } |
| 305 | 310 |
| 306 void SkBitmapProcState::endContext() { | 311 void SkBitmapProcState::endContext() { |
| 307 SkDELETE(fBitmapFilter); | 312 SkDELETE(fBitmapFilter); |
| 308 fBitmapFilter = NULL; | 313 fBitmapFilter = NULL; |
| 309 fScaledBitmap.reset(); | 314 fScaledBitmap.reset(); |
| 310 | 315 |
| 311 if (fScaledCacheID) { | 316 if (fScaledCacheID) { |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 } else { | 979 } else { |
| 975 size >>= 2; | 980 size >>= 2; |
| 976 } | 981 } |
| 977 | 982 |
| 978 if (fFilterLevel != SkPaint::kNone_FilterLevel) { | 983 if (fFilterLevel != SkPaint::kNone_FilterLevel) { |
| 979 size >>= 1; | 984 size >>= 1; |
| 980 } | 985 } |
| 981 | 986 |
| 982 return size; | 987 return size; |
| 983 } | 988 } |
| OLD | NEW |