OLD | NEW |
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.colorType() == kPMColor_SkColorType); | 23 SkASSERT(src.colorType() == kN32_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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return NULL; // we only have opaque sprites | 282 return NULL; // we only have opaque sprites |
283 } | 283 } |
284 if (xfermode || filter) { | 284 if (xfermode || filter) { |
285 blitter = allocator->createT<Sprite_D32_S4444_XferFilter>(source
, paint); | 285 blitter = allocator->createT<Sprite_D32_S4444_XferFilter>(source
, paint); |
286 } else if (source.isOpaque()) { | 286 } else if (source.isOpaque()) { |
287 blitter = allocator->createT<Sprite_D32_S4444_Opaque>(source); | 287 blitter = allocator->createT<Sprite_D32_S4444_Opaque>(source); |
288 } else { | 288 } else { |
289 blitter = allocator->createT<Sprite_D32_S4444>(source); | 289 blitter = allocator->createT<Sprite_D32_S4444>(source); |
290 } | 290 } |
291 break; | 291 break; |
292 case kPMColor_SkColorType: | 292 case kN32_SkColorType: |
293 if (xfermode || filter) { | 293 if (xfermode || filter) { |
294 if (255 == alpha) { | 294 if (255 == alpha) { |
295 // this can handle xfermode or filter, but not alpha | 295 // this can handle xfermode or filter, but not alpha |
296 blitter = allocator->createT<Sprite_D32_S32A_XferFilter>(sou
rce, paint); | 296 blitter = allocator->createT<Sprite_D32_S32A_XferFilter>(sou
rce, paint); |
297 } | 297 } |
298 } else { | 298 } else { |
299 // this can handle alpha, but not xfermode or filter | 299 // this can handle alpha, but not xfermode or filter |
300 blitter = allocator->createT<Sprite_D32_S32>(source, alpha); | 300 blitter = allocator->createT<Sprite_D32_S32>(source, alpha); |
301 } | 301 } |
302 break; | 302 break; |
303 default: | 303 default: |
304 break; | 304 break; |
305 } | 305 } |
306 return blitter; | 306 return blitter; |
307 } | 307 } |
OLD | NEW |