#include #include #include #include #include "graph.h" #include "libretro-core.h" extern int VIRTUAL_WIDTH; void DrawFBoxBmp(char *buffer,int x,int y,int dx,int dy,unsigned color){ int i,j,idx; #if defined PITCH && PITCH == 4 unsigned *mbuffer=(unsigned*)buffer; #else unsigned short *mbuffer=(unsigned short *)buffer; #endif for(i=x;i= 0) ? 1 : -1; sy = (dy >= 0) ? 1 : -1; if (dx==0) { if (dy>0) { DrawVlineBmp(buffer, x1, y1,0, dy, color); return; } else if (dy<0) { DrawVlineBmp(buffer, x1, y2,0, -dy, color); return; } else { idx=x1+y1*VIRTUAL_WIDTH; mbuffer[idx]=(mbuffer[idx]/2)+(color/2); return ; } } if (dy == 0) { if (dx>0) { DrawHlineBmp(buffer, x1, y1, dx, 0, color); return; } else if (dx<0) { DrawHlineBmp(buffer, x2, y1, -dx,0, color); return; } } dx = sx * dx + 1; dy = sy * dy + 1; pixx = 1; pixy = VIRTUAL_WIDTH; pixx *= sx; pixy *= sy; if (dx < dy) { swaptmp = dx; dx = dy; dy = swaptmp; swaptmp = pixx; pixx = pixy; pixy = swaptmp; } x = 0; y = 0; idx=x1+y1*VIRTUAL_WIDTH; for (; x < dx; x++, idx +=pixx) { mbuffer[idx]=(mbuffer[idx]/2)+(color/2); y += dy; if (y >= dx) { y -= dx; idx += pixy; } } } /* void DrawBox(char *buffer,box b,char t[],unsigned color){ DrawBoxBmp(mbuffer,b.x,b.y,b.dx,b.dy,color); textCpixel(mbuffer,b.x, 3*b.x + b.dx ,b.y+2,color,1,1,4,"%s",t); } void DrawBoxF(char *buffer,box b,char t[],unsigned color,unsigned border){ int ydec=b.y+(b.dy/2)-4; if(ydecmaxstrlen) strlen = maxstrlen; int surfw=strlen * 7 * xscale; int surfh=8 * yscale; #if defined PITCH && PITCH == 4 linesurf =(unsigned char *)malloc(sizeof(unsigned )*surfw*surfh ); yptr = (unsigned *)&linesurf[0]; #elif defined PITCH && PITCH == 2 linesurf =(unsigned char *)malloc(sizeof(unsigned short)*surfw*surfh ); yptr = (unsigned short *)&linesurf[0]; #elif defined PITCH && PITCH == 1 linesurf =(unsigned char *)malloc(sizeof(unsigned char)*surfw*surfh ); yptr = (unsigned char *)&linesurf[0]; #endif for(ypixel = 0; ypixel<8; ypixel++) { for(col=0; col