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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 SkDiscardableMemory* dm = fFactory(size); | 286 SkDiscardableMemory* dm = fFactory(size); |
287 if (NULL == dm) { | 287 if (NULL == dm) { |
288 return false; | 288 return false; |
289 } | 289 } |
290 | 290 |
291 // can relax when we have bitmap::asImageInfo | 291 // can relax when we have bitmap::asImageInfo |
292 if (SkBitmap::kARGB_8888_Config != bitmap->config()) { | 292 if (SkBitmap::kARGB_8888_Config != bitmap->config()) { |
293 return false; | 293 return false; |
294 } | 294 } |
295 | 295 |
296 SkImageInfo info = SkImageInfo::MakeN32(bitmap->width(), bitmap->height(), | 296 SkImageInfo info = { |
297 bitmap->alphaType()); | 297 bitmap->width(), |
| 298 bitmap->height(), |
| 299 kPMColor_SkColorType, |
| 300 bitmap->alphaType() |
| 301 }; |
298 | 302 |
299 bitmap->installPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef, | 303 bitmap->setPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef, |
300 (info, dm, bitmap->rowBytes())))->unref(); | 304 (info, dm, bitmap->rowBytes())))->unref(); |
301 bitmap->lockPixels(); | 305 bitmap->lockPixels(); |
302 return bitmap->readyToDraw(); | 306 return bitmap->readyToDraw(); |
303 } | 307 } |
304 | 308 |
305 SkScaledImageCache::SkScaledImageCache(DiscardableFactory factory) { | 309 SkScaledImageCache::SkScaledImageCache(DiscardableFactory factory) { |
306 this->init(); | 310 this->init(); |
307 fDiscardableFactory = factory; | 311 fDiscardableFactory = factory; |
308 | 312 |
309 fAllocator = SkNEW_ARGS(SkScaledImageCacheDiscardableAllocator, (factory)); | 313 fAllocator = SkNEW_ARGS(SkScaledImageCacheDiscardableAllocator, (factory)); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 return SkScaledImageCache::GetBytesUsed(); | 792 return SkScaledImageCache::GetBytesUsed(); |
789 } | 793 } |
790 | 794 |
791 size_t SkGraphics::GetImageCacheByteLimit() { | 795 size_t SkGraphics::GetImageCacheByteLimit() { |
792 return SkScaledImageCache::GetByteLimit(); | 796 return SkScaledImageCache::GetByteLimit(); |
793 } | 797 } |
794 | 798 |
795 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { | 799 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { |
796 return SkScaledImageCache::SetByteLimit(newLimit); | 800 return SkScaledImageCache::SetByteLimit(newLimit); |
797 } | 801 } |
OLD | NEW |