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" | |
|
scroggo
2015/07/31 15:05:43
I think this is not needed?
msarett
2015/08/03 22:52:35
Done.
| |
| 11 #include "SkImageInfo.h" | |
| 12 #include "SkMaskSwizzler.h" | |
| 13 #include "SkStream.h" | |
|
scroggo
2015/07/31 15:05:43
This can be forward declared.
msarett
2015/08/03 22:52:35
We actually don't need to include it at all.
Out
scroggo
2015/08/04 16:16:46
Google's style guide has a nice succinct section o
| |
| 14 #include "SkSwizzler.h" | |
|
scroggo
2015/07/31 15:05:43
Is this necessary?
msarett
2015/08/03 22:52:35
Nope.
| |
| 15 #include "SkTypes.h" | |
| 16 | |
| 17 /* | |
| 18 * This class implements the decoding for bmp images | |
|
scroggo
2015/07/31 15:05:43
For a specific type, right?
msarett
2015/08/03 22:52:35
Yes
| |
| 19 */ | |
| 20 class SkBmpMaskCodec : 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; } | |
|
scroggo
2015/07/31 15:05:43
If these all inherited from SkBmpCodec, that class
msarett
2015/08/03 22:52:35
Done.
| |
| 31 | |
| 32 private: | |
| 33 | |
| 34 /* | |
| 35 * Used to define the input format of the bmp | |
| 36 */ | |
| 37 enum BitmapInputFormat { | |
|
scroggo
2015/07/31 15:05:43
Isn't this the same as in SkBmpCodec? Why the dupl
msarett
2015/08/03 22:52:35
This was accidental. Sorry.
| |
| 38 kStandard_BitmapInputFormat, | |
| 39 kRLE_BitmapInputFormat, | |
| 40 kBitMask_BitmapInputFormat, | |
| 41 kUnknown_BitmapInputFormat | |
| 42 }; | |
| 43 | |
| 44 /* | |
| 45 * Initialize swizzler | |
|
scroggo
2015/07/31 15:05:43
These comments don't really add much, do they?
msarett
2015/08/03 22:52:35
No they don't. Removing them.
| |
| 46 */ | |
| 47 bool initializeSwizzler(const SkImageInfo& dstInfo); | |
| 48 | |
| 49 /* | |
| 50 * Performs the decoding | |
| 51 */ | |
| 52 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, | |
| 53 const Options& opts); | |
| 54 | |
| 55 /* | |
| 56 * Creates an instance of the decoder | |
| 57 * Called only by NewFromStream | |
|
scroggo
2015/07/31 15:05:43
nit: SkBmpCodec::NewFromStream.
msarett
2015/08/03 22:52:35
Done.
| |
| 58 * | |
| 59 * @param srcInfo contains the source width and height | |
| 60 * @param stream the stream of image data | |
| 61 * @param bitsPerPixel the number of bits used to store each pixel | |
| 62 * @param masks color masks for certain bmp formats | |
| 63 * @param rowOrder indicates whether rows are ordered top-down or bottom-up | |
| 64 */ | |
| 65 SkBmpMaskCodec(const SkImageInfo& srcInfo, SkStream* stream, | |
| 66 uint16_t bitsPerPixel, SkMasks* masks, | |
| 67 SkBmpCodec::RowOrder rowOrder); | |
| 68 | |
| 69 // Fields | |
| 70 const uint16_t fBitsPerPixel; | |
| 71 SkAutoTDelete<SkMasks> fMasks; // owned | |
| 72 const SkBmpCodec::RowOrder fRowOrder; | |
| 73 SkAutoTDelete<SkMaskSwizzler> fMaskSwizzler; | |
| 74 SkAutoTDeleteArray<uint8_t> fSrcBuffer; | |
| 75 bool fIsTransparent; | |
| 76 | |
| 77 friend class SkBmpCodec; | |
| 78 | |
| 79 typedef SkCodec INHERITED; | |
| 80 }; | |
| OLD | NEW |