static void redraw(struct GP_Context *context) { GP_Pixel white_pixel, black_pixel; black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); GP_Fill(context, black_pixel); GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel); GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel); }
void redraw_screen(void) { SDL_LockSurface(display); GP_Fill(&context, black_pixel); GP_Text(&context, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW, darkgray_pixel, black_pixel, "GFXprim SDL Demo"); GP_Line(&context, 0, 0, W-1, H-1, darkgray_pixel); GP_Line(&context, 0, H-1, W-1, 0, darkgray_pixel); SDL_UnlockSurface(display); }
static void redraw(GP_Backend *self) { GP_Context *context = self->context; GP_Pixel white_pixel, black_pixel; black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); GP_Fill(context, black_pixel); GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel); GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel); /* Update the backend screen */ GP_BackendFlip(self); }
static int bench_line(GP_PixelType type) { GP_Context *img = GP_ContextAlloc(800, 600, type); if (img == NULL) { tst_err("Malloc failed"); return TST_UNTESTED; } unsigned int i; for (i = 0; i < 100000; i++) { GP_Line(img, 0 + i % 100, 0 - i % 100, 800 - i%200, 600 + i%200, i % 0xff); } return TST_SUCCESS; }