]> bicyclesonthemoon.info Git - ott/enhance/commitdiff
fixed pallette mixing
authorb <rowerynaksiezycu@gmail.com>
Wed, 30 Nov 2022 23:07:09 +0000 (23:07 +0000)
committerb <rowerynaksiezycu@gmail.com>
Wed, 30 Nov 2022 23:07:09 +0000 (23:07 +0000)
core.c
pal_mix.c
testimg/bsta-000367.png [new file with mode: 0644]

diff --git a/core.c b/core.c
index 20118c17d98656b9a7fe218a92038df3b71175a2..31e50634e0d6dbe90ba2fe47bc7f5755ee7243b6 100644 (file)
--- a/core.c
+++ b/core.c
@@ -1556,7 +1556,7 @@ int palette_mix_index (ILuint n, struct PixelInfo *p, void *data)
        if (n < 3)
                return EIO;
        
-       p[2].index = p[0].index * p[0].info.palette_num_cols + p[1].index;
+       p[2].index = p[0].index * p[1].info.palette_num_cols + p[1].index;
        
        return 0;
 }
index 973982c2e8f0f1a4a716b55e41323e9fd81ba4d4..2ced874c12b3b0f465b547799e9f286b27941c73 100644 (file)
--- a/pal_mix.c
+++ b/pal_mix.c
@@ -78,6 +78,13 @@ int subtool_pal_mix (int argc, char **argv, int argi, char **err)
        }
        data.p = data.p0 + data.p1;
        
+       r = reserve_pictures(3);
+       if (r)
+       {
+               *err = CREATE_FAILED;
+               return r;
+       }
+       
        r = load_picture(0, argv[argi], &(info[0]), &(flags[0]));
        if (r)
        {
diff --git a/testimg/bsta-000367.png b/testimg/bsta-000367.png
new file mode 100644 (file)
index 0000000..a9955c8
Binary files /dev/null and b/testimg/bsta-000367.png differ