OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkConfig8888.h" | 10 #include "SkConfig8888.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 for (int i = 0; i < count; ++i) { | 47 for (int i = 0; i < count; ++i) { |
48 dst[i] = convert32<doSwapRB, doAlpha>(src[i]); | 48 dst[i] = convert32<doSwapRB, doAlpha>(src[i]); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 static bool is_32bit_colortype(SkColorType ct) { | 52 static bool is_32bit_colortype(SkColorType ct) { |
53 return kRGBA_8888_SkColorType == ct || kBGRA_8888_SkColorType == ct; | 53 return kRGBA_8888_SkColorType == ct || kBGRA_8888_SkColorType == ct; |
54 } | 54 } |
55 | 55 |
56 static AlphaVerb compute_AlphaVerb(SkAlphaType src, SkAlphaType dst) { | 56 static AlphaVerb compute_AlphaVerb(SkAlphaType src, SkAlphaType dst) { |
57 SkASSERT(kUnknown_SkAlphaType != src); | 57 SkASSERT(kIgnore_SkAlphaType != src); |
58 SkASSERT(kUnknown_SkAlphaType != dst); | 58 SkASSERT(kIgnore_SkAlphaType != dst); |
59 | 59 |
60 if (kOpaque_SkAlphaType == src || kOpaque_SkAlphaType == dst || src == dst)
{ | 60 if (kOpaque_SkAlphaType == src || kOpaque_SkAlphaType == dst || src == dst)
{ |
61 return kNothing_AlphaVerb; | 61 return kNothing_AlphaVerb; |
62 } | 62 } |
63 if (kPremul_SkAlphaType == dst) { | 63 if (kPremul_SkAlphaType == dst) { |
64 SkASSERT(kUnpremul_SkAlphaType == src); | 64 SkASSERT(kUnpremul_SkAlphaType == src); |
65 return kPremul_AlphaVerb; | 65 return kPremul_AlphaVerb; |
66 } else { | 66 } else { |
67 SkASSERT(kPremul_SkAlphaType == src); | 67 SkASSERT(kPremul_SkAlphaType == src); |
68 SkASSERT(kUnpremul_SkAlphaType == dst); | 68 SkASSERT(kUnpremul_SkAlphaType == dst); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 SkPaint paint; | 247 SkPaint paint; |
248 paint.setDither(true); | 248 paint.setDither(true); |
249 | 249 |
250 canvas->clear(0); | 250 canvas->clear(0); |
251 canvas->drawBitmap(bm, 0, 0, &paint); | 251 canvas->drawBitmap(bm, 0, 0, &paint); |
252 return true; | 252 return true; |
253 } | 253 } |
254 } | 254 } |
255 | 255 |
OLD | NEW |