| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 "SkXfermode.h" | 8 #include "SkXfermode.h" |
| 9 #include "SkXfermode_proccoeff.h" | 9 #include "SkXfermode_proccoeff.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 x.store(pm4.fVec); | 921 x.store(pm4.fVec); |
| 922 return pm4; | 922 return pm4; |
| 923 } | 923 } |
| 924 | 924 |
| 925 static Sk4f as_4f(const SkPM4f& pm4) { | 925 static Sk4f as_4f(const SkPM4f& pm4) { |
| 926 return Sk4f::Load(pm4.fVec); | 926 return Sk4f::Load(pm4.fVec); |
| 927 } | 927 } |
| 928 | 928 |
| 929 static void assert_unit(const SkPM4f& r) { | 929 static void assert_unit(const SkPM4f& r) { |
| 930 #ifdef SK_DEBUG | 930 #ifdef SK_DEBUG |
| 931 const float min = 0; | 931 const float eps = 0.00001f; |
| 932 const float max = 1; | 932 const float min = 0 - eps; |
| 933 const float max = 1 + eps; |
| 933 for (int i = 0; i < 4; ++i) { | 934 for (int i = 0; i < 4; ++i) { |
| 934 SkASSERT(r.fVec[i] >= min && r.fVec[i] <= max); | 935 SkASSERT(r.fVec[i] >= min && r.fVec[i] <= max); |
| 935 } | 936 } |
| 936 #endif | 937 #endif |
| 937 } | 938 } |
| 938 | 939 |
| 939 template <Sk4f (blend)(const Sk4f&, const Sk4f&)> SkPM4f proc_4f(const SkPM4f& s
, const SkPM4f& d) { | 940 template <Sk4f (blend)(const Sk4f&, const Sk4f&)> SkPM4f proc_4f(const SkPM4f& s
, const SkPM4f& d) { |
| 940 assert_unit(s); | 941 assert_unit(s); |
| 941 assert_unit(d); | 942 assert_unit(d); |
| 942 SkPM4f r = as_pm4f(blend(as_4f(s), as_4f(d))); | 943 SkPM4f r = as_pm4f(blend(as_4f(s), as_4f(d))); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 if (!xfer) { | 1410 if (!xfer) { |
| 1410 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; | 1411 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; |
| 1411 } | 1412 } |
| 1412 | 1413 |
| 1413 return xfer->isOpaque(opacityType); | 1414 return xfer->isOpaque(opacityType); |
| 1414 } | 1415 } |
| 1415 | 1416 |
| 1416 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1417 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
| 1417 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1418 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
| 1418 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1419 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |