Chameleon

Chameleon Commit Details

Date:2010-07-25 21:17:42 (9 years 2 months ago)
Author:Tamás Kosárszky
Commit:245
Parents: 244
Message:Using different image fallback scheme makes "useRollOver" testing obsolete (removed). Reverted back linear getEmbeddedImageIndexByName() for now.
Changes:
M/branches/zef/i386/boot2/gui.c

File differences

branches/zef/i386/boot2/gui.c
3030
3131
3232
33
3433
3534
3635
......
177176
178177
179178
180
181
182
183
184
185
186
187
188
179
180
189181
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
182
183
215184
216
217
185
218186
219187
220188
......
684652
685653
686654
687
688
689
690655
691656
692657
......
749714
750715
751716
752
753
717
718
754719
755720
756721
#define vram VIDEO(baseAddr)
int lasttime = 0; // we need this for animating maybe
//bool useRollOver = false;
extern int gDeviceCount;
#ifdef EMBED_THEME
static int getEmbeddedImageIndexByName(const char *name)
{
int upperLimit = sizeof(embeddedImages) / sizeof(embeddedImages[0]) - 1;
int lowerLimit = 0;
int compareIndex = (upperLimit - lowerLimit + 1) >> 1; // Midpoint
int result;
// NOTE: This algorithm assumes that the embeddedImages is sorted.
// This is currently done using the make file. If the array is every
// manualy generated, this *will* fail to work properly.
while((result = strcmp(name, embeddedImages[compareIndex].name)) != 0)
int i;
for (i = 0; i < sizeof(embeddedImages) / sizeof(embeddedImages[0]); i++)
{
if(result > 0)// We need to search a HIGHER index
{
if(compareIndex != upperLimit - 1)
{
lowerLimit = compareIndex;
}
else
{
return -1;
}
}
else //if(result < 0) // We Need to search a LOWER index
{
if(compareIndex != lowerLimit + 1)
{
upperLimit = compareIndex;
}
else
{
return -1;
}
}
compareIndex = (upperLimit + lowerLimit + 1) >> 1;// Midpoint
if (strcmp(name, embeddedImages[i].name) == 0)
return i; // found the name
}
return compareIndex;
return -1;
}
#endif
colorFont(&font_small, gui.screen.font_small_color);
colorFont(&font_console, gui.screen.font_console_color);
// use the alternate images for the selected item if available.
//useRollOver = (images[iDeviceGeneric].image->pixels != images[iDeviceGeneric_o].image->pixels) ? true : false;
// create the screen & window buffers
if (createBackBuffer(&gui.screen) == 0) {
if (createWindowBuffer(&gui.screen) == 0) {
}
}
// Use the next (device_*_o) image for the selected item if available.
if (isSelected/* && useRollOver*/) devicetype++;
// Use the next (device_*_o) image for the selected item.
if (isSelected) devicetype++;
// draw icon
blend( images[devicetype].image, buffer, centeredAt( images[devicetype].image, p ));

Archive Download the corresponding diff file

Revision: 245