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

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

Issue 1785613010: Add SkImageGeneratorWIC (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Blacklist bad images 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 | « public.bzl ('k') | src/ports/SkImageGeneratorWIC.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkTypes.h"
9
10 #if defined(SK_BUILD_FOR_WIN)
11
12 #include "SkData.h"
13 #include "SkImageGenerator.h"
14 #include "SkTemplates.h"
15 #include "SkTScopedComPtr.h"
16
17 #include <wincodec.h>
18
19 /*
20 * Any Windows program that uses COM must initialize the COM library by calling
21 * the CoInitializeEx function. In addition, each thread that uses a COM
22 * interface must make a separate call to this function.
23 *
24 * For every successful call to CoInitializeEx, the thread must call
25 * CoUninitialize before it exits.
26 *
27 * SkImageGeneratorWIC requires the COM library and leaves it to the client to
28 * initialize COM for their application.
29 *
30 * For more information on initializing COM, please see:
31 * https://msdn.microsoft.com/en-us/library/windows/desktop/ff485844.aspx
32 */
33 class SkImageGeneratorWIC : public SkImageGenerator {
34 public:
35 /*
36 * Refs the data if an image generator can be returned. Otherwise does
37 * not affect the data.
38 */
39 static SkImageGenerator* NewFromEncodedWIC(SkData* data);
40
41 protected:
42 SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) override;
43
44 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkP MColor ctable[],
45 int* ctableCount) override;
46
47 private:
48 /*
49 * Takes ownership of the imagingFactory
50 * Takes ownership of the imageSource
51 * Refs the data
52 */
53 SkImageGeneratorWIC(const SkImageInfo& info, IWICImagingFactory* imagingFact ory,
54 IWICBitmapSource* imageSource, SkData* data);
55
56 SkTScopedComPtr<IWICImagingFactory> fImagingFactory;
57 SkTScopedComPtr<IWICBitmapSource> fImageSource;
58 SkAutoTUnref<SkData> fData;
59
60 typedef SkImageGenerator INHERITED;
61 };
62
63 #endif // SK_BUILD_FOR_WIN
OLDNEW
« no previous file with comments | « public.bzl ('k') | src/ports/SkImageGeneratorWIC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698