summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2009-04-09 09:50:42 +0000
committerVincent Sanders <vince@netsurf-browser.org>2009-04-09 09:50:42 +0000
commitdbcc0a5dd35fc8f1f743bf51e929254a993549f9 (patch)
tree6e8dc67fa4907f04439af34fbea5bf44dcc97323
parent762784c01baec27dffcf1437b2427a45d82a59de (diff)
downloadlibnsfb-dbcc0a5dd35fc8f1f743bf51e929254a993549f9.tar.gz
libnsfb-dbcc0a5dd35fc8f1f743bf51e929254a993549f9.tar.bz2
fix 16bpp plotter
svn path=/trunk/libnsfb/; revision=7069
-rw-r--r--src/16bpp_plotters.c532
-rw-r--r--src/32bpp_plotters.c23
-rw-r--r--src/Makefile2
-rw-r--r--src/frontend.c2
-rw-r--r--src/plotters.c3
5 files changed, 200 insertions, 362 deletions
diff --git a/src/16bpp_plotters.c b/src/16bpp_plotters.c
index b97c42d..b2abff7 100644
--- a/src/16bpp_plotters.c
+++ b/src/16bpp_plotters.c
@@ -1,44 +1,27 @@
/*
- * Copyright 2008 Vincent Sanders <vince@simtec.co.uk>
+ * Copyright 2009 Vincent Sanders <vince@simtec.co.uk>
*
- * 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 <http://www.gnu.org/licenses/>.
+ * 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 <sys/types.h>
-#include <stdint.h>
-#include <string.h>
-#include <limits.h>
-
-#include "utils/log.h"
-#include "utils/utf8.h"
-#include "desktop/plotters.h"
+#include <stdbool.h>
+#include <endian.h>
+#include <stdlib.h>
-#include "framebuffer/fb_gui.h"
-#include "framebuffer/fb_plotters.h"
-#include "framebuffer/fb_bitmap.h"
-#include "framebuffer/fb_font.h"
+#include "libnsfb.h"
+#include "nsfb.h"
+#include "nsfb_plot.h"
+#include "plotters.h"
+#include "plot_util.h"
-static inline uint16_t *
-fb_16bpp_get_xy_loc(int x, int y)
+static inline uint16_t *get_xy_loc(nsfb_t *nsfb, int x, int y)
{
- return (void *)(framebuffer->ptr +
- (y * framebuffer->linelen) +
- (x << 1));
+ return (void *)(nsfb->ptr + (y * nsfb->linelen) + (x << 1));
}
-static inline colour fb_16bpp_to_colour(uint16_t pixel)
+static inline nsfb_colour_t pixel_to_colour(uint16_t pixel)
{
return ((pixel & 0x1F) << 19) |
((pixel & 0x7E0) << 5) |
@@ -46,94 +29,90 @@ static inline colour fb_16bpp_to_colour(uint16_t pixel)
}
/* convert a colour value to a 16bpp pixel value ready for screen output */
-static inline uint16_t fb_colour_to_pixel(colour c)
+static inline uint16_t colour_to_pixel(nsfb_colour_t c)
{
return ((c & 0xF8) << 8) | ((c & 0xFC00 ) >> 5) | ((c & 0xF80000) >> 19);
}
#define SIGN(x) ((x<0) ? -1 : ((x>0) ? 1 : 0))
-static bool fb_16bpp_line(int x0, int y0, int x1, int y1, int width,
- colour c, bool dotted, bool dashed)
+
+static bool
+line(nsfb_t *nsfb,
+ nsfb_bbox_t *line,
+ int line_width,
+ nsfb_colour_t c,
+ bool dotted,
+ bool dashed)
{
int w;
uint16_t ent;
uint16_t *pvideo;
-
int x, y, i;
int dx, dy, sdy;
int dxabs, dyabs;
- /*LOG(("%d, %d, %d, %d, %d, 0x%lx, %d, %d",
- x0,y0,x1,y1,width,c,dotted,dashed));*/
-
- if (y1 > fb_plot_ctx.y1)
- return true;
- if (y0 < fb_plot_ctx.y0)
- return true;
+ line_width = line_width;
+ dotted = dotted;
+ dashed = dashed;
- ent = fb_colour_to_pixel(c);
+ ent = colour_to_pixel(c);
- if (y0 == y1) {
+ if (line->y0 == line->y1) {
/* horizontal line special cased */
- if (!fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1))
- return true; /* line outside clipping */
-
- /*LOG(("horiz: %d, %d, %d, %d, %d, 0x%lx, %d, %d",
- x0,y0,x1,y1,width,c,dotted,dashed));*/
+ if (!nsfb_plot_clip_ctx(nsfb, line))
+ return true; /* line outside clipping */
- pvideo = fb_16bpp_get_xy_loc(x0, y0);
+ pvideo = get_xy_loc(nsfb, line->x0, line->y0);
- w = x1 - x0;
- while (w-- > 0) {
+ w = line->x1 - line->x0;
+ while (w-- > 0)
*(pvideo + w) = ent;
- }
+
return true;
} else {
/* standard bresenham line */
- if (!fb_plotters_clip_line_ctx(&x0, &y0, &x1, &y1))
+ if (!nsfb_plot_clip_line_ctx(nsfb, line))
return true; /* line outside clipping */
- //LOG(("%d, %d, %d, %d", x0,y0,x1,y1));
-
/* the horizontal distance of the line */
- dx = x1 - x0;
+ dx = line->x1 - line->x0;
dxabs = abs (dx);
/* the vertical distance of the line */
- dy = y1 - y0;
+ dy = line->y1 - line->y0;
dyabs = abs (dy);
sdy = dx ? SIGN(dy) * SIGN(dx) : SIGN(dy);
if (dx >= 0)
- pvideo = fb_16bpp_get_xy_loc(x0, y0);
+ pvideo = get_xy_loc(nsfb, line->x0, line->y0);
else
- pvideo = fb_16bpp_get_xy_loc(x1, y1);
+ 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++) {
+ for (i = 0; i < dxabs; i++) {
*pvideo = ent;
pvideo++;
y += dyabs;
- if (y > dxabs) {
+ if (y >= dxabs) {
y -= dxabs;
- pvideo += sdy * (framebuffer->linelen>>1);
+ pvideo += sdy * (nsfb->linelen>>1);
}
}
} else {
/* the line is more vertical than horizontal */
- for (i = 0; i <= dyabs; i++) {
+ for (i = 0; i < dyabs; i++) {
*pvideo = ent;
- pvideo += sdy * (framebuffer->linelen >> 1);
+ pvideo += sdy * (nsfb->linelen >> 1);
x += dxabs;
- if (x > dyabs) {
+ if (x >= dyabs) {
x -= dyabs;
pvideo++;
}
@@ -142,28 +121,12 @@ static bool fb_16bpp_line(int x0, int y0, int x1, int y1, int width,
}
-
-
return true;
}
-static bool fb_16bpp_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
-{
- fb_16bpp_line(x0, y0, x0 + width, y0, line_width, c, dotted, dashed);
- fb_16bpp_line(x0, y0 + height, x0 + width, y0 + height, line_width, c, dotted, dashed);
- fb_16bpp_line(x0, y0, x0, y0 + height, line_width, c, dotted, dashed);
- fb_16bpp_line(x0 + width, y0, x0 + width, y0 + height, line_width, c, dotted, dashed);
- return true;
-}
-
-static bool fb_16bpp_polygon(const int *p, unsigned int n, colour fill)
-{
- return fb_plotters_polygon(p, n, fill, fb_16bpp_line);
-}
-static bool fb_16bpp_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 w;
uint16_t *pvid16;
@@ -174,19 +137,19 @@ static bool fb_16bpp_fill(int x0, int y0, int x1, int y1, colour c)
uint32_t width;
uint32_t height;
- 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 */
- ent16 = fb_colour_to_pixel(c);
- width = x1 - x0;
- height = y1 - y0;
+ ent16 = colour_to_pixel(c);
+ width = rect->x1 - rect->x0;
+ height = rect->y1 - rect->y0;
- pvid16 = fb_16bpp_get_xy_loc(x0, y0);
+ pvid16 = get_xy_loc(nsfb, rect->x0, rect->y0);
- if (((x0 & 1) == 0) && ((width & 1) == 0)) {
+ if (((rect->x0 & 1) == 0) && ((width & 1) == 0)) {
/* aligned to 32bit value and width is even */
width = width >> 1;
- llen = (framebuffer->linelen >> 2) - width;
+ llen = (nsfb->linelen >> 2) - width;
ent32 = ent16 | (ent16 << 16);
pvid32 = (uint32_t *)pvid16;
@@ -217,7 +180,7 @@ static bool fb_16bpp_fill(int x0, int y0, int x1, int y1, colour c)
}
} else {
- llen = (framebuffer->linelen >> 1) - width;
+ llen = (nsfb->linelen >> 1) - width;
while (height-- > 0) {
@@ -228,338 +191,229 @@ static bool fb_16bpp_fill(int x0, int y0, int x1, int y1, colour c)
return true;
}
-static bool fb_16bpp_clg(colour c)
+
+static bool point(nsfb_t *nsfb, int x, int y, nsfb_colour_t c)
{
- /* LOG(("c %lx", c)); */
- fb_16bpp_fill(fb_plot_ctx.x0,
- fb_plot_ctx.y0,
- fb_plot_ctx.x1,
- fb_plot_ctx.y1,
- c);
- return true;
-}
+ uint16_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_16bpp_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(*pvideo));
+ }
+
+ *pvideo = colour_to_pixel(c);
+ }
+ return true;
}
static bool
-fb_16bpp_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)
{
uint16_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;
+ uint16_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;
+ xoff = loc->x0 - x;
+ yoff = loc->y0 - y;
- /* plot the image */
- pvideo = fb_16bpp_get_xy_loc(x0, y0);
+ pvideo = get_xy_loc(nsfb, loc->x0, loc->y0);
- 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_16bpp_to_colour(*(pvideo + xloop)));
- }
-
- *(pvideo + xloop) = fb_colour_to_pixel(abpixel);
+ fgcol = colour_to_pixel(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 >> 1);
- }
- return true;
-}
-
-static bool fb_16bpp_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_16bpp_draw_ft_monobitmap(&bglyph->bitmap,
- x + bglyph->left,
- y - bglyph->top,
- c);
- } else {
- fb_16bpp_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 >> 1);
}
- return true;
+
+ return true;
}
-#else
-static bool fb_16bpp_text(int x, int y, const struct css_style *style,
- const char *text, size_t length, colour bg, colour c)
+static bool
+glyph8(nsfb_t *nsfb,
+ nsfb_bbox_t *loc,
+ const uint8_t *pixel,
+ int pitch,
+ nsfb_colour_t c)
{
- const struct fb_font_desc* fb_font = fb_get_font(style);
- const uint32_t *font_data;
- int xloop, yloop;
- uint32_t row;
- size_t chr;
-
uint16_t *pvideo;
- uint16_t fgcol;
- uint16_t bgcol;
-
- 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;
+ uint16_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;
+ if (height > (loc->y1 - loc->y0))
+ height = (loc->y1 - loc->y0);
- fgcol = fb_colour_to_pixel(c);
+ if (width > (loc->x1 - loc->x0))
+ width = (loc->x1 - loc->x0);
- bgcol = fb_colour_to_pixel(bg);
+ xoff = loc->x0 - x;
+ yoff = loc->y0 - y;
- /*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));*/
+ pvideo = get_xy_loc(nsfb, loc->x0, loc->y0);
- for (chr = 0; chr < length; chr++, x += fb_font->width) {
- if ((x + fb_font->width) > x1)
- break;
-
- if (x < x0)
- continue;
-
- pvideo = fb_16bpp_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(*(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(abpixel);
}
- pvideo += (framebuffer->linelen >> 1);
}
+ pvideo += (nsfb->linelen >> 1);
}
- free(buffer);
- return true;
-}
-#endif
-
-static bool fb_16bpp_disc(int x, int y, int radius, colour c, bool filled)
-{
- LOG(("x %d, y %d, r %d, c 0x%lx, fill %d",
- x, y, radius, (unsigned long)c, filled));
-
return true;
}
-static bool fb_16bpp_arc(int x, int y, int radius, int angle1, int angle2,
- colour c)
-{
- LOG(("x %d, y %d, r %d, a1 %d, a2 %d, c 0x%lx",
- x, y, radius, angle1, angle2, (unsigned long)c));
- return true;
-}
-
-
-static bool fb_16bpp_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)
{
uint16_t *pvideo;
- colour *pixel = (colour *)bitmap->pixdata;
- colour abpixel; /* alphablended pixel */
+ nsfb_colour_t abpixel; /* alphablended pixel */
int xloop, yloop;
- int x0,y0,x1,y1;
int xoff, yoff; /* x and y offset into image */
+ 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 bitmap->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.
*/
- 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 > (clipped.y1 - clipped.y0))
+ height = (clipped.y1 - clipped.y0);
- LOG(("%d, %d %d, %d bitmap %p, content %p",
- x0,y0,x1,y1,bitmap,content));
-
- if (height > (y1 - y0))
- height = (y1 - 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_width + yoff;
/* plot the image */
- pvideo = fb_16bpp_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 >> 1);
- }
- } 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_16bpp_to_colour(*(pvideo + xloop)));
+ abpixel = nsfb_plot_ablend(abpixel,
+ pixel_to_colour(*(pvideo + xloop)));
}
- *(pvideo + xloop) = fb_colour_to_pixel(abpixel);
+ *(pvideo + xloop) = colour_to_pixel(abpixel);
}
}
- pvideo += (framebuffer->linelen >> 1);
+ pvideo += (nsfb->linelen >> 1);
+ }
+ } 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(abpixel);
+ }
+ pvideo += (nsfb->linelen >> 1);
}
}
return true;
}
-static bool fb_16bpp_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_16bpp_bitmap);
-}
-static bool fb_16bpp_flush(void)
-{
- LOG(("optional"));
- return true;
-}
-
-static bool fb_16bpp_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_16bpp_plot = {
- .clg = fb_16bpp_clg,
- .rectangle = fb_16bpp_rectangle,
- .line = fb_16bpp_line,
- .polygon = fb_16bpp_polygon,
- .fill = fb_16bpp_fill,
- .clip = fb_clip,
- .text = fb_16bpp_text,
- .disc = fb_16bpp_disc,
- .arc = fb_16bpp_arc,
- .bitmap = fb_16bpp_bitmap,
- .bitmap_tile = fb_16bpp_bitmap_tile,
- .flush = fb_16bpp_flush,
- .path = fb_16bpp_path,
- .option_knockout = true,
+const nsfb_plotter_fns_t _nsfb_16bpp_plotters = {
+ .line = line,
+ .fill = fill,
+ .point = point,
+ .bitmap = bitmap,
+ .glyph8 = glyph8,
+ .glyph1 = glyph1,
};
/*
diff --git a/src/32bpp_plotters.c b/src/32bpp_plotters.c
index c52faad..5848405 100644
--- a/src/32bpp_plotters.c
+++ b/src/32bpp_plotters.c
@@ -1,19 +1,9 @@
/*
- * Copyright 2008 Vincent Sanders <vince@simtec.co.uk>
+ * Copyright 2009 Vincent Sanders <vince@simtec.co.uk>
*
- * 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 <http://www.gnu.org/licenses/>.
+ * 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 <stdbool.h>
@@ -26,9 +16,6 @@
#include "plotters.h"
#include "plot_util.h"
-/* global plot context */
-extern nsfb_t *_plot_nsfb;
-
static inline uint32_t *
get_xy_loc(nsfb_t *nsfb, int x, int y)
{
@@ -255,7 +242,6 @@ glyph1(nsfb_t *nsfb,
xoff = loc->x0 - x;
yoff = loc->y0 - y;
- /* plot the image */
pvideo = get_xy_loc(nsfb, loc->x0, loc->y0);
fgcol = colour_to_pixel(c);
@@ -310,7 +296,6 @@ glyph8(nsfb_t *nsfb,
xoff = loc->x0 - x;
yoff = loc->y0 - y;
- /* plot the image */
pvideo = get_xy_loc(nsfb, loc->x0, loc->y0);
fgcol = c & 0xFFFFFF;
diff --git a/src/Makefile b/src/Makefile
index 5220060..db58c58 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
+DIR_SOURCES := libnsfb.c frontend.c frontend_sdl.c plot.c plot_util.c plotters.c 32bpp_plotters.c 16bpp_plotters.c
#frontend_linux.c
diff --git a/src/frontend.c b/src/frontend.c
index 171a7f3..4cf231f 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 = 32;
+ nsfb->bpp = 16;
/* select plotters for bpp */
select_plotters(nsfb);
diff --git a/src/plotters.c b/src/plotters.c
index b439d55..406d4d8 100644
--- a/src/plotters.c
+++ b/src/plotters.c
@@ -477,12 +477,11 @@ bool select_plotters(nsfb_t *nsfb)
table = &_nsfb_8bpp_plotters;
break;
*/
- /*
case 16:
table = &_nsfb_16bpp_plotters;
break;
- */
+
/*
case 24:
table = &_nsfb_24bpp_plotters;