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

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

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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/ports/SkFontMgr_win_dw.cpp ('k') | src/xps/SkXPSDevice.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 2016 Google Inc. 2 * Copyright 2016 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 "SkImageGeneratorWIC.h" 8 #include "SkImageGeneratorWIC.h"
9 #include "SkIStream.h" 9 #include "SkIStream.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 13 matching lines...) Expand all
24 HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPRO C_SERVER, 24 HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPRO C_SERVER,
25 IID_PPV_ARGS(&imagingFactory)); 25 IID_PPV_ARGS(&imagingFactory));
26 if (FAILED(hr)) { 26 if (FAILED(hr)) {
27 return nullptr; 27 return nullptr;
28 } 28 }
29 29
30 // Create an IStream. 30 // Create an IStream.
31 SkTScopedComPtr<IStream> iStream; 31 SkTScopedComPtr<IStream> iStream;
32 // Note that iStream will take ownership of the new memory stream because 32 // Note that iStream will take ownership of the new memory stream because
33 // we set |deleteOnRelease| to true. 33 // we set |deleteOnRelease| to true.
34 hr = SkIStream::CreateFromSkStream(new SkMemoryStream(data), true, &iStream) ; 34 hr = SkIStream::CreateFromSkStream(new SkMemoryStream(sk_ref_sp(data)), true , &iStream);
35 if (FAILED(hr)) { 35 if (FAILED(hr)) {
36 return nullptr; 36 return nullptr;
37 } 37 }
38 38
39 // Create the decoder from the stream. 39 // Create the decoder from the stream.
40 SkTScopedComPtr<IWICBitmapDecoder> decoder; 40 SkTScopedComPtr<IWICBitmapDecoder> decoder;
41 hr = imagingFactory->CreateDecoderFromStream(iStream.get(), nullptr, 41 hr = imagingFactory->CreateDecoderFromStream(iStream.get(), nullptr,
42 WICDecodeMetadataCacheOnDemand, &decoder); 42 WICDecodeMetadataCacheOnDemand, &decoder);
43 if (FAILED(hr)) { 43 if (FAILED(hr)) {
44 return nullptr; 44 return nullptr;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (FAILED(hr)) { 166 if (FAILED(hr)) {
167 return false; 167 return false;
168 } 168 }
169 169
170 // Set the destination pixels. 170 // Set the destination pixels.
171 hr = formatConverterSrc->CopyPixels(nullptr, (UINT) rowBytes, (UINT) rowByte s * info.height(), 171 hr = formatConverterSrc->CopyPixels(nullptr, (UINT) rowBytes, (UINT) rowByte s * info.height(),
172 (BYTE*) pixels); 172 (BYTE*) pixels);
173 173
174 return SUCCEEDED(hr); 174 return SUCCEEDED(hr);
175 } 175 }
OLDNEW
« no previous file with comments | « src/ports/SkFontMgr_win_dw.cpp ('k') | src/xps/SkXPSDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698