No need to write out alpha in a RGBA color when only
the RGB values are used by the distance op.
Also, add a comment on the byte order. Maybe I'm wrong
but I believe the operations are fine wrt. byte order :)
#define G_VAL(v) ((uint8_t) ((v & 0x0000FF00) >> 8))
#define B_VAL(v) ((uint8_t) ((v & 0x000000FF)))
+#ifndef WORDS_BIGENDIAN
+# define RGB_START 0
+# define RGB_END 2
+#else
+# define RGB_START 1
+# define RGB_END 3
+#endif
+
#ifndef DBG
# ifdef DEBUG
# define DBG(fmt, ...) fprintf(stderr, "%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ## __VA_ARGS__)
} paint_colors[4], color1, color2;
int errAcc = 0;
+ paint_colors[0].v = 0;
+ paint_colors[1].v = 0;
+ paint_colors[2].v = 0;
+ paint_colors[3].v = 0;
color1.v = c1;
color2.v = c2;
}
}
- for (int k = 0; k < 4; k++)
+ // Set paint_colors using R,G,B values (byte order is preserved)
+ for (int k = RGB_START; k <= RGB_END; k++)
{
if (!h_mode)
{