aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkMaskSwizzler.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-03-16 11:55:18 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-16 11:55:18 -0700
commit741143878b23d22cd9cb7b9cba8055179115ce17 (patch)
treefc813d3048f08e1e641fac2e2552971acbc63db8 /src/codec/SkMaskSwizzler.h
parent354eba5cb61801130a84378356434d3cc0a4b71a (diff)
Revert "Revert of fix for invalid for loop syntax broke build (patchset #1 id:1 of https://codereview.chromium.org/1007373003/)"
This reverts commit d18475854ce232de71c5463e0654f459d4abfd43. Revert "Revert "Implementation of image decoding for bmp files, in accordance with the new API."" This reverts commit dfdec78a5d02e8690998741a9fe5b71a08ca3232. BUG=skia: TBR= Review URL: https://codereview.chromium.org/1016443003
Diffstat (limited to 'src/codec/SkMaskSwizzler.h')
-rw-r--r--src/codec/SkMaskSwizzler.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/codec/SkMaskSwizzler.h b/src/codec/SkMaskSwizzler.h
new file mode 100644
index 0000000000..9351f0228b
--- /dev/null
+++ b/src/codec/SkMaskSwizzler.h
@@ -0,0 +1,60 @@
+/*
+ * 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 "SkMasks.h"
+#include "SkSwizzler.h"
+#include "SkTypes.h"
+
+/*
+ *
+ * Used to swizzle images whose pixel components are extracted by bit masks
+ * Currently only used by bmp
+ *
+ */
+class SkMaskSwizzler {
+public:
+
+ /*
+ *
+ * Create a new swizzler
+ * @param masks Unowned pointer to helper class
+ *
+ */
+ static SkMaskSwizzler* CreateMaskSwizzler(const SkImageInfo& imageInfo,
+ SkMasks* masks,
+ uint32_t bitsPerPixel);
+
+ /*
+ *
+ * Swizzle the next row
+ *
+ */
+ SkSwizzler::ResultAlpha next(void* dst, const uint8_t* src);
+
+private:
+
+ /*
+ *
+ * Row procedure used for swizzle
+ *
+ */
+ typedef SkSwizzler::ResultAlpha (*RowProc)(
+ void* dstRow, const uint8_t* srcRow, int width,
+ SkMasks* masks);
+
+ /*
+ *
+ * Constructor for mask swizzler
+ *
+ */
+ SkMaskSwizzler(const SkImageInfo& info, SkMasks* masks, RowProc proc);
+
+ // Fields
+ const SkImageInfo& fImageInfo;
+ SkMasks* fMasks; // unowned
+ const RowProc fRowProc;
+};