popup: one text drawing call; drop what the draw thread never reaches
font.c exported three wrappers for one function, and the fit == -1 mode existed only for the tests; textdraw() takes fit and colour. win.c tested the empty picture in the thread and again in winshow, interned two atoms by hand next to getatom(), kept a consumer-side drain that the producer's already guarantees never finds anything, zeroed ten globals before returning from the only thread that read them, and re-checked sizes that resizebacking had just established. The page marker is laid out once and drawn from the layout instead of being recomputed.
This commit is contained in:
@@ -120,7 +120,7 @@ checktext(struct ct *t, u32int *buf, char *utf)
|
||||
CT_CHECK(t, w > 0);
|
||||
CT_CHECK(t, w < Testw - Fontsz);
|
||||
fillpixels(buf, Testn, Colbg);
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, &s);
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, Testw, Colfg, &s);
|
||||
if(!CT_CHECK(t, inkbounds(buf, Colbg, &minx, &miny, &maxx, &maxy)))
|
||||
return;
|
||||
CT_CHECK(t, minx >= 0 && miny >= 0);
|
||||
@@ -140,7 +140,7 @@ checkcolor(struct ct *t, u32int *buf, char *utf)
|
||||
if(s.n > 1)
|
||||
CT_CHECK(t, w < s.n * Fontsz);
|
||||
fillpixels(buf, Testn, Colbg);
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, &s);
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, Testw, Colfg, &s);
|
||||
CT_CHECK(t, hasink(buf, Testn, Colbg));
|
||||
CT_CHECK(t, hascolors(buf, Testn, Colbg));
|
||||
}
|
||||
@@ -156,7 +156,7 @@ checkshape(struct ct *t, u32int *buf, char *utf)
|
||||
CT_CHECK(t, w > 0);
|
||||
CT_CHECK(t, w < s.n * Fontsz);
|
||||
fillpixels(buf, Testn, Colbg);
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, &s);
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, Testw, Colfg, &s);
|
||||
CT_CHECK(t, hasink(buf, Testn, Colbg));
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ checkclip(struct ct *t, u32int *mem, int x, int y, Str *s)
|
||||
|
||||
buf = mem + Guard;
|
||||
fillpixels(buf, Testn, Colbg);
|
||||
textdraw(buf, Testw, Testh, x, y, s);
|
||||
textdraw(buf, Testw, Testh, x, y, Testw, Colfg, s);
|
||||
CT_CHECK(t, hasink(buf, Testn, Colbg));
|
||||
checkoutside(t, buf, Colbg, y);
|
||||
checkguards(t, mem);
|
||||
@@ -203,7 +203,7 @@ font_render(struct ct *t)
|
||||
|
||||
heart = mkstr("❤️");
|
||||
fillpixels(buf, Testn, Colsel);
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, &heart);
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, Testw, Colfg, &heart);
|
||||
CT_CHECK(t, hascolors(buf, Testn, Colsel));
|
||||
CT_EQ_UINT(t, Colsel,
|
||||
buf[(Fontsz + Fontsz/2) * Testw + Testw - 1] & Rgbmask);
|
||||
@@ -220,8 +220,8 @@ font_render(struct ct *t)
|
||||
natural = textwidth(&longrow);
|
||||
CT_CHECK(t, natural > 2*Fontsz);
|
||||
fillpixels(buf, Testn, Colbg);
|
||||
textdrawfit(buf, Testw, Testh, 2*Fontsz, Fontsz,
|
||||
2*Fontsz, &longrow);
|
||||
textdraw(buf, Testw, Testh, 2*Fontsz, Fontsz, 2*Fontsz, Colfg,
|
||||
&longrow);
|
||||
CT_CHECK(t, hasink(buf, Testn, Colbg));
|
||||
for(y = Fontsz; y < 2*Fontsz; y++){
|
||||
for(x = 0; x < 2*Fontsz; x++)
|
||||
@@ -232,8 +232,8 @@ font_render(struct ct *t)
|
||||
CT_EQ_INT(t, natural, textwidth(&longrow));
|
||||
|
||||
fillpixels(buf, Testn, Colsel);
|
||||
textdrawfitcolor(buf, Testw, Testh, 2*Fontsz, Fontsz,
|
||||
2*Fontsz, Colselfg, &longrow);
|
||||
textdraw(buf, Testw, Testh, 2*Fontsz, Fontsz, 2*Fontsz, Colselfg,
|
||||
&longrow);
|
||||
CT_CHECK(t, (Colselfg & Rgbmask) != (Colsel & Rgbmask));
|
||||
if(CT_CHECK(t, inkbounds(buf, Colsel,
|
||||
&minx, &miny, &maxx, &maxy))){
|
||||
@@ -248,8 +248,8 @@ font_render(struct ct *t)
|
||||
|
||||
missing = mkstr("\xF4\x8F\xBF\xBF");
|
||||
for(i = 0; i < 32; i++){
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, &heart);
|
||||
textdraw(buf, Testw, Testh, 0, 0, &missing);
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, Testw, Colfg, &heart);
|
||||
textdraw(buf, Testw, Testh, 0, 0, Testw, Colfg, &missing);
|
||||
}
|
||||
checkguards(t, mem);
|
||||
free(mem);
|
||||
|
||||
Reference in New Issue
Block a user