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

Side by Side Diff: tools/LazyDecodeBitmap.cpp

Issue 1229933003: add runtime option to provide data->imagegenerator factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 5 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
« tests/ImageGeneratorTest.cpp ('K') | « tests/ImageGeneratorTest.cpp ('k') | no next file » | 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 "LazyDecodeBitmap.h" 8 #include "LazyDecodeBitmap.h"
9 9
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 10 matching lines...) Expand all
21 "implementation."); 21 "implementation.");
22 22
23 // Fits SkPicture::InstallPixelRefProc call signature. 23 // Fits SkPicture::InstallPixelRefProc call signature.
24 // Used in SkPictureData::CreateFromStream 24 // Used in SkPictureData::CreateFromStream
25 bool sk_tools::LazyDecodeBitmap(const void* src, size_t length, SkBitmap* dst) { 25 bool sk_tools::LazyDecodeBitmap(const void* src, size_t length, SkBitmap* dst) {
26 SkAutoDataUnref data(SkData::NewWithCopy(src, length)); 26 SkAutoDataUnref data(SkData::NewWithCopy(src, length));
27 if (NULL == data.get()) { 27 if (NULL == data.get()) {
28 return false; 28 return false;
29 } 29 }
30 30
31 SkAutoTDelete<SkImageGenerator> gen(SkImageGenerator::NewFromData(data)); 31 SkAutoTDelete<SkImageGenerator> gen(SkImageGenerator::NewFromEncoded(data));
32 if (NULL == gen.get()) { 32 if (NULL == gen.get()) {
33 return false; 33 return false;
34 } 34 }
35 const SkImageInfo info = gen->getInfo(); 35 const SkImageInfo info = gen->getInfo();
36 SkDiscardableMemory::Factory* pool = NULL; 36 SkDiscardableMemory::Factory* pool = NULL;
37 if ((!FLAGS_useVolatileCache) || (info.width() * info.height() < 32 * 1024)) { 37 if ((!FLAGS_useVolatileCache) || (info.width() * info.height() < 32 * 1024)) {
38 // how to do switching with SkDiscardableMemory. 38 // how to do switching with SkDiscardableMemory.
39 pool = SkGetGlobalDiscardableMemoryPool(); 39 pool = SkGetGlobalDiscardableMemoryPool();
40 // Only meaningful if platform has a default discardable 40 // Only meaningful if platform has a default discardable
41 // memory implementation that differs from the global DM pool. 41 // memory implementation that differs from the global DM pool.
42 } 42 }
43 return SkInstallDiscardablePixelRef(gen.detach(), NULL, dst, pool); 43 return SkInstallDiscardablePixelRef(gen.detach(), NULL, dst, pool);
44 } 44 }
OLDNEW
« tests/ImageGeneratorTest.cpp ('K') | « tests/ImageGeneratorTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698