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

Side by Side Diff: src/core/SkSpriteBlitter_RGB16.cpp

Issue 386203002: don't draw unpremul alpha (yet) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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/core/SkBitmapProcState.cpp ('k') | no next file » | 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkSpriteBlitter.h" 10 #include "SkSpriteBlitter.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 if (paint.getMaskFilter() != NULL) { // may add cases for this 314 if (paint.getMaskFilter() != NULL) { // may add cases for this
315 return NULL; 315 return NULL;
316 } 316 }
317 if (paint.getXfermode() != NULL) { // may add cases for this 317 if (paint.getXfermode() != NULL) { // may add cases for this
318 return NULL; 318 return NULL;
319 } 319 }
320 if (paint.getColorFilter() != NULL) { // may add cases for this 320 if (paint.getColorFilter() != NULL) { // may add cases for this
321 return NULL; 321 return NULL;
322 } 322 }
323 323
324 const SkAlphaType at = source.alphaType();
325
324 SkSpriteBlitter* blitter = NULL; 326 SkSpriteBlitter* blitter = NULL;
325 unsigned alpha = paint.getAlpha(); 327 unsigned alpha = paint.getAlpha();
326 328
327 switch (source.colorType()) { 329 switch (source.colorType()) {
328 case kN32_SkColorType: { 330 case kN32_SkColorType: {
331 if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
332 break;
333 }
329 blitter = allocator->createT<Sprite_D16_S32_BlitRowProc>(source); 334 blitter = allocator->createT<Sprite_D16_S32_BlitRowProc>(source);
330 break; 335 break;
331 } 336 }
332 case kARGB_4444_SkColorType: 337 case kARGB_4444_SkColorType:
338 if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
339 break;
340 }
333 if (255 == alpha) { 341 if (255 == alpha) {
334 blitter = allocator->createT<Sprite_D16_S4444_Opaque>(source); 342 blitter = allocator->createT<Sprite_D16_S4444_Opaque>(source);
335 } else { 343 } else {
336 blitter = allocator->createT<Sprite_D16_S4444_Blend>(source, alp ha >> 4); 344 blitter = allocator->createT<Sprite_D16_S4444_Blend>(source, alp ha >> 4);
337 } 345 }
338 break; 346 break;
339 case kRGB_565_SkColorType: 347 case kRGB_565_SkColorType:
340 if (255 == alpha) { 348 if (255 == alpha) {
341 blitter = allocator->createT<Sprite_D16_S16_Opaque>(source); 349 blitter = allocator->createT<Sprite_D16_S16_Opaque>(source);
342 } else { 350 } else {
343 blitter = allocator->createT<Sprite_D16_S16_Blend>(source, alpha ); 351 blitter = allocator->createT<Sprite_D16_S16_Blend>(source, alpha );
344 } 352 }
345 break; 353 break;
346 case kIndex_8_SkColorType: 354 case kIndex_8_SkColorType:
355 if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
356 break;
357 }
347 if (paint.isDither()) { 358 if (paint.isDither()) {
348 // we don't support dither yet in these special cases 359 // we don't support dither yet in these special cases
349 break; 360 break;
350 } 361 }
351 if (source.isOpaque()) { 362 if (source.isOpaque()) {
352 if (255 == alpha) { 363 if (255 == alpha) {
353 blitter = allocator->createT<Sprite_D16_SIndex8_Opaque>(sour ce); 364 blitter = allocator->createT<Sprite_D16_SIndex8_Opaque>(sour ce);
354 } else { 365 } else {
355 blitter = allocator->createT<Sprite_D16_SIndex8_Blend>(sourc e, alpha); 366 blitter = allocator->createT<Sprite_D16_SIndex8_Blend>(sourc e, alpha);
356 } 367 }
357 } else { 368 } else {
358 if (255 == alpha) { 369 if (255 == alpha) {
359 blitter = allocator->createT<Sprite_D16_SIndex8A_Opaque>(sou rce); 370 blitter = allocator->createT<Sprite_D16_SIndex8A_Opaque>(sou rce);
360 } else { 371 } else {
361 blitter = allocator->createT<Sprite_D16_SIndex8A_Blend>(sour ce, alpha); 372 blitter = allocator->createT<Sprite_D16_SIndex8A_Blend>(sour ce, alpha);
362 } 373 }
363 } 374 }
364 break; 375 break;
365 default: 376 default:
366 break; 377 break;
367 } 378 }
368 return blitter; 379 return blitter;
369 } 380 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698