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

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

Issue 1785613010: Add SkImageGeneratorWIC (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
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 "SkTypes.h"
9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
10
11 #include "SkCGUtils.h"
12 #include "SkData.h" 8 #include "SkData.h"
13 #include "SkImageGenerator.h" 9 #include "SkImageGenerator.h"
14 #include "SkTemplates.h" 10 #include "SkTemplates.h"
11 #include "SkTScopedComPtr.h"
12 #include "SkTypes.h"
15 13
16 class SkImageGeneratorCG : public SkImageGenerator { 14 #include <wincodec.h>
15
16 /*
17 * Requires that the client has initialized COM on the calling thread.
msarett 2016/03/11 18:18:24 This is different than SkImageDecoder_WIC.
scroggo 2016/03/11 19:10:48 Why? The only other use I see of SkAutoCoInitializ
msarett 2016/03/11 19:20:14 It is also used in SkImageDecoder_WIC. com is ini
scroggo 2016/03/11 19:46:21 Right. Why not do it that way in SkImageGeneratorW
18 */
19 class SkImageGeneratorWIC : public SkImageGenerator {
17 public: 20 public:
18 /* 21 /*
19 * Refs the data if an image generator can be returned. Otherwise does 22 * Refs the data if an image generator can be returned. Otherwise does
20 * not affect the data. 23 * not affect the data.
21 */ 24 */
22 static SkImageGenerator* NewFromEncodedCG(SkData* data); 25 static SkImageGenerator* NewFromEncodedWIC(SkData* data);
23 26
24 protected: 27 protected:
25 SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) override; 28 SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) override;
26 29
27 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkP MColor ctable[], 30 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkP MColor ctable[],
28 int* ctableCount) override; 31 int* ctableCount) override;
29 32
30 private: 33 private:
31 /* 34 /*
32 * Takes ownership of the imageSrc 35 * Takes ownership of the imagingFactory
36 * Takes ownership of the imageSource
33 * Refs the data 37 * Refs the data
34 */ 38 */
35 SkImageGeneratorCG(const SkImageInfo& info, const void* imageSrc, SkData* da ta); 39 SkImageGeneratorWIC(const SkImageInfo& info, IWICImagingFactory* imagingFact ory,
40 IWICBitmapSource* imageSource, SkData* data);
36 41
37 SkAutoTCallVProc<const void, CFRelease> fImageSrc; 42 SkTScopedComPtr<IWICImagingFactory> fImagingFactory;
38 SkAutoTUnref<SkData> fData; 43 SkTScopedComPtr<IWICBitmapSource> fImageSource;
44 SkAutoTUnref<SkData> fData;
39 45
40 typedef SkImageGenerator INHERITED; 46 typedef SkImageGenerator INHERITED;
41 }; 47 };
42
43 #endif //defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698