Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: src/core/SkScaledImageCache.cpp

Issue 173893002: use colortype instead of config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkScalerContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 size_t size = bitmap->getSize(); 282 size_t size = bitmap->getSize();
283 if (0 == size) { 283 if (0 == size) {
284 return false; 284 return false;
285 } 285 }
286 286
287 SkDiscardableMemory* dm = fFactory(size); 287 SkDiscardableMemory* dm = fFactory(size);
288 if (NULL == dm) { 288 if (NULL == dm) {
289 return false; 289 return false;
290 } 290 }
291 291
292 // can relax when we have bitmap::asImageInfo 292 // can we relax this?
293 if (SkBitmap::kARGB_8888_Config != bitmap->config()) { 293 if (kPMColor_SkColorType != bitmap->colorType()) {
294 return false; 294 return false;
295 } 295 }
296 296
297 SkImageInfo info = SkImageInfo::MakeN32(bitmap->width(), bitmap->height(), 297 SkImageInfo info = bitmap->info();
298 bitmap->alphaType());
299 bitmap->setPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef, 298 bitmap->setPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef,
300 (info, dm, bitmap->rowBytes())))->unref(); 299 (info, dm, bitmap->rowBytes())))->unref();
301 bitmap->lockPixels(); 300 bitmap->lockPixels();
302 return bitmap->readyToDraw(); 301 return bitmap->readyToDraw();
303 } 302 }
304 303
305 SkScaledImageCache::SkScaledImageCache(DiscardableFactory factory) { 304 SkScaledImageCache::SkScaledImageCache(DiscardableFactory factory) {
306 this->init(); 305 this->init();
307 fDiscardableFactory = factory; 306 fDiscardableFactory = factory;
308 307
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 return SkScaledImageCache::GetBytesUsed(); 788 return SkScaledImageCache::GetBytesUsed();
790 } 789 }
791 790
792 size_t SkGraphics::GetImageCacheByteLimit() { 791 size_t SkGraphics::GetImageCacheByteLimit() {
793 return SkScaledImageCache::GetByteLimit(); 792 return SkScaledImageCache::GetByteLimit();
794 } 793 }
795 794
796 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { 795 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) {
797 return SkScaledImageCache::SetByteLimit(newLimit); 796 return SkScaledImageCache::SetByteLimit(newLimit);
798 } 797 }
OLDNEW
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkScalerContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698