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