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 #include "SkTypes.h" |
| 8 |
| 9 /* |
| 10 * |
| 11 * Contains useful mask routines for SkMaskSwizzler |
| 12 * |
| 13 */ |
| 14 class SkMasks { |
| 15 public: |
| 16 |
| 17 /* |
| 18 * |
| 19 * Input bit masks format |
| 20 * |
| 21 */ |
| 22 struct InputMasks { |
| 23 uint32_t red; |
| 24 uint32_t green; |
| 25 uint32_t blue; |
| 26 uint32_t alpha; |
| 27 }; |
| 28 |
| 29 /* |
| 30 * |
| 31 * Create the masks object |
| 32 * |
| 33 */ |
| 34 static SkMasks* CreateMasks(InputMasks masks, uint32_t bpp); |
| 35 |
| 36 /* |
| 37 * |
| 38 * Get a color component |
| 39 * |
| 40 */ |
| 41 uint8_t getRed(uint32_t pixel); |
| 42 uint8_t getGreen(uint32_t pixel); |
| 43 uint8_t getBlue(uint32_t pixel); |
| 44 uint8_t getAlpha(uint32_t pixel); |
| 45 |
| 46 /* |
| 47 * |
| 48 * Getter for the alpha mask |
| 49 * The alpha mask may be used in other decoding modes |
| 50 * |
| 51 */ |
| 52 uint32_t getAlphaMask() { |
| 53 return fAlpha.mask; |
| 54 } |
| 55 |
| 56 private: |
| 57 |
| 58 /* |
| 59 * |
| 60 * Contains all of the information for a single mask |
| 61 * |
| 62 */ |
| 63 struct MaskInfo { |
| 64 uint32_t mask; |
| 65 uint32_t shift; |
| 66 uint32_t size; |
| 67 }; |
| 68 |
| 69 /* |
| 70 * |
| 71 * Process an input mask |
| 72 * |
| 73 */ |
| 74 static const MaskInfo ProcessMask(uint32_t mask, uint32_t bpp); |
| 75 |
| 76 /* |
| 77 * |
| 78 * Constrcutor |
| 79 * |
| 80 */ |
| 81 SkMasks(const MaskInfo red, const MaskInfo green, const MaskInfo blue, |
| 82 const MaskInfo alpha); |
| 83 |
| 84 const MaskInfo fRed; |
| 85 const MaskInfo fGreen; |
| 86 const MaskInfo fBlue; |
| 87 const MaskInfo fAlpha; |
| 88 }; |
OLD | NEW |