| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkScaledImageCache.h" | 8 #include "SkScaledImageCache.h" |
| 9 #include "SkMipMap.h" | 9 #include "SkMipMap.h" |
| 10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (0 == size) { | 269 if (0 == size) { |
| 270 return false; | 270 return false; |
| 271 } | 271 } |
| 272 | 272 |
| 273 SkDiscardableMemory* dm = fFactory(size); | 273 SkDiscardableMemory* dm = fFactory(size); |
| 274 if (NULL == dm) { | 274 if (NULL == dm) { |
| 275 return false; | 275 return false; |
| 276 } | 276 } |
| 277 | 277 |
| 278 // can we relax this? | 278 // can we relax this? |
| 279 if (kN32_SkColorType != bitmap->colorType()) { | 279 if (kN32_SkColorType != bitmap->colorType() |
| 280 && kAlpha_8_SkColorType != bitmap->colorType()) { |
| 280 return false; | 281 return false; |
| 281 } | 282 } |
| 282 | 283 |
| 283 SkImageInfo info = bitmap->info(); | 284 SkImageInfo info = bitmap->info(); |
| 284 bitmap->setPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef, | 285 bitmap->setPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef, |
| 285 (info, dm, bitmap->rowBytes())))->unref(); | 286 (info, dm, bitmap->rowBytes())))->unref(); |
| 286 bitmap->lockPixels(); | 287 bitmap->lockPixels(); |
| 287 return bitmap->readyToDraw(); | 288 return bitmap->readyToDraw(); |
| 288 } | 289 } |
| 289 | 290 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 return SkScaledImageCache::GetBytesUsed(); | 775 return SkScaledImageCache::GetBytesUsed(); |
| 775 } | 776 } |
| 776 | 777 |
| 777 size_t SkGraphics::GetImageCacheByteLimit() { | 778 size_t SkGraphics::GetImageCacheByteLimit() { |
| 778 return SkScaledImageCache::GetByteLimit(); | 779 return SkScaledImageCache::GetByteLimit(); |
| 779 } | 780 } |
| 780 | 781 |
| 781 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { | 782 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { |
| 782 return SkScaledImageCache::SetByteLimit(newLimit); | 783 return SkScaledImageCache::SetByteLimit(newLimit); |
| 783 } | 784 } |
| OLD | NEW |