From e136ab597105dcbe211ce0a1f49113b4cb14b1ca Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 9 Apr 2009 11:32:27 +0000 Subject: make 8bpp plotters work svn path=/trunk/libnsfb/; revision=7071 --- src/8bpp_plotters.c | 583 +++++++++++++++++++++++----------------------------- src/Makefile | 2 +- src/frontend.c | 2 +- src/frontend_sdl.c | 28 ++- src/plotters.c | 3 - 5 files changed, 277 insertions(+), 341 deletions(-) diff --git a/src/8bpp_plotters.c b/src/8bpp_plotters.c index 777b896..a6bb3a3 100644 --- a/src/8bpp_plotters.c +++ b/src/8bpp_plotters.c @@ -1,89 +1,48 @@ /* - * Copyright 2008 Vincent Sanders + * Copyright 2009 Vincent Sanders * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * This file is part of libnsfb, http://www.netsurf-browser.org/ + * Licenced under the MIT License, + * http://www.opensource.org/licenses/mit-license.php */ -#include -#include -#include +#include +#include +#include #include +#include -#include "utils/log.h" -#include "utils/utf8.h" -#include "desktop/plotters.h" - -#include "framebuffer/fb_gui.h" -#include "framebuffer/fb_plotters.h" -#include "framebuffer/fb_bitmap.h" -#include "framebuffer/fb_font.h" - -static inline uint8_t * -fb_8bpp_get_xy_loc(int x, int y) -{ - return (uint8_t *)(framebuffer->ptr + - (y * framebuffer->linelen) + - (x)); -} - - -static bool fb_8bpp_line(int x0, int y0, int x1, int y1, int width, - colour c, bool dotted, bool dashed) -{ - LOG(("%d, %d, %d, %d, %d, 0x%lx, %d, %d", - x0, y0, x1, y1, width, (unsigned long)c, dotted, dashed)); - - return true; -} +#include "libnsfb.h" +#include "nsfb.h" +#include "nsfb_plot.h" +#include "plotters.h" +#include "plot_util.h" -static bool fb_8bpp_rectangle(int x0, int y0, int width, int height, - int line_width, colour c, bool dotted, bool dashed) +static inline uint8_t *get_xy_loc(nsfb_t *nsfb, int x, int y) { - fb_8bpp_line(x0, y0, x0 + width, y0, line_width, c, dotted, dashed); - fb_8bpp_line(x0, y0 + height, x0 + width, y0 + height, line_width, c, dotted, dashed); - fb_8bpp_line(x0, y0, x0, y0 + height, line_width, c, dotted, dashed); - fb_8bpp_line(x0 + width, y0, x0 + width, y0 + height, line_width, c, dotted, dashed); - return true; + return (uint8_t *)(nsfb->ptr + (y * nsfb->linelen) + (x)); } -static bool fb_8bpp_polygon(const int *p, unsigned int n, colour fill) -{ - /*LOG(("%p, %d, 0x%lx", p,n,fill));*/ - return fb_plotters_polygon(p, n, fill, fb_8bpp_line); -} -static colour calc_colour(uint8_t c) +static inline nsfb_colour_t pixel_to_colour(nsfb_t *nsfb, uint8_t pixel) { - return framebuffer->palette[c]; + return nsfb->palette[pixel]; } - -static int -find_closest_palette_entry(colour c) +static uint8_t +colour_to_pixel(nsfb_t *nsfb, nsfb_colour_t c) { - colour palent; + nsfb_colour_t palent; int col; int dr, dg, db; /* delta red, green blue values */ int cur_distance; int best_distance = INT_MAX; - int best_col = 0; + uint8_t best_col = 0; for (col = 0; col < 256; col++) { - palent = framebuffer->palette[col]; + palent = nsfb->palette[col]; dr = (c & 0xFF) - (palent & 0xFF); dg = ((c >> 8) & 0xFF) - ((palent >> 8) & 0xFF); @@ -98,367 +57,337 @@ find_closest_palette_entry(colour c) return best_col; } -static inline uint8_t fb_colour_to_pixel(colour c) -{ - return find_closest_palette_entry(c); -} +#define SIGN(x) ((x<0) ? -1 : ((x>0) ? 1 : 0)) -static inline colour fb_8bpp_to_colour(uint8_t pixel) +static bool +line(nsfb_t *nsfb, + nsfb_bbox_t *line, + int line_width, + nsfb_colour_t c, + bool dotted, + bool dashed) { - return framebuffer->palette[pixel]; + int w; + uint8_t ent; + uint8_t *pvideo; + int x, y, i; + int dx, dy, sdy; + int dxabs, dyabs; + + line_width = line_width; + dotted = dotted; + dashed = dashed; + + ent = colour_to_pixel(nsfb, c); + + if (line->y0 == line->y1) { + /* horizontal line special cased */ + if (!nsfb_plot_clip_ctx(nsfb, line)) + return true; /* line outside clipping */ + + pvideo = get_xy_loc(nsfb, line->x0, line->y0); + + w = line->x1 - line->x0; + while (w-- > 0) + *(pvideo + w) = ent; + + return true; + } else { + /* standard bresenham line */ + if (!nsfb_plot_clip_line_ctx(nsfb, line)) + return true; /* line outside clipping */ + + /* the horizontal distance of the line */ + dx = line->x1 - line->x0; + dxabs = abs (dx); + + /* the vertical distance of the line */ + dy = line->y1 - line->y0; + dyabs = abs (dy); + + sdy = dx ? SIGN(dy) * SIGN(dx) : SIGN(dy); + + if (dx >= 0) + pvideo = get_xy_loc(nsfb, line->x0, line->y0); + else + pvideo = get_xy_loc(nsfb, line->x1, line->y1); + + x = dyabs >> 1; + y = dxabs >> 1; + + if (dxabs >= dyabs) { + /* the line is more horizontal than vertical */ + for (i = 0; i < dxabs; i++) { + *pvideo = ent; + + pvideo++; + y += dyabs; + if (y >= dxabs) { + y -= dxabs; + pvideo += sdy * nsfb->linelen; + } + } + } else { + /* the line is more vertical than horizontal */ + for (i = 0; i < dyabs; i++) { + *pvideo = ent; + pvideo += sdy * nsfb->linelen; + + x += dxabs; + if (x >= dyabs) { + x -= dyabs; + pvideo++; + } + } + } + + } + + return true; } -static bool fb_8bpp_fill(int x0, int y0, int x1, int y1, colour c) +static bool fill(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t c) { int y; uint8_t ent; uint8_t *pvideo; - if (!fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1)) + if (!nsfb_plot_clip_ctx(nsfb, rect)) return true; /* fill lies outside current clipping region */ - pvideo = fb_8bpp_get_xy_loc(x0, y0); + pvideo = get_xy_loc(nsfb, rect->x0, rect->y0); - ent = find_closest_palette_entry(c); + ent = colour_to_pixel(nsfb, c); - for (y = y0; y < y1; y++) { - memset(pvideo, ent, x1 - x0); - pvideo += framebuffer->linelen; + for (y = rect->y0; y < rect->y1; y++) { + memset(pvideo, ent, rect->x1 - rect->x0); + pvideo += nsfb->linelen; } return true; } -static bool fb_8bpp_clg(colour c) +static bool point(nsfb_t *nsfb, int x, int y, nsfb_colour_t c) { - LOG(("colour %lx", (unsigned long)c)); - fb_8bpp_fill(fb_plot_ctx.x0, - fb_plot_ctx.y0, - fb_plot_ctx.x1, - fb_plot_ctx.y1, - c); - return true; -} + uint8_t *pvideo; -#ifdef FB_USE_FREETYPE + /* check point lies within clipping region */ + if ((x < nsfb->clip.x0) || + (x >= nsfb->clip.x1) || + (y < nsfb->clip.y0) || + (y >= nsfb->clip.y1)) + return true; -static bool -fb_8bpp_draw_ft_monobitmap(FT_Bitmap *bp, int x, int y, colour c) -{ - return false; + pvideo = get_xy_loc(nsfb, x, y); + + if ((c & 0xFF000000) != 0) { + if ((c & 0xFF000000) != 0xFF000000) { + c = nsfb_plot_ablend(c, pixel_to_colour(nsfb, *pvideo)); + } + + *pvideo = colour_to_pixel(nsfb, c); + } + return true; } static bool -fb_8bpp_draw_ft_bitmap(FT_Bitmap *bp, int x, int y, colour c) +glyph1(nsfb_t *nsfb, + nsfb_bbox_t *loc, + const uint8_t *pixel, + int pitch, + nsfb_colour_t c) { uint8_t *pvideo; - uint8_t *pixel = (uint8_t *)bp->buffer; - colour abpixel; /* alphablended pixel */ int xloop, yloop; - int x0,y0,x1,y1; int xoff, yoff; /* x and y offset into image */ - int height = bp->rows; - int width = bp->width; - uint32_t fgcol; - - /* The part of the scaled image actually displayed is cropped to the - * current context. - */ - x0 = x; - y0 = y; - x1 = x + width; - y1 = y + height; + int x = loc->x0; + int y = loc->y0; + int width = loc->x1 - loc->x0; + int height = loc->y1 - loc->y0; + uint8_t fgcol; + const uint8_t *fntd; + uint8_t row; - if (!fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1)) + if (!nsfb_plot_clip_ctx(nsfb, loc)) return true; - if (height > (y1 - y0)) - height = (y1 - y0); + if (height > (loc->y1 - loc->y0)) + height = (loc->y1 - loc->y0); - if (width > (x1 - x0)) - width = (x1 - x0); + if (width > (loc->x1 - loc->x0)) + width = (loc->x1 - loc->x0); - xoff = x0 - x; - yoff = y0 - y; - - /* plot the image */ - pvideo = fb_8bpp_get_xy_loc(x0, y0); + xoff = loc->x0 - x; + yoff = loc->y0 - y; - fgcol = c & 0xFFFFFF; - - for (yloop = 0; yloop < height; yloop++) { - for (xloop = 0; xloop < width; xloop++) { - abpixel = (pixel[((yoff + yloop) * bp->pitch) + xloop + xoff] << 24) | fgcol; - if ((abpixel & 0xFF000000) != 0) { - if ((abpixel & 0xFF000000) != 0xFF000000) { - abpixel = fb_plotters_ablend(abpixel, - fb_8bpp_to_colour(*(pvideo + xloop))); - } + pvideo = get_xy_loc(nsfb, loc->x0, loc->y0); - *(pvideo + xloop) = fb_colour_to_pixel(abpixel); + fgcol = colour_to_pixel(nsfb, c); + for (yloop = yoff; yloop < height; yloop++) { + fntd = pixel + (yloop * (pitch>>3)) + (xoff>>3); + row = (*fntd++) << (xoff & 3); + for (xloop = xoff; xloop < width ; xloop++) { + if (((xloop % 8) == 0) && (xloop != 0)) { + row = *fntd++; } - } - pvideo += framebuffer->linelen; - } - - return true; -} -static bool fb_8bpp_text(int x, int y, const struct css_style *style, - const char *text, size_t length, colour bg, colour c) -{ - uint32_t ucs4; - size_t nxtchr = 0; - FT_Glyph glyph; - FT_BitmapGlyph bglyph; - - while (nxtchr < length) { - ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr); - nxtchr = utf8_next(text, length, nxtchr); - - glyph = fb_getglyph(style, ucs4); - if (glyph == NULL) - continue; - if (glyph->format == FT_GLYPH_FORMAT_BITMAP) { - bglyph = (FT_BitmapGlyph)glyph; - - /* now, draw to our target surface */ - if (bglyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) { - fb_8bpp_draw_ft_monobitmap(&bglyph->bitmap, - x + bglyph->left, - y - bglyph->top, - c); - } else { - fb_8bpp_draw_ft_bitmap(&bglyph->bitmap, - x + bglyph->left, - y - bglyph->top, - c); + if ((row & 0x80) != 0) { + *(pvideo + xloop) = fgcol; } + row = row << 1; + } - x += glyph->advance.x >> 16; + pvideo += nsfb->linelen; } - return true; + return true; } -#else -static bool fb_8bpp_text(int x, int y, const struct css_style *style, - const char *text, size_t length, colour bg, colour c) -{ - const struct fb_font_desc* fb_font = fb_get_font(style); - const uint32_t *font_data; - uint32_t row; - - int xloop, yloop; - size_t chr; +static bool +glyph8(nsfb_t *nsfb, + nsfb_bbox_t *loc, + const uint8_t *pixel, + int pitch, + nsfb_colour_t c) +{ uint8_t *pvideo; - uint8_t fgcol; - - unsigned char *buffer = NULL; - int x0,y0,x1,y1; + nsfb_colour_t abpixel; /* alphablended pixel */ + int xloop, yloop; int xoff, yoff; /* x and y offset into image */ - int height = fb_font->height; + int x = loc->x0; + int y = loc->y0; + int width = loc->x1 - loc->x0; + int height = loc->y1 - loc->y0; + uint8_t fgcol; - /* aquire thge text in local font encoding */ - utf8_to_font_encoding(fb_font, text, length, (char **)&buffer); - if (!buffer) + if (!nsfb_plot_clip_ctx(nsfb, loc)) return true; - length = strlen((char *)buffer); - - - /* y is given to the fonts baseline we need it to the fonts top */ - y-=((fb_font->height * 75)/100); - - y+=1; /* the coord is the bottom-left of the pixels offset by 1 to make - * it work since fb coords are the top-left of pixels - */ - - /* The part of the text displayed is cropped to the current context. */ - x0 = x; - y0 = y; - x1 = x + (fb_font->width * length); - y1 = y + fb_font->height; - - if (!fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1)) - return true; /* text lies outside current clipping region */ - - /* find width and height to plot */ - if (height > (y1 - y0)) - height = (y1 - y0); - - xoff = x0 - x; - yoff = y0 - y; - fgcol = find_closest_palette_entry(c); + if (height > (loc->y1 - loc->y0)) + height = (loc->y1 - loc->y0); - /*LOG(("x %d, y %d, style %p, txt %.*s , len %d, bg 0x%lx, fg 0x%lx", - x,y,style,length,text,length,bg,c));*/ + if (width > (loc->x1 - loc->x0)) + width = (loc->x1 - loc->x0); - for (chr = 0; chr < length; chr++, x += fb_font->width) { - if ((x + fb_font->width) > x1) - break; + xoff = loc->x0 - x; + yoff = loc->y0 - y; - if (x < x0) - continue; + pvideo = get_xy_loc(nsfb, loc->x0, loc->y0); - pvideo = fb_8bpp_get_xy_loc(x, y0); + fgcol = c & 0xFFFFFF; - /* move our font-data to the correct position */ - font_data = fb_font->data + (buffer[chr] * fb_font->height); + for (yloop = 0; yloop < height; yloop++) { + for (xloop = 0; xloop < width; xloop++) { + abpixel = (pixel[((yoff + yloop) * pitch) + xloop + xoff] << 24) | fgcol; + if ((abpixel & 0xFF000000) != 0) { + /* pixel is not transparent */ + if ((abpixel & 0xFF000000) != 0xFF000000) { + abpixel = nsfb_plot_ablend(abpixel, + pixel_to_colour(nsfb, *(pvideo + xloop))); + } - for (yloop = 0; yloop < height; yloop++) { - row = font_data[yoff + yloop]; - for (xloop = fb_font->width; xloop > 0 ; xloop--) { - if ((row & 1) != 0) - *(pvideo + xloop) = fgcol; - row = row >> 1; + *(pvideo + xloop) = colour_to_pixel(nsfb, abpixel); } - pvideo += framebuffer->linelen; } + pvideo += nsfb->linelen; } - free(buffer); - return true; -} -#endif - -static bool fb_8bpp_disc(int x, int y, int radius, colour c, bool filled) -{ - LOG(("x %d, y %d, rad %d, c 0x%lx, fill %d", x, y, radius, (unsigned long)c, filled)); - return true; -} - -static bool fb_8bpp_arc(int x, int y, int radius, int angle1, int angle2, - colour c) -{ - LOG(("x %d, y %d, radius %d, angle1 %d, angle2 %d, c 0x%lx", - x, y, radius, angle1, angle2, (unsigned long)c)); return true; } - - -static bool fb_8bpp_bitmap(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, - struct content *content) +static bool +bitmap(nsfb_t *nsfb, + nsfb_bbox_t *loc, + const nsfb_colour_t *pixel, + int bmp_width, + int bmp_height, + int bmp_stride, + bool alpha) { uint8_t *pvideo; - colour *pixel = (colour *)bitmap->pixdata; - colour abpixel; /* alphablended pixel */ + nsfb_colour_t abpixel = 0; /* alphablended pixel */ int xloop, yloop; - int x0,y0,x1,y1; int xoff, yoff; /* x and y offset into image */ - - /* LOG(("x %d, y %d, width %d, height %d, bitmap %p, content %p", - x,y,width,height,bitmap,content));*/ - - /* TODO here we should scale the image from bitmap->width to width, for - * now simply crop. + int x = loc->x0; + int y = loc->y0; + int width = loc->x1 - loc->x0; + int height = loc->y1 - loc->y0; + nsfb_bbox_t clipped; /* clipped display */ + + /* TODO here we should scale the image from bmp_width to width, for + * now simply crop. */ - if (width > bitmap->width) - width = bitmap->width; + if (width > bmp_width) + width = bmp_width; - if (height > bitmap->height) - height = bitmap->height; + if (height > bmp_height) + height = bmp_height; /* The part of the scaled image actually displayed is cropped to the - * current context. + * current context. */ - x0 = x; - y0 = y; - x1 = x + width; - y1 = y + height; + clipped.x0 = x; + clipped.y0 = y; + clipped.x1 = x + width; + clipped.y1 = y + height; - if (!fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1)) + if (!nsfb_plot_clip_ctx(nsfb, &clipped)) return true; - if (height > (y1 - y0)) - height = (y1 - y0); + if (height > (clipped.y1 - clipped.y0)) + height = (clipped.y1 - clipped.y0); - if (width > (x1 - x0)) - width = (x1 - x0); + if (width > (clipped.x1 - clipped.x0)) + width = (clipped.x1 - clipped.x0); - xoff = x0 - x; - yoff = (y0 - y) * bitmap->width; - height = height * bitmap->width + yoff; + xoff = clipped.x0 - x; + yoff = (clipped.y0 - y) * bmp_width; + height = height * bmp_stride + yoff; /* plot the image */ - pvideo = fb_8bpp_get_xy_loc(x0, y0); + pvideo = get_xy_loc(nsfb, clipped.x0, clipped.y0); - if (bitmap->opaque) { - for (yloop = yoff; yloop < height; yloop += bitmap->width) { - for (xloop = 0; xloop < width; xloop++) { - abpixel = pixel[yloop + xloop + xoff]; - *(pvideo + xloop) = fb_colour_to_pixel(abpixel); - } - pvideo += framebuffer->linelen; - } - } else { - for (yloop = yoff; yloop < height; yloop += bitmap->width) { + if (alpha) { + for (yloop = yoff; yloop < height; yloop += bmp_stride) { for (xloop = 0; xloop < width; xloop++) { abpixel = pixel[yloop + xloop + xoff]; if ((abpixel & 0xFF000000) != 0) { if ((abpixel & 0xFF000000) != 0xFF000000) { - abpixel = fb_plotters_ablend(abpixel, - fb_8bpp_to_colour(*(pvideo + xloop))); + abpixel = nsfb_plot_ablend(abpixel, + pixel_to_colour(nsfb, *(pvideo + xloop))); } - *(pvideo + xloop) = fb_colour_to_pixel(abpixel); + *(pvideo + xloop) = colour_to_pixel(nsfb, abpixel); } } - pvideo += framebuffer->linelen; + pvideo += nsfb->linelen; + } + } else { + for (yloop = yoff; yloop < height; yloop += bmp_stride) { + for (xloop = 0; xloop < width; xloop++) { + abpixel = pixel[yloop + xloop + xoff]; + *(pvideo + xloop) = colour_to_pixel(nsfb, abpixel); + } + pvideo += nsfb->linelen; } } - return true; } -static bool fb_8bpp_bitmap_tile(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, - bool repeat_x, bool repeat_y, - struct content *content) -{ - return fb_plotters_bitmap_tile(x, y, width, height, - bitmap, bg, repeat_x, repeat_y, - content, fb_8bpp_bitmap); -} -static bool fb_8bpp_flush(void) -{ - LOG(("%s()\n", __func__)); - return true; -} -static bool fb_8bpp_path(const float *p, - unsigned int n, - colour fill, - float width, - colour c, - const float transform[6]) -{ - LOG(("%f, %d, 0x%lx, %f, 0x%lx, %f", - *p, n, (unsigned long)fill, width, (unsigned long)c, *transform)); - return true; -} -const struct plotter_table framebuffer_8bpp_plot = { - .clg = fb_8bpp_clg, - .rectangle = fb_8bpp_rectangle, - .line = fb_8bpp_line, - .polygon = fb_8bpp_polygon, - .fill = fb_8bpp_fill, - .clip = fb_clip, - .text = fb_8bpp_text, - .disc = fb_8bpp_disc, - .arc = fb_8bpp_arc, - .bitmap = fb_8bpp_bitmap, - .bitmap_tile = fb_8bpp_bitmap_tile, - .flush = fb_8bpp_flush, - .path = fb_8bpp_path, - .option_knockout = true, + +const nsfb_plotter_fns_t _nsfb_8bpp_plotters = { + .line = line, + .fill = fill, + .point = point, + .bitmap = bitmap, + .glyph8 = glyph8, + .glyph1 = glyph1, }; diff --git a/src/Makefile b/src/Makefile index db58c58..ebf9996 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ # Sources -DIR_SOURCES := libnsfb.c frontend.c frontend_sdl.c plot.c plot_util.c plotters.c 32bpp_plotters.c 16bpp_plotters.c +DIR_SOURCES := libnsfb.c frontend.c frontend_sdl.c plot.c plot_util.c plotters.c 32bpp_plotters.c 16bpp_plotters.c 8bpp_plotters.c #frontend_linux.c diff --git a/src/frontend.c b/src/frontend.c index 4cf231f..c6f266e 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -37,7 +37,7 @@ static int frontend_defaults(nsfb_t *nsfb) { nsfb->width = 800; nsfb->height = 600; - nsfb->bpp = 16; + nsfb->bpp = 8; /* select plotters for bpp */ select_plotters(nsfb); diff --git a/src/frontend_sdl.c b/src/frontend_sdl.c index a9da09e..e082e56 100644 --- a/src/frontend_sdl.c +++ b/src/frontend_sdl.c @@ -9,17 +9,27 @@ static void set_palette(nsfb_t *nsfb) { SDL_Surface *sdl_screen = nsfb->frontend_priv; - SDL_Color colors[256]; - int loop; - for(loop=0; loop < 256; loop++){ - colors[loop].r = loop; - colors[loop].g = loop; - colors[loop].b = loop; - nsfb->palette[loop] = loop << 16 | loop << 8 | loop; + SDL_Color palette[256]; + int rloop, gloop, bloop; + int loop = 0; + + /* build a linear R:3 G:3 B:2 colour cube palette. */ + for (rloop = 0; rloop < 8; rloop++) { + for (gloop = 0; gloop < 8; gloop++) { + for (bloop = 0; bloop < 4; bloop++) { + palette[loop].r = (rloop << 5) | (rloop << 2) | (rloop >> 1); + palette[loop].g = (gloop << 5) | (gloop << 2) | (gloop >> 1); + palette[loop].b = (bloop << 6) | (bloop << 4) | (bloop << 2) | (bloop); + nsfb->palette[loop] = palette[loop].r | + palette[loop].g << 8 | + palette[loop].b << 16; + loop++; + } } + } - /* Set palette */ - SDL_SetColors(sdl_screen, colors, 0, 256); + /* Set palette */ + SDL_SetColors(sdl_screen, palette, 0, 256); } diff --git a/src/plotters.c b/src/plotters.c index 406d4d8..12a31d1 100644 --- a/src/plotters.c +++ b/src/plotters.c @@ -471,12 +471,9 @@ bool select_plotters(nsfb_t *nsfb) table = &_nsfb_1bpp_plotters; break; */ - /* - case 8: table = &_nsfb_8bpp_plotters; break; - */ case 16: table = &_nsfb_16bpp_plotters; -- cgit v1.2.3