Chameleon

Chameleon Commit Details

Date:2010-09-01 15:51:15 (13 years 7 months ago)
Author:Azimutz
Commit:472
Parents: 471
Message:Converted MIN() MAX() to lower case and removed unneeded definitions on graphics.c, gui.c & qsort.c.
Changes:
M/branches/azimutz/Chazi/doc-azi/CHANGES.txt
M/branches/azimutz/Chazi/i386/libsa/qsort.c
M/branches/azimutz/Chazi/i386/boot2/graphics.c
M/branches/azimutz/Chazi/i386/libsaio/saio_types.h
M/branches/azimutz/Chazi/i386/boot2/gui.c

File differences

branches/azimutz/Chazi/doc-azi/CHANGES.txt
280280
281281
282282
283
283
284284
285285
286286
---------------//---------------//---------------
- (revs 465 --> ??)
- (revs 465 --> 467, 469 --> 471)
Change:added AutoResolution patch, by Lebidou (AutoResolution branch). The main intention of this
patch, is allowing native resolution after boot, even without graphics acceleration (qe/ci).
The "side effect" is that it also enables native resolution at boot prompt (Gui).
branches/azimutz/Chazi/i386/libsaio/saio_types.h
231231
232232
233233
234
235234
236
237
238
239235
240
241236
242237
243238
DEV_EN = 3
};
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#defineround2(x, m)(((x) + (m / 2)) & ~(m - 1))
#define roundup2(x, m) (((x) + m - 1) & ~(m - 1))
branches/azimutz/Chazi/i386/boot2/graphics.c
4343
4444
4545
46
47
4846
4947
5048
......
612610
613611
614612
615
616
613
614
617615
618616
619617
......
792790
793791
794792
795
796
793
794
797795
798796
799797
......
818816
819817
820818
821
822
819
820
823821
824822
825823
uint8_t *previewSaveunder = 0;
#define VIDEO(x) (bootArgs->Video.v_ ## x)
#define MIN(x, y) ((x) < (y) ? (x) : (y)) //Azi: take care of this in the process***
//==========================================================================
// 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/Chazi/i386/boot2/gui.c
2222
2323
2424
25
26
27
2825
2926
3027
......
469466
470467
471468
472
469
473470
474471
475472
......
484481
485482
486483
487
484
488485
489486
490487
......
496493
497494
498495
499
496
500497
501498
502499
......
540537
541538
542539
543
540
544541
545542
546
543
547544
548545
549546
......
590587
591588
592589
593
590
594591
595592
596
593
597594
598595
599596
......
602599
603600
604601
605
602
606603
607604
608
605
609606
610607
611608
......
633630
634631
635632
636
633
637634
638635
639
636
640637
641638
642639
......
651648
652649
653650
654
651
655652
656653
657654
......
660657
661658
662659
663
660
664661
665662
666
663
667664
668665
669666
......
845842
846843
847844
848
845
849846
850847
851848
......
11081105
11091106
11101107
1111
1112
1108
1109
11131110
11141111
11151112
......
11931190
11941191
11951192
1196
1197
1193
1194
11981195
11991196
12001197
......
12731270
12741271
12751272
1276
1277
1273
1274
12781275
12791276
12801277
......
19311928
19321929
19331930
1934
1935
1931
1932
19361933
19371934
19381935
......
19471944
19481945
19491946
1950
1951
1947
1948
19521949
19531950
19541951
#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; }
#define MIN(x, y) ((x) < (y) ? (x) : (y)) //Azi: take care of this in the process.***
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define VIDEO(x) (bootArgs->Video.v_ ## x)
#define vram VIDEO(baseAddr)
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 bool showBootBanner; //||
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/Chazi/i386/libsa/qsort.c
5858
5959
6060
61
62
6163
6264
6365
64
65
6666
6767
6868
#include <sys/types.h>
#include <stdlib.h>
#include "saio_types.h" //Azi: min/max
static inline char*med3 __P((char *, char *, char *, int (*)()));
static inline void swapfunc __P((char *, char *, int, int));
#define min(a, b)(a) < (b) ? a : b
/*
* Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
*/

Archive Download the corresponding diff file

Revision: 472