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

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

Issue 1641273003: Support decoding opaque to *premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update SkMaskSwizzler to support opaque to premul Created 4 years, 10 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/SkJpegCodec.cpp ('k') | src/codec/SkPngCodec.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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 proc = &swizzle_mask16_to_n32_premul; 243 proc = &swizzle_mask16_to_n32_premul;
244 break; 244 break;
245 case kOpaque_SkAlphaType: 245 case kOpaque_SkAlphaType:
246 proc = &swizzle_mask16_to_n32_opaque; 246 proc = &swizzle_mask16_to_n32_opaque;
247 break; 247 break;
248 default: 248 default:
249 break; 249 break;
250 } 250 }
251 break; 251 break;
252 case kRGB_565_SkColorType: 252 case kRGB_565_SkColorType:
253 switch (dstInfo.alphaType()) { 253 proc = &swizzle_mask16_to_565;
scroggo 2016/02/03 14:58:45 These changes fix the crash I was seeing on the tr
msarett 2016/02/03 15:03:07 Acknowledged.
254 case kOpaque_SkAlphaType:
255 proc = &swizzle_mask16_to_565;
256 break;
257 default:
258 break;
259 }
260 break; 254 break;
261 default: 255 default:
262 break; 256 break;
263 } 257 }
264 break; 258 break;
265 case 24: 259 case 24:
266 switch (dstInfo.colorType()) { 260 switch (dstInfo.colorType()) {
267 case kN32_SkColorType: 261 case kN32_SkColorType:
268 switch (dstInfo.alphaType()) { 262 switch (dstInfo.alphaType()) {
269 case kUnpremul_SkAlphaType: 263 case kUnpremul_SkAlphaType:
270 proc = &swizzle_mask24_to_n32_unpremul; 264 proc = &swizzle_mask24_to_n32_unpremul;
271 break; 265 break;
272 case kPremul_SkAlphaType: 266 case kPremul_SkAlphaType:
273 proc = &swizzle_mask24_to_n32_premul; 267 proc = &swizzle_mask24_to_n32_premul;
274 break; 268 break;
275 case kOpaque_SkAlphaType: 269 case kOpaque_SkAlphaType:
276 proc = &swizzle_mask24_to_n32_opaque; 270 proc = &swizzle_mask24_to_n32_opaque;
277 break; 271 break;
278 default: 272 default:
279 break; 273 break;
280 } 274 }
281 break; 275 break;
282 case kRGB_565_SkColorType: 276 case kRGB_565_SkColorType:
283 switch (dstInfo.alphaType()) { 277 proc = &swizzle_mask24_to_565;
284 case kOpaque_SkAlphaType:
285 proc = &swizzle_mask24_to_565;
286 break;
287 default:
288 break;
289 }
290 break; 278 break;
291 default: 279 default:
292 break; 280 break;
293 } 281 }
294 break; 282 break;
295 case 32: 283 case 32:
296 switch (dstInfo.colorType()) { 284 switch (dstInfo.colorType()) {
297 case kN32_SkColorType: 285 case kN32_SkColorType:
298 switch (dstInfo.alphaType()) { 286 switch (dstInfo.alphaType()) {
299 case kUnpremul_SkAlphaType: 287 case kUnpremul_SkAlphaType:
300 proc = &swizzle_mask32_to_n32_unpremul; 288 proc = &swizzle_mask32_to_n32_unpremul;
301 break; 289 break;
302 case kPremul_SkAlphaType: 290 case kPremul_SkAlphaType:
303 proc = &swizzle_mask32_to_n32_premul; 291 proc = &swizzle_mask32_to_n32_premul;
304 break; 292 break;
305 case kOpaque_SkAlphaType: 293 case kOpaque_SkAlphaType:
306 proc = &swizzle_mask32_to_n32_opaque; 294 proc = &swizzle_mask32_to_n32_opaque;
307 break; 295 break;
308 default: 296 default:
309 break; 297 break;
310 } 298 }
311 break; 299 break;
312 case kRGB_565_SkColorType: 300 case kRGB_565_SkColorType:
313 switch (dstInfo.alphaType()) { 301 proc = &swizzle_mask32_to_565;
314 case kOpaque_SkAlphaType:
315 proc = &swizzle_mask32_to_565;
316 break;
317 default:
318 break;
319 }
320 break; 302 break;
321 default: 303 default:
322 break; 304 break;
323 } 305 }
324 break; 306 break;
325 default: 307 default:
326 SkASSERT(false); 308 SkASSERT(false);
327 return nullptr; 309 return nullptr;
328 } 310 }
329 311
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 349
368 /* 350 /*
369 * 351 *
370 * Swizzle the specified row 352 * Swizzle the specified row
371 * 353 *
372 */ 354 */
373 void SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) { 355 void SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) {
374 SkASSERT(nullptr != dst && nullptr != src); 356 SkASSERT(nullptr != dst && nullptr != src);
375 fRowProc(dst, src, fDstWidth, fMasks, fX0, fSampleX); 357 fRowProc(dst, src, fDstWidth, fMasks, fX0, fSampleX);
376 } 358 }
OLDNEW
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698