OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBlitRow.h" | 8 #include "SkBlitRow.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkDither.h" | 10 #include "SkDither.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 SkBlitRow::Proc16 proc = PlatformFactory565(flags); | 249 SkBlitRow::Proc16 proc = PlatformFactory565(flags); |
250 if (NULL == proc) { | 250 if (NULL == proc) { |
251 proc = gDefault_565_Procs[flags]; | 251 proc = gDefault_565_Procs[flags]; |
252 } | 252 } |
253 return proc; | 253 return proc; |
254 } | 254 } |
255 | 255 |
256 static const SkBlitRow::ColorProc16 gDefault_565_ColorProcs[] = { | 256 static const SkBlitRow::ColorProc16 gDefault_565_ColorProcs[] = { |
257 #if 0 | 257 #if 0 |
258 Color32_D565, | |
259 Color32A_D565, | 258 Color32A_D565, |
260 Color32_D565_Dither, | |
261 Color32A_D565_Dither | 259 Color32A_D565_Dither |
262 #else | 260 #else |
263 // TODO: stop cheating and fill in the above specializations! | 261 // TODO: stop cheating and fill dither from the above specializations! |
264 Color32A_D565, | |
265 Color32A_D565, | |
266 Color32A_D565, | 262 Color32A_D565, |
267 Color32A_D565, | 263 Color32A_D565, |
268 #endif | 264 #endif |
269 }; | 265 }; |
270 | 266 |
271 SkBlitRow::ColorProc16 SkBlitRow::ColorFactory16(unsigned flags) { | 267 SkBlitRow::ColorProc16 SkBlitRow::ColorFactory16(unsigned flags) { |
272 SkASSERT((flags & ~kFlags16_Mask) == 0); | 268 SkASSERT((flags & ~kFlags16_Mask) == 0); |
273 // just so we don't crash | 269 // just so we don't crash |
274 flags &= kFlags16_Mask; | 270 flags &= kFlags16_Mask; |
275 // we ignore kGlobalAlpha_Flag, so shift down | 271 // we ignore both kGlobalAlpha_Flag and kSrcPixelAlpha_Flag, so shift down |
276 flags >>= 1; | 272 // since this factory is only used for transparent source alphas |
| 273 flags >>= 2; |
277 | 274 |
278 SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_ColorProcs)); | 275 SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_ColorProcs)); |
279 | 276 |
280 SkBlitRow::ColorProc16 proc = PlatformColorFactory565(flags); | 277 SkBlitRow::ColorProc16 proc = PlatformColorFactory565(flags); |
281 if (NULL == proc) { | 278 if (NULL == proc) { |
282 proc = gDefault_565_ColorProcs[flags]; | 279 proc = gDefault_565_ColorProcs[flags]; |
283 } | 280 } |
284 return proc; | 281 return proc; |
285 } | 282 } |
OLD | NEW |