Crude hack to fix crash for 8bit displays. Seems to work fine. PLEASE CHECK
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2356 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5fbecd9925
commit
3418cb8b1c
@ -288,18 +288,20 @@ bool wxApp::OnInitGui()
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -288,18 +288,20 @@ bool wxApp::OnInitGui()
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user