Index: src/codec/SkBmpStandardCodec.h |
diff --git a/src/codec/SkBmpStandardCodec.h b/src/codec/SkBmpStandardCodec.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f1bed5a5790c84d8d6dd4a20324e12a600d1adf3 |
--- /dev/null |
+++ b/src/codec/SkBmpStandardCodec.h |
@@ -0,0 +1,84 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "SkBmpCodec.h" |
+#include "SkCodec.h" |
+#include "SkColorTable.h" |
+#include "SkImageInfo.h" |
+#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.
|
+#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.
|
+#include "SkSwizzler.h" |
+#include "SkTypes.h" |
+ |
+/* |
+ * 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
|
+ */ |
+class SkBmpStandardCodec : public SkCodec { |
+protected: |
+ |
+ /* |
+ * Initiates the bmp decode |
+ */ |
+ Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
+ size_t dstRowBytes, const Options&, SkPMColor*, |
+ int*) override; |
+ |
+ SkEncodedFormat onGetEncodedFormat() const override { return kBMP_SkEncodedFormat; } |
+ |
+private: |
+ |
+ /* |
+ * Creates the color table |
+ * Sets colorCount to the new color count if it is non-NULL |
+ */ |
+ bool createColorTable(SkAlphaType alphaType, int* colorCount); |
+ |
+ /* |
+ * Initialize swizzler |
+ */ |
+ bool initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts); |
+ |
+ /* |
+ * Performs the bitmap decoding for standard input format |
+ */ |
+ Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, const Options& opts); |
+ |
+ /* |
+ * Creates an instance of the decoder |
+ * Called only by NewFromStream |
+ * |
+ * @param srcInfo contains the source width and height |
+ * @param stream the stream of image data |
+ * @param bitsPerPixel the number of bits used to store each pixel |
+ * @param format the format of the bmp file |
+ * @param numColors the number of colors in the color table |
+ * @param bytesPerColor the number of bytes in the stream used to represent |
+ each color in the color table |
+ * @param offset the offset of the image pixel data from the end of the |
+ * headers |
+ * @param rowOrder indicates whether rows are ordered top-down or bottom-up |
+ */ |
+ SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream, |
+ uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor, |
+ uint32_t offset, SkBmpCodec::RowOrder rowOrder, bool isIco); |
+ |
+ // Fields |
scroggo
2015/07/31 15:05:44
comment not needed.
msarett
2015/08/03 22:52:35
Done.
|
+ 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.
|
+ SkAutoTUnref<SkColorTable> fColorTable; // owned |
+ uint32_t fNumColors; |
+ const uint32_t fBytesPerColor; |
+ const uint32_t fOffset; |
+ const SkBmpCodec::RowOrder fRowOrder; |
+ SkAutoTDelete<SkSwizzler> fSwizzler; |
+ SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
+ const bool fIsIco; |
+ bool fIsTransparent; |
+ |
+ friend class SkBmpCodec; |
+ |
+ typedef SkCodec INHERITED; |
+}; |