Chameleon

Chameleon Commit Details

Date:2010-08-31 04:47:07 (8 years 10 months ago)
Author:Azimutz
Commit:457
Parents: 456
Message:Big mess... Reverting min/max stuff on CleanCut; was a lapse. Finishing the job on Chazileon. Also fixed missing code on gui.c: gui.logo.draw = true;
Changes:
M/branches/azimutz/Chazileon/i386/libsa/qsort.c
M/branches/azimutz/Chazileon/i386/boot2/graphics.c
M/branches/azimutz/Chazileon/i386/libsaio/saio_types.h
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/libsaio/saio_types.h
232232
233233
234234
235
235
236236
237
237
238238
239
239
240240
241
241
242242
243243
244244
DEV_EN = 3
};
#ifndef max
//#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
//#endif
#ifndef min
//#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
//#endif
#defineround2(x, m)(((x) + (m / 2)) & ~(m - 1))
#define roundup2(x, m) (((x) + m - 1) & ~(m - 1))
branches/azimutz/Chazileon/i386/boot2/graphics.c
4444
4545
4646
47
47
4848
4949
5050
#define VIDEO(x) (bootArgs->Video.v_ ## x)
//#define min(x, y) ((x) < (y) ? (x) : (y)) Azi: it's defined on saio_types.h
//#define min(x, y) ((x) < (y) ? (x) : (y)) Azi: defined on saio_types.h
//==========================================================================
// getVBEInfoString
branches/azimutz/Chazileon/i386/boot2/gui.c
1515
1616
1717
18
19
18
19
2020
2121
2222
......
761761
762762
763763
764
765764
766765
767766
768767
769768
769
770770
771771
772772
#include "edid.h" //Azi:autoresolution
#include "autoresolution.h"
//#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 min(x, y) ((x) < (y) ? (x) : (y)) Azi: defined on saio_types.h
//#define max(x, y) ((x) > (y) ? (x) : (y))||||
#define VIDEO(x) (bootArgs->Video.v_ ## x)
if (createWindowBuffer(&gui.bootprompt) == 0) {
if (createWindowBuffer(&gui.infobox) == 0) {
if (createWindowBuffer(&gui.menu) == 0) {
gui.logo.draw = true;
#ifdef AUTORES_DEBUG
printf("Press Any Key...\n");
getc();
#endif
gui.logo.draw = true;
drawBackground();
// lets copy the screen into the back buffer
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
branches/azimutz/Chazileon/i386/libsa/qsort.c
5858
5959
6060
61
62
6163
6264
6365
64
66
6567
6668
6769
#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
//#define min(a, b)(a) < (b) ? a : b Azi: defined on saio_types.h
/*
* Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
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)) Azi: it's defined on saio_types.h
#define MIN(x, y) ((x) < (y) ? (x) : (y))
//==========================================================================
// 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
......
731731
732732
733733
734
734
735
735736
736737
737738
......
808809
809810
810811
811
812
812813
813814
814815
......
10651066
10661067
10671068
1068
1069
1069
1070
10701071
10711072
10721073
......
11501151
11511152
11521153
1153
1154
1154
1155
11551156
11561157
11571158
......
12301231
12311232
12321233
1233
1234
1234
1235
12351236
12361237
12371238
......
18641865
18651866
18661867
1867
1868
1868
1869
18691870
18701871
18711872
......
18801881
18811882
18821883
1883
1884
1884
1885
18851886
18861887
18871888
#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; }
//#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 MIN(x, y) ((x) < (y) ? (x) : (y))
#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);
if (createWindowBuffer(&gui.devicelist) == 0) {
if (createWindowBuffer(&gui.bootprompt) == 0) {
if (createWindowBuffer(&gui.infobox) == 0) {
if (createWindowBuffer(&gui.menu) == 0) {
if (createWindowBuffer(&gui.menu) == 0) {
gui.logo.draw = true;
drawBackground();
// lets copy the screen into the back buffer
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
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: 457