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

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

Issue 173893002: use colortype instead of config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkScalerContext.cpp ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('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 /* 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"
11 #include "SkBlitRow.h" 11 #include "SkBlitRow.h"
12 #include "SkColorFilter.h" 12 #include "SkColorFilter.h"
13 #include "SkColorPriv.h" 13 #include "SkColorPriv.h"
14 #include "SkTemplates.h" 14 #include "SkTemplates.h"
15 #include "SkUtils.h" 15 #include "SkUtils.h"
16 #include "SkXfermode.h" 16 #include "SkXfermode.h"
17 17
18 /////////////////////////////////////////////////////////////////////////////// 18 ///////////////////////////////////////////////////////////////////////////////
19 19
20 class Sprite_D32_S32 : public SkSpriteBlitter { 20 class Sprite_D32_S32 : public SkSpriteBlitter {
21 public: 21 public:
22 Sprite_D32_S32(const SkBitmap& src, U8CPU alpha) : INHERITED(src) { 22 Sprite_D32_S32(const SkBitmap& src, U8CPU alpha) : INHERITED(src) {
23 SkASSERT(src.config() == SkBitmap::kARGB_8888_Config); 23 SkASSERT(src.colorType() == kPMColor_SkColorType);
24 24
25 unsigned flags32 = 0; 25 unsigned flags32 = 0;
26 if (255 != alpha) { 26 if (255 != alpha) {
27 flags32 |= SkBlitRow::kGlobalAlpha_Flag32; 27 flags32 |= SkBlitRow::kGlobalAlpha_Flag32;
28 } 28 }
29 if (!src.isOpaque()) { 29 if (!src.isOpaque()) {
30 flags32 |= SkBlitRow::kSrcPixelAlpha_Flag32; 30 flags32 |= SkBlitRow::kSrcPixelAlpha_Flag32;
31 } 31 }
32 32
33 fProc32 = SkBlitRow::Factory32(flags32); 33 fProc32 = SkBlitRow::Factory32(flags32);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 void* storage, size_t storageSize) { 270 void* storage, size_t storageSize) {
271 if (paint.getMaskFilter() != NULL) { 271 if (paint.getMaskFilter() != NULL) {
272 return NULL; 272 return NULL;
273 } 273 }
274 274
275 U8CPU alpha = paint.getAlpha(); 275 U8CPU alpha = paint.getAlpha();
276 SkXfermode* xfermode = paint.getXfermode(); 276 SkXfermode* xfermode = paint.getXfermode();
277 SkColorFilter* filter = paint.getColorFilter(); 277 SkColorFilter* filter = paint.getColorFilter();
278 SkSpriteBlitter* blitter = NULL; 278 SkSpriteBlitter* blitter = NULL;
279 279
280 switch (source.config()) { 280 switch (source.colorType()) {
281 case SkBitmap::kARGB_4444_Config: 281 case kARGB_4444_SkColorType:
282 if (alpha != 0xFF) { 282 if (alpha != 0xFF) {
283 return NULL; // we only have opaque sprites 283 return NULL; // we only have opaque sprites
284 } 284 }
285 if (xfermode || filter) { 285 if (xfermode || filter) {
286 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S4444_XferFilter, 286 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S4444_XferFilter,
287 storage, storageSize, (source, paint)); 287 storage, storageSize, (source, paint));
288 } else if (source.isOpaque()) { 288 } else if (source.isOpaque()) {
289 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S4444_Opaque, 289 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S4444_Opaque,
290 storage, storageSize, (source)); 290 storage, storageSize, (source));
291 } else { 291 } else {
292 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S4444, 292 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S4444,
293 storage, storageSize, (source)); 293 storage, storageSize, (source));
294 } 294 }
295 break; 295 break;
296 case SkBitmap::kARGB_8888_Config: 296 case kPMColor_SkColorType:
297 if (xfermode || filter) { 297 if (xfermode || filter) {
298 if (255 == alpha) { 298 if (255 == alpha) {
299 // this can handle xfermode or filter, but not alpha 299 // this can handle xfermode or filter, but not alpha
300 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S32A_XferFilter, 300 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S32A_XferFilter,
301 storage, storageSize, (source, paint)); 301 storage, storageSize, (source, paint));
302 } 302 }
303 } else { 303 } else {
304 // this can handle alpha, but not xfermode or filter 304 // this can handle alpha, but not xfermode or filter
305 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S32, 305 SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S32,
306 storage, storageSize, (source, alpha)); 306 storage, storageSize, (source, alpha));
307 } 307 }
308 break; 308 break;
309 default: 309 default:
310 break; 310 break;
311 } 311 }
312 return blitter; 312 return blitter;
313 } 313 }
OLDNEW
« no previous file with comments | « src/core/SkScalerContext.cpp ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698