OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 12 matching lines...) Expand all Loading... |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef DecodingImageGenerator_h | 26 #ifndef DecodingImageGenerator_h |
27 #define DecodingImageGenerator_h | 27 #define DecodingImageGenerator_h |
28 | 28 |
29 #include "SkImageGenerator.h" | 29 #include "SkImageGenerator.h" |
30 #include "SkImageInfo.h" | 30 #include "SkImageInfo.h" |
31 | 31 |
32 #include "platform/PlatformExport.h" | 32 #include "platform/PlatformExport.h" |
| 33 #include "wtf/Allocator.h" |
| 34 #include "wtf/Noncopyable.h" |
33 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
34 | 36 |
35 class SkData; | 37 class SkData; |
36 | 38 |
37 namespace blink { | 39 namespace blink { |
38 | 40 |
39 class ImageFrameGenerator; | 41 class ImageFrameGenerator; |
40 | 42 |
41 // Implements SkImageGenerator and used by SkPixelRef to populate a discardable | 43 // Implements SkImageGenerator and used by SkPixelRef to populate a discardable |
42 // memory with decoded pixels. | 44 // memory with decoded pixels. |
43 // | 45 // |
44 // This class does not own an ImageDecode. It does not own encoded data. It serv
es | 46 // This class does not own an ImageDecode. It does not own encoded data. It serv
es |
45 // as and adapter to ImageFrameGenerator which actually performs decoding. | 47 // as and adapter to ImageFrameGenerator which actually performs decoding. |
46 class PLATFORM_EXPORT DecodingImageGenerator final : public SkImageGenerator { | 48 class PLATFORM_EXPORT DecodingImageGenerator final : public SkImageGenerator { |
| 49 USING_FAST_MALLOC(DecodingImageGenerator); |
| 50 WTF_MAKE_NONCOPYABLE(DecodingImageGenerator); |
47 public: | 51 public: |
48 static SkImageGenerator* create(SkData*); | 52 static SkImageGenerator* create(SkData*); |
49 | 53 |
50 DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>, const SkImageInfo&,
size_t index); | 54 DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>, const SkImageInfo&,
size_t index); |
51 ~DecodingImageGenerator() override; | 55 ~DecodingImageGenerator() override; |
52 | 56 |
53 void setGenerationId(size_t id) { m_generationId = id; } | 57 void setGenerationId(size_t id) { m_generationId = id; } |
54 | 58 |
55 protected: | 59 protected: |
56 SkData* onRefEncodedData() override; | 60 SkData* onRefEncodedData() override; |
57 | 61 |
58 bool onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes, | 62 bool onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes, |
59 SkPMColor ctable[], int* ctableCount) override; | 63 SkPMColor ctable[], int* ctableCount) override; |
60 | 64 |
61 bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
SkYUVColorSpace*) override; | 65 bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
SkYUVColorSpace*) override; |
62 | 66 |
63 private: | 67 private: |
64 RefPtr<ImageFrameGenerator> m_frameGenerator; | 68 RefPtr<ImageFrameGenerator> m_frameGenerator; |
65 size_t m_frameIndex; | 69 size_t m_frameIndex; |
66 size_t m_generationId; | 70 size_t m_generationId; |
67 }; | 71 }; |
68 | 72 |
69 } // namespace blink | 73 } // namespace blink |
70 | 74 |
71 #endif // DecodingImageGenerator_h_ | 75 #endif // DecodingImageGenerator_h_ |
OLD | NEW |