git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2356
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
int bb = (b << 3) | (b >> 2);
GdkColor *colors = cmap->colors;
- int max = 3 * 65536;
- int index = -1;
+ if(colors)
+ {
+ int max = 3 * 65536;
+ int index = -1;
- for (int i = 0; i < cmap->size; i++)
- {
+ for (int i = 0; i < cmap->size; i++)
+ {
int rdiff = ((rr << 8) - colors[i].red);
int gdiff = ((gg << 8) - colors[i].green);
int bdiff = ((bb << 8) - colors[i].blue);
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max) { index = i; max = sum; }
}
-
+ }
m_colorCube[ (r*1024) + (g*32) + b ] = index;
}
}
int bb = (b << 3) | (b >> 2);
GdkColor *colors = cmap->colors;
- int max = 3 * 65536;
- int index = -1;
+ if(colors)
+ {
+ int max = 3 * 65536;
+ int index = -1;
- for (int i = 0; i < cmap->size; i++)
- {
+ for (int i = 0; i < cmap->size; i++)
+ {
int rdiff = ((rr << 8) - colors[i].red);
int gdiff = ((gg << 8) - colors[i].green);
int bdiff = ((bb << 8) - colors[i].blue);
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max) { index = i; max = sum; }
}
-
+ }
m_colorCube[ (r*1024) + (g*32) + b ] = index;
}
}