Unified · Split
| @@ -112,9 +112,9 @@ pt_font(uchar *data, float height) · 111 unmodified lines | |||
| 112 | 112 | ||
| 113 | if((f->g = allocmemimage(f->bb, GREY8)) == nil) | 113 | if((f->g = allocmemimage(f->bb, GREY8)) == nil) |
| 114 | goto err; | 114 | goto err; |
| 115 | if((f->white = allocmemimage(f->bb, GREY8)) == nil) | 115 | if((f->b = allocmemimage(f->bb, GREY8)) == nil) |
| 116 | goto err; | 116 | goto err; |
| 117 | memfillcolor(f->white, DWhite); | 117 | memfillcolor(f->b, DWhite); |
| 118 | 118 | ||
| 119 | return f; | 119 | return f; |
| 120 | err: | 120 | err: |
| @@ -129,7 +129,7 @@ pt_freefont(Sfont *f) · 8 unmodified lines | |||
| 129 | return; | 129 | return; |
| 130 | free(f->c2g); | 130 | free(f->c2g); |
| 131 | freememimage(f->g); | 131 | freememimage(f->g); |
| 132 | freememimage(f->white); | 132 | freememimage(f->b); |
| 133 | free(f); | 133 | free(f); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| @@ -265,7 +265,7 @@ pt_textdraw(Sfont *f, char *s, Rectangle rect, Sdopts *opts) · 129 unmodified lines | |||
| 265 | ); | 265 | ); |
| 266 | o.min.x = floor(x) + x0; | 266 | o.min.x = floor(x) + x0; |
| 267 | o.min.y = base + f->asc*f->scale + y0; | 267 | o.min.y = base + f->asc*f->scale + y0; |
| 268 | memimagedraw(mi, o, f->white, ZP, f->g, ZP, DoutS); | 268 | memimagedraw(mi, o, f->b, ZP, f->g, ZP, DoutS); |
| 269 | stbtt_GetGlyphHMetrics(&f->fi, glyph, &adv, &leftb); | 269 | stbtt_GetGlyphHMetrics(&f->fi, glyph, &adv, &leftb); |
| 270 | x += adv * f->scale; | 270 | x += adv * f->scale; |
| 271 | }else | 271 | }else |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | struct Sfont { | 3 | struct Sfont { |
| 4 | Memimage *g; | 4 | Memimage *g; |
| 5 | Memimage *white; | 5 | Memimage *b; |
| 6 | 6 | ||
| 7 | stbtt_code2glyph *c2g; | 7 | stbtt_code2glyph *c2g; |
| 8 | 8 | ||
| @@ -28,11 +28,11 @@ redraw(void) · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | lockdisplay(display); | 29 | lockdisplay(display); |
| 30 | 30 | ||
| 31 | draw(screen, screen->r, invert ? display->black : display->white, nil, ZP); | 31 | draw(screen, screen->r, display->white, nil, ZP); |
| 32 | 32 | ||
| 33 | r = rectaddpt(screen->r, offset); | 33 | r = rectaddpt(screen->r, offset); |
| 34 | r.max = screen->r.max; | 34 | r.max = screen->r.max; |
| 35 | draw(screen, r, invert ? display->white : display->black, image, ZP); | 35 | draw(screen, r, fg, image, ZP); |
| 36 | 36 | ||
| 37 | r = screen->r; | 37 | r = screen->r; |
| 38 | r.min.y = r.max.y - font->height - 4; | 38 | r.min.y = r.max.y - font->height - 4; |
| @@ -108,6 +108,7 @@ threadmain(int argc, char **argv) · 69 unmodified lines | |||
| 108 | threadsetname("libpt"); | 108 | threadsetname("libpt"); |
| 109 | if(initdraw(nil, nil, "libpt") < 0) | 109 | if(initdraw(nil, nil, "libpt") < 0) |
| 110 | sysfatal("initdraw: %r"); | 110 | sysfatal("initdraw: %r"); |
| 111 | fg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DBlack); | ||
| 111 | display->locking = 1; | 112 | display->locking = 1; |
| 112 | unlockdisplay(display); | 113 | unlockdisplay(display); |
| 113 | if((mctl = initmouse(nil, screen)) == nil) | 114 | if((mctl = initmouse(nil, screen)) == nil) |