OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2013 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 #ifndef SkDecodingImageGenerator_DEFINED | |
9 #define SkDecodingImageGenerator_DEFINED | |
10 | |
11 #include "SkImageGenerator.h" | |
12 | |
13 class SkBitmap; | |
14 | |
15 /** | |
16 * Calls into SkImageDecoder::DecodeMemoryToTarget to implement a | |
17 * SkImageGenerator | |
18 */ | |
19 class SkDecodingImageGenerator : public SkImageGenerator { | |
20 public: | |
21 /* | |
22 * The constructor will take a reference to the SkData. The | |
23 * destructor will unref() it. | |
24 */ | |
25 SkDecodingImageGenerator(SkData* data); | |
26 virtual ~SkDecodingImageGenerator(); | |
27 | |
28 virtual SkData* refEncodedData() SK_OVERRIDE; | |
29 | |
30 virtual bool getInfo(SkImageInfo* info) SK_OVERRIDE; | |
31 | |
32 virtual bool getPixels(const SkImageInfo& info, | |
33 void* pixels, | |
34 size_t rowBytes) SK_OVERRIDE; | |
35 | |
36 /** | |
37 * Install the SkData into the destination bitmap, using a new | |
38 * SkDiscardablePixelRef and a new SkDecodingImageGenerator. | |
39 */ | |
40 static bool Install(SkData* data, SkBitmap* destination); | |
41 | |
42 private: | |
43 SkData* fData; | |
44 }; | |
45 #endif // SkDecodingImageGenerator_DEFINED | |
OLD | NEW |