Chameleon

Chameleon Commit Details

Date:2010-08-30 17:43:57 (8 years 10 months ago)
Author:Azimutz
Commit:452
Parents: 451
Message:Converted some MIN() MAX() to lower case and removed unneeded definitions on graphics.c & gui.c.
Changes:
M/branches/azimutz/Chazileon/i386/boot2/graphics.c
M/branches/azimutz/CleanCut/i386/boot2/graphics.c
M/branches/azimutz/Chazileon/i386/boot2/gui.c
M/branches/azimutz/CleanCut/i386/boot2/gui.c

File differences

branches/azimutz/Chazileon/i386/boot2/graphics.c
4444
4545
4646
47
47
4848
4949
5050
......
616616
617617
618618
619
620
619
620
621621
622622
623623
......
796796
797797
798798
799
800
799
800
801801
802802
803803
......
822822
823823
824824
825
826
825
826
827827
828828
829829
#define VIDEO(x) (bootArgs->Video.v_ ## x)
#define MIN(x, y) ((x) < (y) ? (x) : (y))
//#define min(x, y) ((x) < (y) ? (x) : (y)) Azi: it's defined on saio_types.h
//==========================================================================
// getVBEInfoString
uint16_t drawWidth;
uint8_t *vram = (uint8_t *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + 4 * x;
drawWidth = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
drawWidth = min(width, VIDEO(width) - x);
height = min(height, VIDEO(height) - y);
while (height--) {
switch (VIDEO (depth))
{
vram = (char *) VIDEO(baseAddr) +
VIDEO(rowBytes) * y + pixelBytes * x;
width = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
width = min(width, VIDEO(width) - x);
height = min(height, VIDEO(height) - y);
while ( height-- )
{
unsigned char * vram = (unsigned char *) VIDEO(baseAddr) +
VIDEO(rowBytes) * y + pixelBytes * x;
drawWidth = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
drawWidth = min(width, VIDEO(width) - x);
height = min(height, VIDEO(height) - y);
while ( height-- ) {
bcopy( data, vram, drawWidth * pixelBytes );
vram += VIDEO(rowBytes);
branches/azimutz/Chazileon/i386/boot2/gui.c
1515
1616
1717
18
19
18
19
2020
2121
2222
......
468468
469469
470470
471
471
472472
473473
474474
......
483483
484484
485485
486
486
487487
488488
489489
......
495495
496496
497497
498
498
499499
500500
501501
......
539539
540540
541541
542
542
543543
544544
545
545
546546
547547
548548
......
589589
590590
591591
592
592
593593
594594
595
595
596596
597597
598598
......
601601
602602
603603
604
604
605605
606606
607
607
608608
609609
610610
......
632632
633633
634634
635
635
636636
637637
638
638
639639
640640
641641
......
650650
651651
652652
653
653
654654
655655
656656
......
659659
660660
661661
662
662
663663
664664
665
665
666666
667667
668668
......
850850
851851
852852
853
853
854854
855855
856856
......
11181118
11191119
11201120
1121
1122
1121
1122
11231123
11241124
11251125
......
12031203
12041204
12051205
1206
1207
1206
1207
12081208
12091209
12101210
......
12831283
12841284
12851285
1286
1287
1286
1287
12881288
12891289
12901290
......
19341934
19351935
19361936
1937
1938
1937
1938
19391939
19401940
19411941
......
19501950
19511951
19521952
1953
1954
1953
1954
19551955
19561956
19571957
#include "edid.h" //Azi:autoresolution
#include "autoresolution.h"
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
//#define min(x, y) ((x) < (y) ? (x) : (y)) Azi: it's defined on saio_types.h
//#define max(x, y) ((x) > (y) ? (x) : (y))||||
#define VIDEO(x) (bootArgs->Video.v_ ## x)
const char *string;
if(getIntForKey("devices_max_visible", &val, theme ))
gui.maxdevices = MIN( val, gDeviceCount );
gui.maxdevices = min( val, gDeviceCount );
if(getIntForKey("devices_iconspacing", &val, theme ))
gui.devicelist.iconspacing = val;
switch (gui.layout) {
case VerticalLayout:
gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);
gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * min(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);
gui.devicelist.width = (images[iSelection].image->width + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) )
case HorizontalLayout:
default:
gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);
gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * min(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);
gui.devicelist.height = (images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) )
gui.screen.bgcolor = (color & 0x00FFFFFF);
if(getIntForKey("screen_textmargin_h", &val, theme))
gui.screen.hborder = MIN( gui.screen.width , val );
gui.screen.hborder = min( gui.screen.width , val );
if(getIntForKey("screen_textmargin_v", &val, theme))
gui.screen.vborder = MIN( gui.screen.height , val );
gui.screen.vborder = min( gui.screen.height , val );
/*
* Parse background parameters
* Parse infobox parameters
*/
if(getIntForKey("infobox_width", &val, theme))
gui.infobox.width = MIN( screen_width , val );
gui.infobox.width = min( screen_width , val );
if(getIntForKey("infobox_height", &val, theme))
gui.infobox.height = MIN( screen_height , val );
gui.infobox.height = min( screen_height , val );
if(getDimensionForKey("infobox_pos_x", &pixel, theme, screen_width , gui.infobox.width ) )
gui.infobox.pos.x = pixel;
gui.infobox.pos.y = pixel;
if(getIntForKey("infobox_textmargin_h", &val, theme))
gui.infobox.hborder = MIN( gui.infobox.width , val );
gui.infobox.hborder = min( gui.infobox.width , val );
if(getIntForKey("infobox_textmargin_v", &val, theme))
gui.infobox.vborder = MIN( gui.infobox.height , val );
gui.infobox.vborder = min( gui.infobox.height , val );
if(getColorForKey("infobox_bgcolor", &color, theme))
gui.infobox.bgcolor = (color & 0x00FFFFFF);
gui.menu.pos.y = pixel;
if(getIntForKey("menu_textmargin_h", &val, theme))
gui.menu.hborder = MIN( gui.menu.width , val );
gui.menu.hborder = min( gui.menu.width , val );
if(getIntForKey("menu_textmargin_v", &val, theme))
gui.menu.vborder = MIN( gui.menu.height , val );
gui.menu.vborder = min( gui.menu.height , val );
if(getColorForKey("menu_bgcolor", &color, theme))
gui.menu.bgcolor = (color & 0x00FFFFFF);
gui.bootprompt.width = pixel;
if(getIntForKey("bootprompt_height", &val, theme))
gui.bootprompt.height = MIN( screen_height , val );
gui.bootprompt.height = min( screen_height , val );
if(getDimensionForKey("bootprompt_pos_x", &pixel, theme, screen_width , gui.bootprompt.width ) )
gui.bootprompt.pos.x = pixel;
gui.bootprompt.pos.y = pixel;
if(getIntForKey("bootprompt_textmargin_h", &val, theme))
gui.bootprompt.hborder = MIN( gui.bootprompt.width , val );
gui.bootprompt.hborder = min( gui.bootprompt.width , val );
if(getIntForKey("bootprompt_textmargin_v", &val, theme))
gui.bootprompt.vborder = MIN( gui.bootprompt.height , val );
gui.bootprompt.vborder = min( gui.bootprompt.height , val );
if(getColorForKey("bootprompt_bgcolor", &color, theme))
gui.bootprompt.bgcolor = (color & 0x00FFFFFF);
extern boolshowBootBanner;
position_tp, p_prev, p_next;
//uint8_tmaxDevices = MIN( gui.maxdevices, menucount );
//uint8_tmaxDevices = min( gui.maxdevices, menucount );
fillPixmapWithColor( gui.devicelist.pixmap, gui.devicelist.bgcolor);
int i;
int character;
origin.x = MAX( window->cursor.x, window->hborder );
origin.y = MAX( window->cursor.y, window->vborder );
origin.x = max( window->cursor.x, window->hborder );
origin.y = max( window->cursor.y, window->vborder );
bounds.x = ( window->width - window->hborder );
bounds.y = ( window->height - window->vborder );
int i;
int character;
origin.x = MAX( gui.debug.cursor.x, window->hborder );
origin.y = MAX( gui.debug.cursor.y, window->vborder );
origin.x = max( gui.debug.cursor.x, window->hborder );
origin.y = max( gui.debug.cursor.y, window->vborder );
bounds.x = ( window->width - window->hborder );
bounds.y = ( window->height - window->vborder );
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
origin.x = MAX( window->cursor.x, window->hborder );
origin.y = MAX( window->cursor.y, window->vborder );
origin.x = max( window->cursor.x, window->hborder );
origin.y = max( window->cursor.y, window->vborder );
bounds.x = ( window->width - ( window->hborder * 2 ) );
bounds.y = ( window->height - ( window->vborder * 2 ) );
cursor = origin;
drawColorRectangle(0, 0, screen_params[0], screen_params[1], 0x01);
}
if ((bootImageData) && (usePngImage)) {
x = (screen_params[0] - MIN(bootImageWidth, screen_params[0])) / 2;
y = (screen_params[1] - MIN(bootImageHeight, screen_params[1])) / 2;
x = (screen_params[0] - min(bootImageWidth, screen_params[0])) / 2;
y = (screen_params[1] - min(bootImageHeight, screen_params[1])) / 2;
// Draw the image in the center of the display.
blendImage(x, y, bootImageWidth, bootImageHeight, bootImageData);
if (appleBootPict) {
convertImage(bootImageWidth, bootImageHeight, appleBootPict, &bootImageData);
if (bootImageData) {
x = (screen_params[0] - MIN(kAppleBootWidth, screen_params[0])) / 2;
y = (screen_params[1] - MIN(kAppleBootHeight, screen_params[1])) / 2;
x = (screen_params[0] - min(kAppleBootWidth, screen_params[0])) / 2;
y = (screen_params[1] - min(kAppleBootHeight, screen_params[1])) / 2;
drawDataRectangle(x, y, kAppleBootWidth, kAppleBootHeight, bootImageData);
free(bootImageData);
}
branches/azimutz/CleanCut/i386/boot2/graphics.c
4343
4444
4545
46
46
4747
4848
4949
......
591591
592592
593593
594
595
594
595
596596
597597
598598
......
771771
772772
773773
774
775
774
775
776776
777777
778778
......
797797
798798
799799
800
801
800
801
802802
803803
804804
#define VIDEO(x) (bootArgs->Video.v_ ## x)
#define MIN(x, y) ((x) < (y) ? (x) : (y))
//#define min(x, y) ((x) < (y) ? (x) : (y)) Azi: it's defined on saio_types.h
//==========================================================================
// getVBEInfoString
uint16_t drawWidth;
uint8_t *vram = (uint8_t *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + 4 * x;
drawWidth = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
drawWidth = min(width, VIDEO(width) - x);
height = min(height, VIDEO(height) - y);
while (height--) {
switch (VIDEO (depth))
{
vram = (char *) VIDEO(baseAddr) +
VIDEO(rowBytes) * y + pixelBytes * x;
width = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
width = min(width, VIDEO(width) - x);
height = min(height, VIDEO(height) - y);
while ( height-- )
{
unsigned char * vram = (unsigned char *) VIDEO(baseAddr) +
VIDEO(rowBytes) * y + pixelBytes * x;
drawWidth = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
drawWidth = min(width, VIDEO(width) - x);
height = min(height, VIDEO(height) - y);
while ( height-- ) {
bcopy( data, vram, drawWidth * pixelBytes );
vram += VIDEO(rowBytes);
branches/azimutz/CleanCut/i386/boot2/gui.c
2222
2323
2424
25
26
25
26
2727
2828
2929
......
469469
470470
471471
472
472
473473
474474
475475
......
484484
485485
486486
487
487
488488
489489
490490
......
496496
497497
498498
499
499
500500
501501
502502
......
540540
541541
542542
543
543
544544
545545
546
546
547547
548548
549549
......
590590
591591
592592
593
593
594594
595595
596
596
597597
598598
599599
......
602602
603603
604604
605
605
606606
607607
608
608
609609
610610
611611
......
633633
634634
635635
636
636
637637
638638
639
639
640640
641641
642642
......
651651
652652
653653
654
654
655655
656656
657657
......
660660
661661
662662
663
663
664664
665665
666
666
667667
668668
669669
......
808808
809809
810810
811
811
812812
813813
814814
......
10651065
10661066
10671067
1068
1069
1068
1069
10701070
10711071
10721072
......
11501150
11511151
11521152
1153
1154
1153
1154
11551155
11561156
11571157
......
12301230
12311231
12321232
1233
1234
1233
1234
12351235
12361236
12371237
......
18641864
18651865
18661866
1867
1868
1867
1868
18691869
18701870
18711871
......
18801880
18811881
18821882
1883
1884
1883
1884
18851885
18861886
18871887
#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; }
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
//#define min(x, y) ((x) < (y) ? (x) : (y)) Azi: it's defined on saio_types.h
//#define max(x, y) ((x) > (y) ? (x) : (y))||||
#define VIDEO(x) (bootArgs->Video.v_ ## x)
const char *string;
if(getIntForKey("devices_max_visible", &val, theme ))
gui.maxdevices = MIN( val, gDeviceCount );
gui.maxdevices = min( val, gDeviceCount );
if(getIntForKey("devices_iconspacing", &val, theme ))
gui.devicelist.iconspacing = val;
switch (gui.layout) {
case VerticalLayout:
gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);
gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * min(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);
gui.devicelist.width = (images[iSelection].image->width + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) )
case HorizontalLayout:
default:
gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);
gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * min(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);
gui.devicelist.height = (images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) )
gui.screen.bgcolor = (color & 0x00FFFFFF);
if(getIntForKey("screen_textmargin_h", &val, theme))
gui.screen.hborder = MIN( gui.screen.width , val );
gui.screen.hborder = min( gui.screen.width , val );
if(getIntForKey("screen_textmargin_v", &val, theme))
gui.screen.vborder = MIN( gui.screen.height , val );
gui.screen.vborder = min( gui.screen.height , val );
/*
* Parse background parameters
* Parse infobox parameters
*/
if(getIntForKey("infobox_width", &val, theme))
gui.infobox.width = MIN( screen_width , val );
gui.infobox.width = min( screen_width , val );
if(getIntForKey("infobox_height", &val, theme))
gui.infobox.height = MIN( screen_height , val );
gui.infobox.height = min( screen_height , val );
if(getDimensionForKey("infobox_pos_x", &pixel, theme, screen_width , gui.infobox.width ) )
gui.infobox.pos.x = pixel;
gui.infobox.pos.y = pixel;
if(getIntForKey("infobox_textmargin_h", &val, theme))
gui.infobox.hborder = MIN( gui.infobox.width , val );
gui.infobox.hborder = min( gui.infobox.width , val );
if(getIntForKey("infobox_textmargin_v", &val, theme))
gui.infobox.vborder = MIN( gui.infobox.height , val );
gui.infobox.vborder = min( gui.infobox.height , val );
if(getColorForKey("infobox_bgcolor", &color, theme))
gui.infobox.bgcolor = (color & 0x00FFFFFF);
gui.menu.pos.y = pixel;
if(getIntForKey("menu_textmargin_h", &val, theme))
gui.menu.hborder = MIN( gui.menu.width , val );
gui.menu.hborder = min( gui.menu.width , val );
if(getIntForKey("menu_textmargin_v", &val, theme))
gui.menu.vborder = MIN( gui.menu.height , val );
gui.menu.vborder = min( gui.menu.height , val );
if(getColorForKey("menu_bgcolor", &color, theme))
gui.menu.bgcolor = (color & 0x00FFFFFF);
gui.bootprompt.width = pixel;
if(getIntForKey("bootprompt_height", &val, theme))
gui.bootprompt.height = MIN( screen_height , val );
gui.bootprompt.height = min( screen_height , val );
if(getDimensionForKey("bootprompt_pos_x", &pixel, theme, screen_width , gui.bootprompt.width ) )
gui.bootprompt.pos.x = pixel;
gui.bootprompt.pos.y = pixel;
if(getIntForKey("bootprompt_textmargin_h", &val, theme))
gui.bootprompt.hborder = MIN( gui.bootprompt.width , val );
gui.bootprompt.hborder = min( gui.bootprompt.width , val );
if(getIntForKey("bootprompt_textmargin_v", &val, theme))
gui.bootprompt.vborder = MIN( gui.bootprompt.height , val );
gui.bootprompt.vborder = min( gui.bootprompt.height , val );
if(getColorForKey("bootprompt_bgcolor", &color, theme))
gui.bootprompt.bgcolor = (color & 0x00FFFFFF);
int i;
position_t p, p_prev, p_next;
//uint8_tmaxDevices = MIN( gui.maxdevices, menucount );
//uint8_tmaxDevices = min( gui.maxdevices, menucount );
fillPixmapWithColor( gui.devicelist.pixmap, gui.devicelist.bgcolor);
int i;
int character;
origin.x = MAX( window->cursor.x, window->hborder );
origin.y = MAX( window->cursor.y, window->vborder );
origin.x = max( window->cursor.x, window->hborder );
origin.y = max( window->cursor.y, window->vborder );
bounds.x = ( window->width - window->hborder );
bounds.y = ( window->height - window->vborder );
int i;
int character;
origin.x = MAX( gui.debug.cursor.x, window->hborder );
origin.y = MAX( gui.debug.cursor.y, window->vborder );
origin.x = max( gui.debug.cursor.x, window->hborder );
origin.y = max( gui.debug.cursor.y, window->vborder );
bounds.x = ( window->width - window->hborder );
bounds.y = ( window->height - window->vborder );
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
origin.x = MAX( window->cursor.x, window->hborder );
origin.y = MAX( window->cursor.y, window->vborder );
origin.x = max( window->cursor.x, window->hborder );
origin.y = max( window->cursor.y, window->vborder );
bounds.x = ( window->width - ( window->hborder * 2 ) );
bounds.y = ( window->height - ( window->vborder * 2 ) );
cursor = origin;
drawColorRectangle(0, 0, screen_params[0], screen_params[1], 0x01);
}
if ((bootImageData) && (usePngImage)) {
x = (screen_params[0] - MIN(bootImageWidth, screen_params[0])) / 2;
y = (screen_params[1] - MIN(bootImageHeight, screen_params[1])) / 2;
x = (screen_params[0] - min(bootImageWidth, screen_params[0])) / 2;
y = (screen_params[1] - min(bootImageHeight, screen_params[1])) / 2;
// Draw the image in the center of the display.
blendImage(x, y, bootImageWidth, bootImageHeight, bootImageData);
if (appleBootPict) {
convertImage(bootImageWidth, bootImageHeight, appleBootPict, &bootImageData);
if (bootImageData) {
x = (screen_params[0] - MIN(kAppleBootWidth, screen_params[0])) / 2;
y = (screen_params[1] - MIN(kAppleBootHeight, screen_params[1])) / 2;
x = (screen_params[0] - min(kAppleBootWidth, screen_params[0])) / 2;
y = (screen_params[1] - min(kAppleBootHeight, screen_params[1])) / 2;
drawDataRectangle(x, y, kAppleBootWidth, kAppleBootHeight, bootImageData);
free(bootImageData);
}

Archive Download the corresponding diff file

Revision: 452