| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "SkBmpCodec.h" | 8 #include "SkBmpCodec.h" |
| 9 #include "SkColorTable.h" | 9 #include "SkColorTable.h" |
| 10 #include "SkImageInfo.h" | 10 #include "SkImageInfo.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 * @param bitsPerPixel the number of bits used to store each pixel | 29 * @param bitsPerPixel the number of bits used to store each pixel |
| 30 * @param format the format of the bmp file | 30 * @param format the format of the bmp file |
| 31 * @param numColors the number of colors in the color table | 31 * @param numColors the number of colors in the color table |
| 32 * @param bytesPerColor the number of bytes in the stream used to represent | 32 * @param bytesPerColor the number of bytes in the stream used to represent |
| 33 each color in the color table | 33 each color in the color table |
| 34 * @param offset the offset of the image pixel data from the end of the | 34 * @param offset the offset of the image pixel data from the end of the |
| 35 * headers | 35 * headers |
| 36 * @param rowOrder indicates whether rows are ordered top-down or bottom-up | 36 * @param rowOrder indicates whether rows are ordered top-down or bottom-up |
| 37 */ | 37 */ |
| 38 SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream, | 38 SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream, |
| 39 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor
, | 39 SkBmpCodec::BmpInputFormat inputFormat, uint16_t bitsPerPixel, |
| 40 uint32_t offset, SkBmpCodec::RowOrder rowOrder, bool isIco); | 40 uint32_t numColors, uint32_t bytesPerColor, uint32_t offset, |
| 41 SkBmpCodec::RowOrder rowOrder, bool isIco); |
| 41 | 42 |
| 42 protected: | 43 protected: |
| 43 | 44 |
| 44 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, | 45 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
| 45 size_t dstRowBytes, const Options&, SkPMColor*, | 46 size_t dstRowBytes, const Options&, SkPMColor*, |
| 46 int*) override; | 47 int*) override; |
| 47 | 48 |
| 48 bool onInIco() const override { | 49 bool onInIco() const override { |
| 49 return fInIco; | 50 return fInIco; |
| 50 } | 51 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, con
st Options& opts); | 62 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, con
st Options& opts); |
| 62 | 63 |
| 63 SkAutoTUnref<SkColorTable> fColorTable; // owned | 64 SkAutoTUnref<SkColorTable> fColorTable; // owned |
| 64 const uint32_t fNumColors; | 65 const uint32_t fNumColors; |
| 65 const uint32_t fBytesPerColor; | 66 const uint32_t fBytesPerColor; |
| 66 const uint32_t fOffset; | 67 const uint32_t fOffset; |
| 67 SkAutoTDelete<SkSwizzler> fSwizzler; | 68 SkAutoTDelete<SkSwizzler> fSwizzler; |
| 68 SkAutoTDeleteArray<uint8_t> fSrcBuffer; | 69 SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
| 69 const bool fInIco; | 70 const bool fInIco; |
| 70 | 71 |
| 72 friend class SkBmpStandardScanlineDecoder; |
| 73 |
| 71 typedef SkBmpCodec INHERITED; | 74 typedef SkBmpCodec INHERITED; |
| 72 }; | 75 }; |
| 76 |
| 77 /* |
| 78 * Scanline decoder for standard bmps |
| 79 */ |
| 80 class SkBmpStandardScanlineDecoder : public SkScanlineDecoder { |
| 81 public: |
| 82 SkBmpStandardScanlineDecoder(SkBmpStandardCodec* codec); |
| 83 |
| 84 SkCodec::Result onStart(const SkImageInfo& dstInfo, const SkCodec::Options&
options, |
| 85 SkPMColor inputColorPtr[], int* inputColorCount) ove
rride; |
| 86 |
| 87 SkCodec::Result onGetScanlines(void* dst, int count, size_t rowBytes) overri
de; |
| 88 |
| 89 // TODO(msarett): Override default skipping with something more clever. |
| 90 // TODO(msarett): Consider other optimizations for this codec. |
| 91 |
| 92 private: |
| 93 SkAutoTDelete<SkBmpStandardCodec> fCodec; |
| 94 SkImageInfo fDstInfo; |
| 95 SkCodec::Options fOpts; |
| 96 |
| 97 typedef SkScanlineDecoder INHERITED; |
| 98 }; |
| OLD | NEW |