Chromium Code Reviews| 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 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 * @param dstRowBytes rowBytes for dst. | 121 * @param dstRowBytes rowBytes for dst. |
| 122 * @param ZeroInitialized Whether dst is zero-initialized. The | 122 * @param ZeroInitialized Whether dst is zero-initialized. The |
| 123 implementation may choose to skip writing zeroes | 123 implementation may choose to skip writing zeroes |
| 124 * if set to kYes_ZeroInitialized. | 124 * if set to kYes_ZeroInitialized. |
| 125 * @return A new SkSwizzler or NULL on failure. | 125 * @return A new SkSwizzler or NULL on failure. |
| 126 */ | 126 */ |
| 127 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, | 127 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, |
| 128 const SkImageInfo&, void* dst, | 128 const SkImageInfo&, void* dst, |
| 129 size_t dstRowBytes, | 129 size_t dstRowBytes, |
| 130 SkImageGenerator::ZeroInitialized); | 130 SkImageGenerator::ZeroInitialized); |
| 131 | |
| 132 /** | |
| 133 * Fill the remainder of the destination with a single color | |
| 134 * @param y the starting row for the fill | |
| 135 * @param input the value to fill with - may be a color or an index | |
|
scroggo
2015/04/06 14:55:12
Maybe expand this comment to explain why it might
msarett
2015/04/06 18:10:56
Done.
| |
| 136 * @param colorTable a non-NULL colorTable indicates that the input is an index | |
| 137 * even if the dst color type is not an index type | |
| 138 */ | |
| 139 static void Fill(void* dst, const SkImageInfo& dstInfo, size_t dstRowBytes, uint32_t y, | |
| 140 uint32_t input, SkPMColor* colorTable); | |
|
scroggo
2015/04/06 14:55:12
I find it a little surprising that we do not need
msarett
2015/04/06 18:10:56
Yeah you are right. It works because we are alway
| |
| 141 | |
| 131 /** | 142 /** |
| 132 * Swizzle the next line. Call height times, once for each row of source. | 143 * Swizzle the next line. Call height times, once for each row of source. |
| 133 * @param src The next row of the source data. | 144 * @param src The next row of the source data. |
| 134 * @return A result code describing if the row was fully opaque, fully | 145 * @return A result code describing if the row was fully opaque, fully |
| 135 * transparent, or neither | 146 * transparent, or neither |
| 136 */ | 147 */ |
| 137 ResultAlpha next(const uint8_t* SK_RESTRICT src); | 148 ResultAlpha next(const uint8_t* SK_RESTRICT src); |
| 138 | 149 |
| 139 /** | 150 /** |
| 140 * | 151 * |
| 141 * Alternate version of next that allows the caller to specify the row. | 152 * Alternate version of next that allows the caller to specify the row. |
| 142 * It is very important to only use one version of next. Since the other | 153 * It is very important to only use one version of next. Since the other |
| 143 * version modifies the dst pointer, it will change the behavior of this | 154 * version modifies the dst pointer, it will change the behavior of this |
| 144 * function. We will check this in Debug mode. | 155 * function. We will check this in Debug mode. |
| 145 * | 156 * |
| 146 */ | 157 */ |
| 147 ResultAlpha next(const uint8_t* SK_RESTRICT src, int y); | 158 ResultAlpha next(const uint8_t* SK_RESTRICT src, int y); |
| 148 | 159 |
| 149 /** | 160 /** |
| 150 * Update the destination row. | 161 * Update the destination row. |
| 151 * | 162 * |
| 152 * Typically this is done by next, but for a client that wants to manually | 163 * 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 | 164 * modify the destination row (for example, for decoding scanline one at a |
| 154 * time) they can call this before each call to next. | 165 * 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 | 166 * TODO: Maybe replace this with a version of next which allows supplying t he |
| 156 * destination? | 167 * destination? |
| 157 */ | 168 */ |
| 158 void setDstRow(void* dst) { fDstRow = dst; } | 169 void setDstRow(void* dst) { fDstRow = dst; } |
| 170 | |
| 159 private: | 171 private: |
| 160 | 172 |
| 161 #ifdef SK_DEBUG | 173 #ifdef SK_DEBUG |
| 162 /* | 174 /* |
| 163 * | 175 * |
| 164 * Keep track of which version of next the caller is using | 176 * Keep track of which version of next the caller is using |
| 165 * | 177 * |
| 166 */ | 178 */ |
| 167 enum NextMode { | 179 enum NextMode { |
| 168 kUninitialized_NextMode, | 180 kUninitialized_NextMode, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 197 const SkImageInfo fDstInfo; | 209 const SkImageInfo fDstInfo; |
| 198 void* fDstRow; | 210 void* fDstRow; |
| 199 const size_t fDstRowBytes; | 211 const size_t fDstRowBytes; |
| 200 int fCurrY; | 212 int fCurrY; |
| 201 | 213 |
| 202 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, | 214 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, |
| 203 const SkImageInfo& info, void* dst, size_t rowBytes); | 215 const SkImageInfo& info, void* dst, size_t rowBytes); |
| 204 | 216 |
| 205 }; | 217 }; |
| 206 #endif // SkSwizzler_DEFINED | 218 #endif // SkSwizzler_DEFINED |
| OLD | NEW |