Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: src/codec/SkBmpCodec.h

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments - Does not compile - Needs rebase for conv_poss update Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/codec/SkBmpCodec.h
diff --git a/src/codec/SkBmpCodec.h b/src/codec/SkBmpCodec.h
index 71006f73153ea3028529b0c51daa999b498bc86e..b3cd40fa997883a23a17d7cf4633e0b5c1a3c4ff 100644
--- a/src/codec/SkBmpCodec.h
+++ b/src/codec/SkBmpCodec.h
@@ -11,6 +11,7 @@
#include "SkColorTable.h"
#include "SkImageInfo.h"
#include "SkMaskSwizzler.h"
+#include "SkScanlineDecoder.h"
#include "SkStream.h"
#include "SkSwizzler.h"
#include "SkTypes.h"
@@ -31,6 +32,16 @@ public:
};
/*
+ * Used to define the input format of the bmp
+ */
+ enum BmpInputFormat {
+ kStandard_BmpInputFormat,
+ kRLE_BmpInputFormat,
+ kBitMask_BmpInputFormat,
+ kUnknown_BmpInputFormat
+ };
+
+ /*
* Checks the start of the stream to see if the image is a bmp
*/
static bool IsBmp(SkStream*);
@@ -48,10 +59,17 @@ public:
*/
static SkCodec* NewFromIco(SkStream*);
+ /*
+ * Assumes IsBmp was called and returned true
+ * Creates a bmp scanline decoder
+ * Takes ownership of the stream
+ */
+ static SkScanlineDecoder* NewSDFromStream(SkStream* stream);
+
protected:
- SkBmpCodec(const SkImageInfo& info, SkStream* stream, uint16_t bitsPerPixel,
- RowOrder rowOrder);
+ SkBmpCodec(const SkImageInfo& info, SkStream* stream, BmpInputFormat inputFormat,
+ uint16_t bitsPerPixel, RowOrder rowOrder);
SkEncodedFormat onGetEncodedFormat() const override { return kBMP_SkEncodedFormat; }
@@ -104,8 +122,24 @@ private:
*/
static SkCodec* NewFromStream(SkStream*, bool inIco);
- const uint16_t fBitsPerPixel;
- const RowOrder fRowOrder;
+ /*
+ * Allow to BmpCodec subclasses to implement unique onStart() functions
scroggo 2015/08/14 21:53:00 Maybe mention that this relates to scanline decodi
msarett 2015/08/17 19:16:13 This is now shared with onGetPixels().
+ */
+ virtual SkCodec::Result onStart(const SkImageInfo& dstInfo, const SkCodec::Options& options,
scroggo 2015/08/14 21:53:01 I do not know whether it's good or bad that this s
msarett 2015/08/17 19:16:13 I think it makes sense to change the name because
+ SkPMColor inputColorPtr[], int* inputColorCount) = 0;
+
+ /*
+ * Performs the row by row decode
+ * Unique for each of the bmp subclasses
+ */
+ virtual Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes,
scroggo 2015/08/14 21:53:01 Can you add a description for these parameters? I
msarett 2015/08/17 19:16:13 Yeah I'm adding comments, this is awkward. Ideall
+ const Options& opts) = 0;
+
+ const BmpInputFormat fInputFormat;
+ const uint16_t fBitsPerPixel;
+ const RowOrder fRowOrder;
+
+ friend class SkBmpScanlineDecoder;
typedef SkCodec INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698