diff options
author | msarett <msarett@google.com> | 2015-03-16 11:55:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-16 11:55:18 -0700 |
commit | 741143878b23d22cd9cb7b9cba8055179115ce17 (patch) | |
tree | fc813d3048f08e1e641fac2e2552971acbc63db8 /src/codec/SkMasks.h | |
parent | 354eba5cb61801130a84378356434d3cc0a4b71a (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/SkMasks.h')
-rw-r--r-- | src/codec/SkMasks.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/codec/SkMasks.h b/src/codec/SkMasks.h new file mode 100644 index 0000000000..31c6849940 --- /dev/null +++ b/src/codec/SkMasks.h @@ -0,0 +1,81 @@ +/* + * 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 "SkTypes.h" + +/* + * + * Contains useful mask routines for SkMaskSwizzler + * + */ +class SkMasks { +public: + + /* + * + * Input bit masks format + * + */ + struct InputMasks { + uint32_t red; + uint32_t green; + uint32_t blue; + uint32_t alpha; + }; + + /* + * + * Contains all of the information for a single mask + * + */ + struct MaskInfo { + uint32_t mask; + uint32_t shift; + uint32_t size; + }; + + /* + * + * Create the masks object + * + */ + static SkMasks* CreateMasks(InputMasks masks, uint32_t bpp); + + /* + * + * Get a color component + * + */ + uint8_t getRed(uint32_t pixel); + uint8_t getGreen(uint32_t pixel); + uint8_t getBlue(uint32_t pixel); + uint8_t getAlpha(uint32_t pixel); + + /* + * + * Getter for the alpha mask + * The alpha mask may be used in other decoding modes + * + */ + uint32_t getAlphaMask() { + return fAlpha.mask; + } + +private: + + /* + * + * Constrcutor + * + */ + SkMasks(const MaskInfo red, const MaskInfo green, const MaskInfo blue, + const MaskInfo alpha); + + const MaskInfo fRed; + const MaskInfo fGreen; + const MaskInfo fBlue; + const MaskInfo fAlpha; +}; |