OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkPM4fPriv.h" | 8 #include "SkPM4fPriv.h" |
9 #include "SkUtils.h" | 9 #include "SkUtils.h" |
10 #include "SkXfermode.h" | 10 #include "SkXfermode.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 420 |
421 SkXfermode::PM4fProcN SkXfermode::getPM4fProcN(uint32_t flags) const { | 421 SkXfermode::PM4fProcN SkXfermode::getPM4fProcN(uint32_t flags) const { |
422 Mode mode; | 422 Mode mode; |
423 return this->asMode(&mode) ? GetPM4fProcN(mode, flags) : xfer_pm4_proc_n; | 423 return this->asMode(&mode) ? GetPM4fProcN(mode, flags) : xfer_pm4_proc_n; |
424 } | 424 } |
425 | 425 |
426 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 426 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
427 #include "SkColorPriv.h" | 427 #include "SkColorPriv.h" |
428 | 428 |
429 static Sk4f lcd16_to_unit_4f(uint16_t rgb) { | 429 static Sk4f lcd16_to_unit_4f(uint16_t rgb) { |
| 430 #ifdef SK_PMCOLOR_IS_RGBA |
430 Sk4i rgbi = Sk4i(SkGetPackedR16(rgb), SkGetPackedG16(rgb), SkGetPackedB16(rg
b), 0); | 431 Sk4i rgbi = Sk4i(SkGetPackedR16(rgb), SkGetPackedG16(rgb), SkGetPackedB16(rg
b), 0); |
| 432 #else |
| 433 Sk4i rgbi = Sk4i(SkGetPackedB16(rgb), SkGetPackedG16(rgb), SkGetPackedR16(rg
b), 0); |
| 434 #endif |
431 return SkNx_cast<float>(rgbi) * Sk4f(1.0f/31, 1.0f/63, 1.0f/31, 0); | 435 return SkNx_cast<float>(rgbi) * Sk4f(1.0f/31, 1.0f/63, 1.0f/31, 0); |
432 } | 436 } |
433 | 437 |
434 template <DstType D> | 438 template <DstType D> |
435 void src_1_lcd(uint32_t dst[], const SkPM4f* src, int count, const uint16_t lcd[
]) { | 439 void src_1_lcd(uint32_t dst[], const SkPM4f* src, int count, const uint16_t lcd[
]) { |
436 const Sk4f s4 = Sk4f::Load(src->fVec); | 440 const Sk4f s4 = Sk4f::Load(src->fVec); |
437 | 441 |
438 if (D == kLinear_Dst) { | 442 if (D == kLinear_Dst) { |
439 // operate in bias-255 space for src and dst | 443 // operate in bias-255 space for src and dst |
440 const Sk4f s4bias = s4 * Sk4f(255); | 444 const Sk4f s4bias = s4 * Sk4f(255); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 514 |
511 const LCD32Proc procs[] = { | 515 const LCD32Proc procs[] = { |
512 srcover_n_lcd<kSRGB_Dst>, src_n_lcd<kSRGB_Dst>, | 516 srcover_n_lcd<kSRGB_Dst>, src_n_lcd<kSRGB_Dst>, |
513 srcover_1_lcd<kSRGB_Dst>, src_1_lcd<kSRGB_Dst>, | 517 srcover_1_lcd<kSRGB_Dst>, src_1_lcd<kSRGB_Dst>, |
514 | 518 |
515 srcover_n_lcd<kLinear_Dst>, src_n_lcd<kLinear_Dst>, | 519 srcover_n_lcd<kLinear_Dst>, src_n_lcd<kLinear_Dst>, |
516 srcover_1_lcd<kLinear_Dst>, src_1_lcd<kLinear_Dst>, | 520 srcover_1_lcd<kLinear_Dst>, src_1_lcd<kLinear_Dst>, |
517 }; | 521 }; |
518 return procs[flags]; | 522 return procs[flags]; |
519 } | 523 } |
OLD | NEW |