OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkSwizzler_DEFINED | 8 #ifndef SkSwizzler_DEFINED |
9 #define SkSwizzler_DEFINED | 9 #define SkSwizzler_DEFINED |
10 | 10 |
11 #include "SkCodec.h" | 11 #include "SkCodec.h" |
12 #include "SkColor.h" | 12 #include "SkColor.h" |
13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
14 | 14 |
15 class SkSwizzler : public SkNoncopyable { | 15 class SkSwizzler : public SkNoncopyable { |
16 public: | 16 public: |
17 /** | 17 /** |
18 * Enum describing the config of the source data. | 18 * Enum describing the config of the source data. |
19 */ | 19 */ |
20 enum SrcConfig { | 20 enum SrcConfig { |
| 21 kUnknown, // Invalid type. |
21 kGray, | 22 kGray, |
22 kIndex1, | 23 kIndex1, |
23 kIndex2, | 24 kIndex2, |
24 kIndex4, | 25 kIndex4, |
25 kIndex, | 26 kIndex, |
26 kRGB, | 27 kRGB, |
27 kBGR, | 28 kBGR, |
28 kRGBX, | 29 kRGBX, |
29 kBGRX, | 30 kBGRX, |
30 kRGBA, | 31 kRGBA, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 138 |
138 /** | 139 /** |
139 * | 140 * |
140 * Alternate version of next that allows the caller to specify the row. | 141 * Alternate version of next that allows the caller to specify the row. |
141 * It is very important to only use one version of next. Since the other | 142 * It is very important to only use one version of next. Since the other |
142 * version modifies the dst pointer, it will change the behavior of this | 143 * version modifies the dst pointer, it will change the behavior of this |
143 * function. We will check this in Debug mode. | 144 * function. We will check this in Debug mode. |
144 * | 145 * |
145 */ | 146 */ |
146 ResultAlpha next(const uint8_t* SK_RESTRICT src, int y); | 147 ResultAlpha next(const uint8_t* SK_RESTRICT src, int y); |
| 148 |
| 149 /** |
| 150 * Update the destination row. |
| 151 * |
| 152 * Typically this is done by next, but for a client that wants to manually |
| 153 * modify the destination row (for example, for decoding scanline one at a |
| 154 * time) they can call this before each call to next. |
| 155 * TODO: Maybe replace this with a version of next which allows supplying t
he |
| 156 * destination? |
| 157 */ |
| 158 void setDstRow(void* dst) { fDstRow = dst; } |
147 private: | 159 private: |
148 | 160 |
149 #ifdef SK_DEBUG | 161 #ifdef SK_DEBUG |
150 /* | 162 /* |
151 * | 163 * |
152 * Keep track of which version of next the caller is using | 164 * Keep track of which version of next the caller is using |
153 * | 165 * |
154 */ | 166 */ |
155 enum NextMode { | 167 enum NextMode { |
156 kUninitialized_NextMode, | 168 kUninitialized_NextMode, |
(...skipping 28 matching lines...) Expand all Loading... |
185 const SkImageInfo fDstInfo; | 197 const SkImageInfo fDstInfo; |
186 void* fDstRow; | 198 void* fDstRow; |
187 const size_t fDstRowBytes; | 199 const size_t fDstRowBytes; |
188 int fCurrY; | 200 int fCurrY; |
189 | 201 |
190 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, | 202 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, |
191 const SkImageInfo& info, void* dst, size_t rowBytes); | 203 const SkImageInfo& info, void* dst, size_t rowBytes); |
192 | 204 |
193 }; | 205 }; |
194 #endif // SkSwizzler_DEFINED | 206 #endif // SkSwizzler_DEFINED |
OLD | NEW |