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

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

Issue 1412423008: Handling large jpegs in CPU raster - downsample to display res and 565 Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « src/core/SkImageGenerator.cpp ('k') | src/image/SkImage_Base.h » ('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 "SkChecksum.h" 8 #include "SkChecksum.h"
9 #include "SkMessageBus.h" 9 #include "SkMessageBus.h"
10 #include "SkMipMap.h" 10 #include "SkMipMap.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (0 == size || size64 > (uint64_t)size) { 165 if (0 == size || size64 > (uint64_t)size) {
166 return false; 166 return false;
167 } 167 }
168 168
169 SkDiscardableMemory* dm = fFactory(size); 169 SkDiscardableMemory* dm = fFactory(size);
170 if (nullptr == dm) { 170 if (nullptr == dm) {
171 return false; 171 return false;
172 } 172 }
173 173
174 // can we relax this? 174 // can we relax this?
175 if (kN32_SkColorType != bitmap->colorType()) { 175 if (kN32_SkColorType != bitmap->colorType() && kRGB_565_SkColorType != bitma p->colorType()) {
176 return false; 176 return false;
177 } 177 }
178 178
179 SkImageInfo info = bitmap->info(); 179 SkImageInfo info = bitmap->info();
180 bitmap->setPixelRef(new SkOneShotDiscardablePixelRef(info, dm, bitmap->rowBy tes()))->unref(); 180 bitmap->setPixelRef(new SkOneShotDiscardablePixelRef(info, dm, bitmap->rowBy tes()))->unref();
181 bitmap->lockPixels(); 181 bitmap->lockPixels();
182 return bitmap->readyToDraw(); 182 return bitmap->readyToDraw();
183 } 183 }
184 184
185 SkResourceCache::SkResourceCache(DiscardableFactory factory) { 185 SkResourceCache::SkResourceCache(DiscardableFactory factory) {
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", rec.bytesUsed( )); 687 dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", rec.bytesUsed( ));
688 dump->setMemoryBacking(dumpName.c_str(), "malloc", nullptr); 688 dump->setMemoryBacking(dumpName.c_str(), "malloc", nullptr);
689 } 689 }
690 } 690 }
691 691
692 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) { 692 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
693 // Since resource could be backed by malloc or discardable, the cache always dumps detailed 693 // Since resource could be backed by malloc or discardable, the cache always dumps detailed
694 // stats to be accurate. 694 // stats to be accurate.
695 VisitAll(sk_trace_dump_visitor, dump); 695 VisitAll(sk_trace_dump_visitor, dump);
696 } 696 }
OLDNEW
« no previous file with comments | « src/core/SkImageGenerator.cpp ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698