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: src/ports/SkImageDecoder_CG.cpp

Issue 1779263003: Make sp variants for SkData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « src/images/SkImageDecoder_pkm.cpp ('k') | src/sfnt/SkOTUtils.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 "SkTypes.h" 8 #include "SkTypes.h"
9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
10 10
(...skipping 18 matching lines...) Expand all
29 #include <MobileCoreServices/MobileCoreServices.h> 29 #include <MobileCoreServices/MobileCoreServices.h>
30 #endif 30 #endif
31 31
32 static void data_unref_proc(void* skdata, const void*, size_t) { 32 static void data_unref_proc(void* skdata, const void*, size_t) {
33 SkASSERT(skdata); 33 SkASSERT(skdata);
34 static_cast<SkData*>(skdata)->unref(); 34 static_cast<SkData*>(skdata)->unref();
35 } 35 }
36 36
37 static CGDataProviderRef SkStreamToDataProvider(SkStream* stream) { 37 static CGDataProviderRef SkStreamToDataProvider(SkStream* stream) {
38 // TODO: use callbacks, so we don't have to load all the data into RAM 38 // TODO: use callbacks, so we don't have to load all the data into RAM
39 SkData* skdata = SkCopyStreamToData(stream); 39 SkData* skdata = SkCopyStreamToData(stream).release();
40 if (!skdata) { 40 if (!skdata) {
41 return nullptr; 41 return nullptr;
42 } 42 }
43 43
44 return CGDataProviderCreateWithData(skdata, skdata->data(), skdata->size(), data_unref_proc); 44 return CGDataProviderCreateWithData(skdata, skdata->data(), skdata->size(), data_unref_proc);
45 } 45 }
46 46
47 static CGImageSourceRef SkStreamToCGImageSource(SkStream* stream) { 47 static CGImageSourceRef SkStreamToCGImageSource(SkStream* stream) {
48 CGDataProviderRef data = SkStreamToDataProvider(stream); 48 CGDataProviderRef data = SkStreamToDataProvider(stream);
49 if (!data) { 49 if (!data) {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 const CFStringRef name = CGImageSourceGetType(imageSrc); 402 const CFStringRef name = CGImageSourceGetType(imageSrc);
403 if (nullptr == name) { 403 if (nullptr == name) {
404 return SkImageDecoder::kUnknown_Format; 404 return SkImageDecoder::kUnknown_Format;
405 } 405 }
406 return UTType_to_Format(name); 406 return UTType_to_Format(name);
407 } 407 }
408 408
409 static SkImageDecoder_FormatReg gFormatReg(get_format_cg); 409 static SkImageDecoder_FormatReg gFormatReg(get_format_cg);
410 410
411 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 411 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_pkm.cpp ('k') | src/sfnt/SkOTUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698