Skip to content

Commit

Permalink
oops, forgot tests only run in Android roll
Browse files Browse the repository at this point in the history
Looks like we can't just drop SK_SUPPORT_LEGACY_A8_MASKBLITTER so easy.

Change-Id: I45f8a8efd75ba4e0d5bc5cb1972296f88a447db8
Reviewed-on: https://skia-review.googlesource.com/c/170271
Reviewed-by: Mike Klein <[email protected]>
Commit-Queue: Mike Klein <[email protected]>
  • Loading branch information
Mike Klein authored and Skia Commit-Bot committed Nov 9, 2018
1 parent 303a38c commit 0b473fb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/core/SkBlitter_ARGB32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,18 +1150,35 @@ void SkARGB32_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
static void blend_row_A8(SkPMColor* dst, const void* vmask, const SkPMColor* src, int n) {
auto mask = (const uint8_t*)vmask;

#ifdef SK_SUPPORT_LEGACY_A8_MASKBLITTER
for (int i = 0; i < n; ++i) {
if (mask[i]) {
dst[i] = SkBlendARGB32(src[i], dst[i], mask[i]);
}
}
#else
Sk4px::MapDstSrcAlpha(n, dst, src, mask, [](const Sk4px& d, const Sk4px& s, const Sk4px& aa) {
const auto s_aa = s.approxMulDiv255(aa);
return s_aa + d.approxMulDiv255(s_aa.alphas().inv());
});
#endif
}

static void blend_row_A8_opaque(SkPMColor* dst, const void* vmask, const SkPMColor* src, int n) {
auto mask = (const uint8_t*)vmask;

#ifdef SK_SUPPORT_LEGACY_A8_MASKBLITTER
for (int i = 0; i < n; ++i) {
if (int m = mask[i]) {
m += (m >> 7);
dst[i] = SkAlphaMulQ(src[i], m) + SkAlphaMulQ(dst[i], 256 - m);
}
}
#else
Sk4px::MapDstSrcAlpha(n, dst, src, mask, [](const Sk4px& d, const Sk4px& s, const Sk4px& aa) {
return (s * aa + d * aa.inv()).div255();
});
#endif
}

static void blend_row_lcd16(SkPMColor* dst, const void* vmask, const SkPMColor* src, int n) {
Expand Down

0 comments on commit 0b473fb

Please sign in to comment.