static void paint_internal(widget_t *w) { minimal_t *min = (minimal_t *) w; surface_t *surface = window_claim(min->widget.window); if (!surface) { window_yield(min->widget.window); } for (sysarg_t y = w->vpos; y < w->vpos + w->height; ++y) { for (sysarg_t x = w->hpos; x < w->hpos + w->width; ++x) { if (y % 2) { if (x % 2) { surface_put_pixel(surface, x, y, min->pix_a); } else { surface_put_pixel(surface, x, y, min->pix_b); } } else { if (x % 2) { surface_put_pixel(surface, x, y, min->pix_b); } else { surface_put_pixel(surface, x, y, min->pix_a); } } } } window_yield(min->widget.window); }
static int fde_load_glyph_surface(void *unused, glyph_id_t glyph_id, surface_t **out_surface) { surface_t *surface = surface_create(FONT_WIDTH, FONT_SCANLINES, NULL, 0); if (!surface) return ENOMEM; for (unsigned int y = 0; y < FONT_SCANLINES; ++y) { for (unsigned int x = 0; x < FONT_WIDTH; ++x) { pixel_t p = (fb_font[glyph_id][y] & (1 << (7 - x))) ? PIXEL(255, 0, 0, 0) : PIXEL(0, 0, 0, 0); surface_put_pixel(surface, x, y, p); } } *out_surface = surface; return EOK; }