- keyMaskColor = wxImageHistogram::MakeKey(
- image.GetMaskRed(), image.GetMaskGreen(), image.GetMaskBlue());
- // get mask before image is modified
- wxBitmap bitmap(image, 1);
- mask = bitmap.GetMask()->GetBitmap();
- g_object_ref(mask);
- }
- else
- {
- const int size = ((w + 7) / 8) * h;
- char* bits = new char[size];
- memset(bits, 0xff, size);
- mask = gdk_bitmap_create_from_data(
- wxGetRootWindow()->window, bits, w, h);
- delete[] bits;
- }
+ unsigned long keyMaskColor = 0;
+ GdkPixmap *maskRaw;
+ if (bHasMask)
+ {
+ keyMaskColor = wxImageHistogram::MakeKey(
+ image.GetMaskRed(), image.GetMaskGreen(), image.GetMaskBlue());
+ // get mask before image is modified
+ wxBitmap bitmap(image, 1);
+ maskRaw = bitmap.GetMask()->GetBitmap();
+ g_object_ref(maskRaw);
+ }
+ else
+ {
+ const int size = ((w + 7) / 8) * h;
+ char* bits = new char[size];
+ memset(bits, 0xff, size);
+ maskRaw = gdk_bitmap_create_from_data(
+ gtk_widget_get_window(wxGetRootWindow()), bits, w, h);
+ delete[] bits;
+ }