- for (int x = width-1; x >= 0; --x)
- {
- unsigned char* data = image.GetData() + (y*(width*3))+(x*3);
- unsigned char* r = data;
- unsigned char* g = data+1;
- unsigned char* b = data+2;
-
- if (has_mask && (*r == mr) && (*g == mg) && (*b == mb))
- continue;
-
- wxColour::MakeDisabled(r, g, b, brightness);
- }
+ image.SetAlpha();
+ memcpy(image.GetAlpha(), alpha, size);
+ }
+ const unsigned char mask_r = M_IMGDATA->m_maskRed;
+ const unsigned char mask_g = M_IMGDATA->m_maskGreen;
+ const unsigned char mask_b = M_IMGDATA->m_maskBlue;
+ const bool hasMask = M_IMGDATA->m_hasMask;
+ if (hasMask)
+ image.SetMaskColour(mask_r, mask_g, mask_b);
+
+ const unsigned char* src = M_IMGDATA->m_data;
+ unsigned char* dst = image.GetData();
+ while (size--)
+ {
+ unsigned char r = *src++;
+ unsigned char g = *src++;
+ unsigned char b = *src++;
+ if (!hasMask || r != mask_r || g != mask_g || b != mask_b)
+ wxColour::MakeDisabled(&r, &g, &b, brightness);
+ *dst++ = r;
+ *dst++ = g;
+ *dst++ = b;