OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 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 SkRawCodec_DEFINED |
| 9 #define SkRawCodec_DEFINED |
| 10 |
| 11 #include "SkCodec.h" |
| 12 #include "SkImageInfo.h" |
| 13 #include "SkStream.h" |
| 14 |
| 15 #include "dng_host.h" |
| 16 |
| 17 /* |
| 18 * |
| 19 * This class implements the decoding for jpeg images |
| 20 * |
| 21 */ |
| 22 class SkRawCodec : public SkCodec { |
| 23 public: |
| 24 |
| 25 /* |
| 26 * Checks the start of the stream to see if the image is a RAW |
| 27 * Does not take ownership of the stream |
| 28 */ |
| 29 static bool IsRaw(SkStream*); |
| 30 |
| 31 /* |
| 32 * Assumes IsRaw was called and returned true |
| 33 * Creates a RAW decoder |
| 34 * Takes ownership of the stream |
| 35 */ |
| 36 static SkCodec* NewFromStream(SkStream*); |
| 37 |
| 38 protected: |
| 39 |
| 40 /* |
| 41 * Recommend a set of destination dimensions given a requested scale |
| 42 */ |
| 43 //SkISize onGetScaledDimensions(float desiredScale) const override; |
| 44 |
| 45 /* |
| 46 * Initiates the RAW decode |
| 47 */ |
| 48 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes
, const Options&, |
| 49 SkPMColor*, int*, int*) override; |
| 50 |
| 51 SkEncodedFormat onGetEncodedFormat() const override { |
| 52 return kRAW_SkEncodedFormat; |
| 53 } |
| 54 |
| 55 /*bool onRewind() override; |
| 56 |
| 57 bool onDimensionsSupported(const SkISize&) override;*/ |
| 58 |
| 59 private: |
| 60 |
| 61 /* |
| 62 * Creates an instance of the decoder |
| 63 * Called only by NewFromStream |
| 64 * |
| 65 * @param srcInfo contains the source width and height |
| 66 * @param stream the encoded image data |
| 67 */ |
| 68 SkRawCodec(const SkImageInfo& srcInfo, SkStream* stream, |
| 69 std::unique_ptr<dng_host>* host, |
| 70 std::unique_ptr<dng_negative>* negative); |
| 71 |
| 72 // scanline decoding |
| 73 /*void initializeSwizzler(const SkImageInfo& dstInfo, const Options& options
); |
| 74 SkSampler* getSampler(bool createIfNecessary) override; |
| 75 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opti
ons, |
| 76 SkPMColor ctable[], int* ctableCount) override; |
| 77 int onGetScanlines(void* dst, int count, size_t rowBytes) override; |
| 78 bool onSkipScanlines(int count) override;*/ |
| 79 |
| 80 std::unique_ptr<dng_host> host_; |
| 81 std::unique_ptr<dng_negative> negative_; |
| 82 typedef SkCodec INHERITED; |
| 83 }; |
| 84 |
| 85 #endif |
OLD | NEW |