From d3074636fff0fbcd5fd9b71c0c3b1c1f5c0c1285 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 13 Nov 2026 15:07:42 -0300 Subject: host: add optional Tracy profiling and reduce upload allocation stalls --- test/fonts.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/fonts.c b/test/fonts.c index 87a47bb..cd3b9ff 100644 --- a/test/fonts.c +++ b/test/fonts.c @@ -54,7 +54,19 @@ int main(int argc, char **argv) { SDL_Rect clip={30,620,400,30}; SDL_SetRenderClipRect(r,&clip); assert(sk_text_draw(r,30,617,1.6f,"Clipping preserves the baseline and glyph edges outside this box",strlen("Clipping preserves the baseline and glyph edges outside this box"),112,183,255,255)); SDL_SetRenderClipRect(r,NULL); + assert(sk_text_draw(r,30,680,1.6f,"animated ink",12,240,20,40,255)); + const size_t cached_bytes = c->bytes; + assert(sk_text_draw(r,30,730,1.6f,"animated ink",12,40,20,240,128)); + assert(c->bytes == cached_bytes); /* Color and opacity reuse the coverage mask. */ assert(SDL_RenderPresent(r)); + unsigned red_pixels = 0, blue_pixels = 0; + for (int y=680; y<780; ++y) for (int x=30; x<250; ++x) { + Uint8 red, green, blue, alpha; + assert(SDL_ReadSurfacePixel(surface,x,y,&red,&green,&blue,&alpha)); + if (y<710 && red>150 && blue<100) ++red_pixels; + if (y>=730 && blue>70 && red<70) ++blue_pixels; + } + assert(red_pixels>50 && blue_pixels>50); if(argc>1) assert(SDL_SavePNG(surface,argv[1])); assert(SDL_SetRenderLogicalPresentation(r,720,410,SDL_LOGICAL_PRESENTATION_LETTERBOX)); assert(fabsf(density(r)-2)<0.01f); -- cgit v1.3