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 15 matching lines...) Expand all Loading... |
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 "wtf/RefPtr.h" | 32 #include "wtf/RefPtr.h" |
33 | 33 |
34 class SkData; | 34 class SkData; |
35 | 35 |
36 namespace WebCore { | 36 namespace blink { |
37 | 37 |
38 class ImageFrameGenerator; | 38 class ImageFrameGenerator; |
39 | 39 |
40 // Implements SkImageGenerator and used by SkPixelRef to populate a discardable | 40 // Implements SkImageGenerator and used by SkPixelRef to populate a discardable |
41 // memory with decoded pixels. | 41 // memory with decoded pixels. |
42 // | 42 // |
43 // This class does not own an ImageDecode. It does not own encoded data. It serv
es | 43 // This class does not own an ImageDecode. It does not own encoded data. It serv
es |
44 // as and adapter to ImageFrameGenerator which actually performs decoding. | 44 // as and adapter to ImageFrameGenerator which actually performs decoding. |
45 class DecodingImageGenerator FINAL : public SkImageGenerator { | 45 class DecodingImageGenerator FINAL : public SkImageGenerator { |
46 public: | 46 public: |
47 DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>, const SkImageInfo&,
size_t index); | 47 DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>, const SkImageInfo&,
size_t index); |
48 virtual ~DecodingImageGenerator(); | 48 virtual ~DecodingImageGenerator(); |
49 | 49 |
50 void setGenerationId(size_t id) { m_generationId = id; } | 50 void setGenerationId(size_t id) { m_generationId = id; } |
51 | 51 |
52 protected: | 52 protected: |
53 virtual SkData* onRefEncodedData() OVERRIDE; | 53 virtual SkData* onRefEncodedData() OVERRIDE; |
54 virtual bool onGetInfo(SkImageInfo*) OVERRIDE; | 54 virtual bool onGetInfo(SkImageInfo*) OVERRIDE; |
55 virtual bool onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount) OVERRIDE; | 55 virtual bool onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount) OVERRIDE; |
56 | 56 |
57 private: | 57 private: |
58 RefPtr<ImageFrameGenerator> m_frameGenerator; | 58 RefPtr<ImageFrameGenerator> m_frameGenerator; |
59 SkImageInfo m_imageInfo; | 59 SkImageInfo m_imageInfo; |
60 size_t m_frameIndex; | 60 size_t m_frameIndex; |
61 size_t m_generationId; | 61 size_t m_generationId; |
62 }; | 62 }; |
63 | 63 |
64 } // namespace WebCore | 64 } // namespace blink |
65 | 65 |
66 #endif // DecodingImageGenerator_h_ | 66 #endif // DecodingImageGenerator_h_ |
OLD | NEW |