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

Side by Side Diff: src/ports/SkImageDecoder_CG.cpp

Issue 641813009: Add test for new FrontBufferedStream behavior. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix mac assertion Created 6 years, 2 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
« no previous file with comments | « no previous file | tests/FrontBufferedStreamTest.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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkCGUtils.h" 8 #include "SkCGUtils.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 22 matching lines...) Expand all
33 // TODO: use callbacks, so we don't have to load all the data into RAM 33 // TODO: use callbacks, so we don't have to load all the data into RAM
34 SkAutoMalloc storage; 34 SkAutoMalloc storage;
35 const size_t len = SkCopyStreamToStorage(&storage, stream); 35 const size_t len = SkCopyStreamToStorage(&storage, stream);
36 void* data = storage.detach(); 36 void* data = storage.detach();
37 37
38 return CGDataProviderCreateWithData(data, data, len, malloc_release_proc); 38 return CGDataProviderCreateWithData(data, data, len, malloc_release_proc);
39 } 39 }
40 40
41 static CGImageSourceRef SkStreamToCGImageSource(SkStream* stream) { 41 static CGImageSourceRef SkStreamToCGImageSource(SkStream* stream) {
42 CGDataProviderRef data = SkStreamToDataProvider(stream); 42 CGDataProviderRef data = SkStreamToDataProvider(stream);
43 SkASSERT(data); 43 if (!data) {
44 return NULL;
45 }
44 CGImageSourceRef imageSrc = CGImageSourceCreateWithDataProvider(data, 0); 46 CGImageSourceRef imageSrc = CGImageSourceCreateWithDataProvider(data, 0);
45 CGDataProviderRelease(data); 47 CGDataProviderRelease(data);
46 return imageSrc; 48 return imageSrc;
47 } 49 }
48 50
49 class SkImageDecoder_CG : public SkImageDecoder { 51 class SkImageDecoder_CG : public SkImageDecoder {
50 protected: 52 protected:
51 virtual Result onDecode(SkStream* stream, SkBitmap* bm, Mode); 53 virtual Result onDecode(SkStream* stream, SkBitmap* bm, Mode);
52 }; 54 };
53 55
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 348
347 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); 349 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc);
348 const CFStringRef name = CGImageSourceGetType(imageSrc); 350 const CFStringRef name = CGImageSourceGetType(imageSrc);
349 if (NULL == name) { 351 if (NULL == name) {
350 return SkImageDecoder::kUnknown_Format; 352 return SkImageDecoder::kUnknown_Format;
351 } 353 }
352 return UTType_to_Format(name); 354 return UTType_to_Format(name);
353 } 355 }
354 356
355 static SkImageDecoder_FormatReg gFormatReg(get_format_cg); 357 static SkImageDecoder_FormatReg gFormatReg(get_format_cg);
OLDNEW
« no previous file with comments | « no previous file | tests/FrontBufferedStreamTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698