/* Host check of the actual gfx_fill_rect arithmetic, with only the banked hardware span writer substituted. check_graphics.py extracts the current driver function into graphics_fill_under_test.h in a disposable build folder. GPL-3.0-or-later. */ #include #include #include #include #include "graphics.h" typedef unsigned char byte; #define WINDOW 0x8000 static byte back=0x1e; static byte image[40960],reference_image[40960]; static void span(byte bank,unsigned address,byte firstMask,byte fullBytes, byte lastMask,byte packed) { unsigned pos=(bank-back)*8192+address-WINDOW; assert(pos<36000); if(firstMask) {image[pos]=(image[pos]&~firstMask)|(packed&firstMask);++pos;} while(fullBytes--) {assert(pos<36000);image[pos++]=packed;} if(lastMask) {assert(pos<36000);image[pos]=(image[pos]&~lastMask)|(packed&lastMask);} } #include "graphics_fill_under_test.h" static void reference(unsigned x,unsigned y,unsigned w,unsigned h,byte color) { unsigned xx,yy,pos,shift; if(color>3 || x>=640 || y>=225 || !w || !h)return; if(w>640-x)w=640-x; if(h>225-y)h=225-y; for(yy=y;yy