Chromium Code Reviews| OLD | NEW |
|---|---|
| 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. | |
|
scroggo
2016/03/17 17:05:59
nit: So every thread that uses this needs to have
msarett
2016/03/17 17:32:35
Yes, I've tried to make this clearer.
| |
| 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) | |
| OLD | NEW |