Roll back 'dst_palette into the pixel_swizzler'

See the previous commit for the rationale.
This commit is contained in:
Nigel Tao committed 2020-05-26 14:13:28 +10:00
1 parent 2d8ec9ace9
commit 1239280ad8
9 files changed
+310 -236

No files matched your search

+11 -2
View File
@@ -107,6 +107,7 @@ test_wuffs_pixel_swizzler_swizzle() {
const uint32_t width = 5;
const uint32_t height = 5;
uint8_t dummy_palette_array[1024];
wuffs_base__pixel_swizzler swizzler;
const struct {
@@ -200,6 +201,14 @@ test_wuffs_pixel_swizzler_swizzle() {
wuffs_base__pixel_alpha_transparency dst_transparency =
wuffs_base__pixel_format__transparency(&dst_pixfmt);
wuffs_base__slice_u8 dst_palette =
wuffs_base__pixel_buffer__palette(&dst_pixbuf);
if (dst_palette.len == 0) {
dst_palette = wuffs_base__make_slice_u8(
&dummy_palette_array[0],
WUFFS_TESTLIB_ARRAY_SIZE(dummy_palette_array));
}
int b;
for (b = 0; b < WUFFS_TESTLIB_ARRAY_SIZE(blends); b++) {
// Set the middle dst pixel.
@@ -211,14 +220,14 @@ test_wuffs_pixel_swizzler_swizzle() {
CHECK_STATUS(
"prepare",
wuffs_base__pixel_swizzler__prepare(
&swizzler, dst_pixfmt,
wuffs_base__pixel_buffer__palette(&dst_pixbuf),
&swizzler, dst_pixfmt, dst_palette,
wuffs_base__make_pixel_format(srcs[s].pixfmt_repr),
wuffs_base__pixel_buffer__palette(&src_pixbuf), blends[b]));
wuffs_base__pixel_swizzler__swizzle_interleaved(
&swizzler,
wuffs_base__table_u8__row(
wuffs_base__pixel_buffer__plane(&dst_pixbuf, 0), height / 2),
dst_palette,
wuffs_base__table_u8__row(
wuffs_base__pixel_buffer__plane(&src_pixbuf, 0), height / 2));