Chromium Code Reviews| 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 #include "SkBmpCodec.h" | |
| 9 #include "SkCodec.h" | |
| 10 #include "SkColorTable.h" | |
| 11 #include "SkImageInfo.h" | |
| 12 #include "SkMaskSwizzler.h" | |
|
scroggo
2015/07/31 15:05:44
This is not used by this class.
msarett
2015/08/03 22:52:35
Done.
| |
| 13 #include "SkStream.h" | |
|
scroggo
2015/07/31 15:05:44
I think this can be forward declared.
msarett
2015/08/03 22:52:35
Acknowledged.
| |
| 14 #include "SkSwizzler.h" | |
| 15 #include "SkTypes.h" | |
| 16 | |
| 17 /* | |
| 18 * This class implements the decoding for bmp images | |
|
scroggo
2015/07/31 15:05:44
Which kind?
msarett
2015/08/03 22:52:35
Improved this description
| |
| 19 */ | |
| 20 class SkBmpStandardCodec : public SkCodec { | |
| 21 protected: | |
| 22 | |
| 23 /* | |
| 24 * Initiates the bmp decode | |
| 25 */ | |
| 26 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, | |
| 27 size_t dstRowBytes, const Options&, SkPMColor*, | |
| 28 int*) override; | |
| 29 | |
| 30 SkEncodedFormat onGetEncodedFormat() const override { return kBMP_SkEncodedF ormat; } | |
| 31 | |
| 32 private: | |
| 33 | |
| 34 /* | |
| 35 * Creates the color table | |
| 36 * Sets colorCount to the new color count if it is non-NULL | |
| 37 */ | |
| 38 bool createColorTable(SkAlphaType alphaType, int* colorCount); | |
| 39 | |
| 40 /* | |
| 41 * Initialize swizzler | |
| 42 */ | |
| 43 bool initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts); | |
| 44 | |
| 45 /* | |
| 46 * Performs the bitmap decoding for standard input format | |
| 47 */ | |
| 48 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, con st Options& opts); | |
| 49 | |
| 50 /* | |
| 51 * Creates an instance of the decoder | |
| 52 * Called only by NewFromStream | |
| 53 * | |
| 54 * @param srcInfo contains the source width and height | |
| 55 * @param stream the stream of image data | |
| 56 * @param bitsPerPixel the number of bits used to store each pixel | |
| 57 * @param format the format of the bmp file | |
| 58 * @param numColors the number of colors in the color table | |
| 59 * @param bytesPerColor the number of bytes in the stream used to represent | |
| 60 each color in the color table | |
| 61 * @param offset the offset of the image pixel data from the end of the | |
| 62 * headers | |
| 63 * @param rowOrder indicates whether rows are ordered top-down or bottom-up | |
| 64 */ | |
| 65 SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream, | |
| 66 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor , | |
| 67 uint32_t offset, SkBmpCodec::RowOrder rowOrder, bool isIco); | |
| 68 | |
| 69 // Fields | |
|
scroggo
2015/07/31 15:05:44
comment not needed.
msarett
2015/08/03 22:52:35
Done.
| |
| 70 const uint16_t fBitsPerPixel; | |
|
scroggo
2015/07/31 15:05:44
This looks to be used by all three codecs.
You ca
msarett
2015/08/03 22:52:35
Done. fRowOrder can also be shared.
| |
| 71 SkAutoTUnref<SkColorTable> fColorTable; // owned | |
| 72 uint32_t fNumColors; | |
| 73 const uint32_t fBytesPerColor; | |
| 74 const uint32_t fOffset; | |
| 75 const SkBmpCodec::RowOrder fRowOrder; | |
| 76 SkAutoTDelete<SkSwizzler> fSwizzler; | |
| 77 SkAutoTDeleteArray<uint8_t> fSrcBuffer; | |
| 78 const bool fIsIco; | |
| 79 bool fIsTransparent; | |
| 80 | |
| 81 friend class SkBmpCodec; | |
| 82 | |
| 83 typedef SkCodec INHERITED; | |
| 84 }; | |
| OLD | NEW |