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