diff options
author | 2015-07-16 07:01:39 -0700 | |
---|---|---|
committer | 2015-07-16 07:01:40 -0700 | |
commit | 767d273ea0948e4f61d318bec58ce417cdc470df (patch) | |
tree | 2fbdd42be5a05f32f8300c4adbe9ddaed2d9e3dd /include | |
parent | 6fb0b6779e40ce05c20cf279f0ecff31fa3cd60d (diff) |
Replace buggy_blend_modes GM with an exhaustive test.
The new test is disabled by default, as it's quite slow.
We can run it if we suspect problems by passing -x to DM.
This test would have been failing before the bug fix, and now is passing.
Assuming the Priv on the end means it's not considered public API...
TBR=reed@google.com
BUG=skia:4052
Review URL: https://codereview.chromium.org/1228333003
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkColorPriv.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h index 15c94ac68c..f9c5d928a0 100644 --- a/include/core/SkColorPriv.h +++ b/include/core/SkColorPriv.h @@ -369,6 +369,18 @@ static inline void SkBlendRGB16(const uint16_t src[], uint16_t dst[], #define SkPMColorAssert(c) #endif +static inline bool SkPMColorValid(SkPMColor c) { + auto a = SkGetPackedA32(c); + bool valid = a <= SK_A32_MASK + && SkGetPackedR32(c) <= a + && SkGetPackedG32(c) <= a + && SkGetPackedB32(c) <= a; + if (valid) { + SkPMColorAssert(c); // Make sure we're consistent when it counts. + } + return valid; +} + /** * Pack the components into a SkPMColor, checking (in the debug version) that * the components are 0..255, and are already premultiplied (i.e. alpha >= color) |