int GGI_monotext_setPalette(ggi_visual_t vis, size_t start, size_t size, const ggi_color *colormap) { ggi_monotext_priv *priv = MONOTEXT_PRIV(vis); const ggi_color *src = colormap; size_t end = start + size - 1; DPRINT("display-monotext: SetPalette(%d,%d)\n", start, size); memcpy(LIBGGI_PAL(vis)->clut.data+start, colormap, size*sizeof(ggi_color)); if (end > start) { UPDATE_MOD(priv, 0, 0, priv->size.x, priv->size.y); } for (; start<=end; ++start, ++src) { int r = (src->r >> 11) & 0x1f; int g = (src->g >> 11) & 0x1f; int b = (src->b >> 11) & 0x1f; priv->colormap[start] = *src; priv->greymap[start] = priv->rgb_to_grey[(r << 10) | (g << 5) | b]; } UPDATE_SYNC; return 0; }
int GGI_palemu_drawpixel_nc(struct ggi_visual *vis, int x, int y) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); UPDATE_MOD(vis, x, y, 1, 1); return priv->mem_opdraw->drawpixel_nc(vis, x, y); }
int GGI_palemu_drawhline(struct ggi_visual *vis, int x, int y, int w) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); UPDATE_MOD(vis, x, y, w, 1); return priv->mem_opdraw->drawhline(vis, x, y, w); }
int GGI_palemu_putpixel(struct ggi_visual *vis, int x, int y, ggi_pixel col) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); UPDATE_MOD(vis, x, y, 1, 1); return priv->mem_opdraw->putpixel(vis, x, y, col); }
int GGI_palemu_copybox(struct ggi_visual *vis, int x, int y, int w, int h, int nx, int ny) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); UPDATE_MOD(vis, nx, ny, w, h); return priv->mem_opdraw->copybox(vis, x, y, w, h, nx, ny); }
int GGI_palemu_fillscreen(struct ggi_visual *vis) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); UPDATE_MOD(vis, 0, 0, LIBGGI_VIRTX(vis), LIBGGI_VIRTY(vis)); return priv->mem_opdraw->fillscreen(vis); }
int GGI_palemu_drawbox(struct ggi_visual *vis, int x, int y, int w, int h) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); UPDATE_MOD(vis, x, y, w, h); return priv->mem_opdraw->drawbox(vis, x, y, w, h); }
int GGI_palemu_putbox(struct ggi_visual *vis, int x, int y, int w, int h, const void *buffer) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); UPDATE_MOD(vis, x, y, w, h); return priv->mem_opdraw->putbox(vis, x, y, w, h, buffer); }
int GGI_palemu_crossblit(struct ggi_visual *src, int sx, int sy, int w, int h, struct ggi_visual *vis, int dx, int dy) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); UPDATE_MOD(vis, dx, dy, w, h); return priv->mem_opdraw->crossblit(src, sx, sy, w, h, vis, dx, dy); }
int GGI_palemu_drawline(struct ggi_visual *vis, int x1, int y1, int x2, int y2) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); int sx = MIN(x1, x2); int sy = MIN(y1, y2); int ex = MAX(x1, x2); int ey = MAX(y1, y2); UPDATE_MOD(vis, sx, sy, ex-sx+1, ey-sy+1); return priv->mem_opdraw->drawline(vis, x1, y1, x2, y2); }
int GGI_palemu_setPalette(ggi_visual_t vis, size_t start, size_t len, const ggi_color *colormap) { ggi_palemu_priv *priv = PALEMU_PRIV(vis); const ggi_color *src = colormap; size_t end = start + len; DPRINT("display-palemu: SetPalette(%d,%d)\n", start, len); if (start < 0 || start + len > 256) { return GGI_ENOSPACE; } memcpy(LIBGGI_PAL(vis)->clut.data+start, src, len*sizeof(ggi_color)); if (end > start) { UPDATE_MOD(vis, 0, 0, LIBGGI_VIRTX(vis), LIBGGI_VIRTY(vis)); } for (; start < end; ++start, ++src) { priv->palette[start] = *src; priv->lookup[start] = ggiMapColor(priv->parent, src); } return 0; }