Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(682)

Side by Side Diff: src/codec/SkMaskSwizzler.cpp

Issue 1256373002: Pass the destination pointer to next (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Thanks windows bot! Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/codec/SkMaskSwizzler.h ('k') | src/codec/SkSwizzler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkMaskSwizzler.h" 10 #include "SkMaskSwizzler.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 return COMPUTE_RESULT_ALPHA; 168 return COMPUTE_RESULT_ALPHA;
169 } 169 }
170 170
171 /* 171 /*
172 * 172 *
173 * Create a new mask swizzler 173 * Create a new mask swizzler
174 * 174 *
175 */ 175 */
176 SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler( 176 SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(
177 const SkImageInfo& info, void* dst, size_t dstRowBytes, SkMasks* masks, 177 const SkImageInfo& info, SkMasks* masks, uint32_t bitsPerPixel) {
178 uint32_t bitsPerPixel) {
179 178
180 // Choose the appropriate row procedure 179 // Choose the appropriate row procedure
181 RowProc proc = NULL; 180 RowProc proc = NULL;
182 switch (bitsPerPixel) { 181 switch (bitsPerPixel) {
183 case 16: 182 case 16:
184 switch (info.colorType()) { 183 switch (info.colorType()) {
185 case kN32_SkColorType: 184 case kN32_SkColorType:
186 switch (info.alphaType()) { 185 switch (info.alphaType()) {
187 case kUnpremul_SkAlphaType: 186 case kUnpremul_SkAlphaType:
188 proc = &swizzle_mask16_to_n32_unpremul; 187 proc = &swizzle_mask16_to_n32_unpremul;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 239 }
241 break; 240 break;
242 default: 241 default:
243 break; 242 break;
244 } 243 }
245 break; 244 break;
246 default: 245 default:
247 SkASSERT(false); 246 SkASSERT(false);
248 return NULL; 247 return NULL;
249 } 248 }
250 return SkNEW_ARGS(SkMaskSwizzler, (info, dst, dstRowBytes, masks, proc)); 249 return SkNEW_ARGS(SkMaskSwizzler, (info, masks, proc));
251 } 250 }
252 251
253 /* 252 /*
254 * 253 *
255 * Constructor for mask swizzler 254 * Constructor for mask swizzler
256 * 255 *
257 */ 256 */
258 SkMaskSwizzler::SkMaskSwizzler(const SkImageInfo& dstInfo, void* dst, 257 SkMaskSwizzler::SkMaskSwizzler(const SkImageInfo& dstInfo, SkMasks* masks,
259 size_t dstRowBytes, SkMasks* masks, RowProc proc) 258 RowProc proc)
260 : fDstInfo(dstInfo) 259 : fDstInfo(dstInfo)
261 , fDst(dst)
262 , fDstRowBytes(dstRowBytes)
263 , fMasks(masks) 260 , fMasks(masks)
264 , fRowProc(proc) 261 , fRowProc(proc)
265 {} 262 {}
266 263
267 /* 264 /*
268 * 265 *
269 * Swizzle the specified row 266 * Swizzle the specified row
270 * 267 *
271 */ 268 */
272 SkSwizzler::ResultAlpha SkMaskSwizzler::next(const uint8_t* SK_RESTRICT src, 269 SkSwizzler::ResultAlpha SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RES TRICT src) {
273 int y) { 270 SkASSERT(NULL != dst && NULL != src);
274 // Choose the row 271 return fRowProc(dst, src, fDstInfo.width(), fMasks);
275 void* row = SkTAddOffset<void>(fDst, y*fDstRowBytes);
276
277 // Decode the row
278 return fRowProc(row, src, fDstInfo.width(), fMasks);
279 } 272 }
OLDNEW
« no previous file with comments | « src/codec/SkMaskSwizzler.h ('k') | src/codec/SkSwizzler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698