source: titan/titan/i386port.h @ 15227

Last change on this file since 15227 was 15227, checked in by nit, 12 years ago

fix

File size: 4.3 KB
Line 
1#ifndef I386PORT_H
2#define I386PORT_H
3
4void enablemanualblit()
5{
6}
7
8//flag 0 = no animation
9//flag 1 = animation
10void blitfb2(struct fb* fbnode, int flag)
11{
12        int i = 0;
13
14        if(fbnode == NULL) return;
15
16#ifdef NOFB
17        if(status.rguidfd > -1)
18        {
19                unsigned char* buf = NULL;
20                buf = scale(fbnode->fb, fbnode->width, fbnode->height, 4, 320, 240, 0);
21                if(buf != NULL)
22                {
23                        socksend(&status.rguidfd, (unsigned char*)buf, 320 * 240 * 4, 5000 * 1000);
24                        free(buf); buf = NULL;
25                }
26        }
27        if(status.write_png == 1 && status.infobaraktiv == 0)
28        {
29                unsigned char* buf = NULL;
30                buf = scale(fbnode->fb, fbnode->width, fbnode->height, 4, 320, 240, 0);
31                if(buf != NULL)
32                {
33                        if(writeFBfile.ActBuf == NULL)
34                        {
35                                writeFBfile.buf1 = malloc(4 * 320 * 240);
36                                writeFBfile.ActBuf = writeFBfile.buf1;
37                                memcpy(writeFBfile.buf1, (unsigned char*)buf, 4 * 320 * 240);
38                                addtimer(&fb2png_thread, START, 10000, 1, NULL, NULL, NULL);
39                        }
40                        else if(writeFBfile.buf1 == writeFBfile.ActBuf)
41                        {
42                                if(writeFBfile.buf2 == NULL)
43                                        writeFBfile.buf2 = malloc(4 * 320 * 240);
44                                memcpy(writeFBfile.buf2, (unsigned char*)buf, 4 * 320 * 240);
45                        }
46                        else if(writeFBfile.buf2 == writeFBfile.ActBuf)
47                        {
48                                if(writeFBfile.buf1 == NULL)
49                                        writeFBfile.buf1 = malloc(4 * 320 * 240);
50                                memcpy(writeFBfile.buf1, (unsigned char*)buf, 4 * 320 * 240);
51                        }
52                        //fb2png((unsigned char*)buf, 320, 240, "/tmp/titanlcd.png");
53                        free(buf); buf = NULL;
54                }
55        }
56
57        if(fbnode != fb)
58        {
59                for(i = 0; i < fbnode->height; i++)
60                {
61                        memcpy(fb->fb + (i * fb->pitch), fbnode->fb + (i * fbnode->pitch), fbnode->width * fbnode->colbytes);
62                }
63        }
64        system("killall -9 xloadimage");
65
66        FILE *fd;
67        fd=fopen("titan.png", "w");
68        fwrite(fb->fb, fb->varfbsize, 1, fd);
69        fclose(fd);
70
71        system("fbgrab -f titan.png -w 1280 -h 720 -b 32 titan1.png > /dev/null");
72        system("xloadimage titan1.png > /dev/null &");
73#endif
74}
75
76void setfbtransparent(int value)
77{
78}
79
80int allocbpamem(size_t size, int *memfd, unsigned char **mem)
81{
82        return -1;
83}
84
85void freebpamem(int memfd, unsigned char* mem, size_t len)
86{
87}
88
89//mode 0: with fill (draw to skinfb)
90//mode 1: without fill (draw to skinfb)
91//mode 2: with fill (draw to fb)
92//mode 3: without fill (draw to fb)
93void blitrect(int posx, int posy, int width, int height, long color, int transparent, int mode)
94{
95        //debug(1000, "in");
96        int y, x;
97        unsigned long tmpcol;
98       
99        if(posx < 0) posx = 0;
100        if(posx > skinfb->width) posx = skinfb->width;
101        if(posy < 0) posy = 0;
102        if(posy > skinfb->height) posy = skinfb->height;
103        if(posx + width > skinfb->width) width = skinfb->width - posx;
104        if(posy + height > skinfb->height) height = skinfb->height - posy;
105
106        if(width <= 0 || height <= 0) return;
107
108        transparent = (transparent - 255) * -1;
109        tmpcol = color | ((transparent & 0xff) << 24);
110
111        if(mode == 0 || mode == 2)
112        {
113                for(y = 0; y < height; y++)
114                {
115                        for(x = 0; x < width; x++)
116                        {
117                                drawpixel(posx + x, posy + y, tmpcol);
118                        }
119                }
120        }
121        else if(mode == 1 || mode == 3)
122        {
123                //topline
124                for(x = 0; x < width; x++)
125                        drawpixel(posx + x, posy, tmpcol);
126                //bottomline
127                for(x = 0; x < width; x++)
128                        drawpixel(posx + x, posy + height - 1, tmpcol);
129                //leftline
130                for(y = 0; y < height; y++)
131                        drawpixel(posx, posy + y, tmpcol);
132                //rightline
133                for(y = 0; y < height; y++)
134                        drawpixel(posx + width - 1, posy + y, tmpcol);
135        }
136        //debug(1000, "out");
137}
138
139int readjpg(const char* filename, unsigned long* width, unsigned long* height, unsigned long* rowbytes, int* channels, unsigned char **mem, int *memfd)
140{
141        return -1;
142}
143
144//flag 0: blit from accelfb to skinfb
145//flag 1: blit from skinfb to accelfb
146void blitscale(int posx, int posy, int width, int height, int scalewidth, int scaleheight, int flag)
147{
148}
149
150void blitjpg(unsigned char* buf, int posx, int posy, int width, int height, int scalewidth, int scaleheight)
151{
152}
153
154void sighandler(int sig, struct sigcontext ctx)
155{
156
157        debug(1000, "in");
158        switch(sig)
159        {
160                case SIGUSR1:
161                {
162                        //todo all configs
163                        reloadconfig(status.configfile);
164                        reloadconfig(getconfig("ownconfig", NULL));
165                        break;
166                }
167                case SIGSEGV:
168                case SIGBUS:
169                case SIGABRT:
170                {
171                        //intel
172                        debugstack((void *)ctx.eip, NULL);
173                        err("got signal %d, fault address 0x%lx from 0x%lx", sig, ctx.cr2, ctx.eip);
174
175                        if(getconfigint("saverun", NULL) == 1 && status.longjumpbuf != NULL)
176                                siglongjmp(status.longjumpbuf, 1);
177                        else
178                                exit(100);
179                        break;
180                }
181        }
182        debug(1000, "out");
183}
184
185#endif
Note: See TracBrowser for help on using the repository browser.