summaryrefslogtreecommitdiff
path: root/frontends/framebuffer
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/framebuffer')
-rw-r--r--frontends/framebuffer/bitmap.c69
-rw-r--r--frontends/framebuffer/corewindow.c9
-rw-r--r--frontends/framebuffer/corewindow.h5
-rw-r--r--frontends/framebuffer/font_internal.c13
-rw-r--r--frontends/framebuffer/gui.c4
-rw-r--r--frontends/framebuffer/local_history.c3
6 files changed, 24 insertions, 79 deletions
diff --git a/frontends/framebuffer/bitmap.c b/frontends/framebuffer/bitmap.c
index 1fc9f46a2..c9b58541e 100644
--- a/frontends/framebuffer/bitmap.c
+++ b/frontends/framebuffer/bitmap.c
@@ -47,19 +47,16 @@
* \param state a flag word indicating the initial state
* \return an opaque struct bitmap, or NULL on memory exhaustion
*/
-static void *bitmap_create(int width, int height, unsigned int state)
+static void *bitmap_create(int width, int height, enum gui_bitmap_flags flags)
{
- nsfb_t *bm;
-
- NSLOG(netsurf, INFO, "width %d, height %d, state %u", width, height,
- state);
+ nsfb_t *bm;
bm = nsfb_new(NSFB_SURFACE_RAM);
if (bm == NULL) {
return NULL;
}
- if ((state & BITMAP_OPAQUE) == 0) {
+ if ((flags & BITMAP_OPAQUE) == 0) {
nsfb_set_geometry(bm, width, height, NSFB_FMT_ABGR8888);
} else {
nsfb_set_geometry(bm, width, height, NSFB_FMT_XBGR8888);
@@ -70,9 +67,7 @@ static void *bitmap_create(int width, int height, unsigned int state)
return NULL;
}
- NSLOG(netsurf, INFO, "bitmap %p", bm);
-
- return bm;
+ return bm;
}
@@ -133,20 +128,6 @@ static void bitmap_destroy(void *bitmap)
/**
- * Save a bitmap in the platform's native format.
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \param path pathname for file
- * \param flags flags controlling how the bitmap is saved.
- * \return true on success, false on error and error reported
- */
-static bool bitmap_save(void *bitmap, const char *path, unsigned flags)
-{
- return true;
-}
-
-
-/**
* The bitmap image has changed, so flush any persistant cache.
*
* \param bitmap a bitmap, as returned by bitmap_create()
@@ -175,39 +156,6 @@ static void bitmap_set_opaque(void *bitmap, bool opaque)
/**
- * Tests whether a bitmap has an opaque alpha channel
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \return whether the bitmap is opaque
- */
-static bool bitmap_test_opaque(void *bitmap)
-{
- int tst;
- nsfb_t *bm = bitmap;
- unsigned char *bmpptr;
- int width;
- int height;
-
- assert(bm != NULL);
-
- nsfb_get_buffer(bm, &bmpptr, NULL);
-
- nsfb_get_geometry(bm, &width, &height, NULL);
-
- tst = width * height;
-
- while (tst-- > 0) {
- if (bmpptr[(tst << 2) + 3] != 0xff) {
- NSLOG(netsurf, INFO, "bitmap %p has transparency", bm);
- return false;
- }
- }
- NSLOG(netsurf, INFO, "bitmap %p is opaque", bm);
- return true;
-}
-
-
-/**
* Gets weather a bitmap should be plotted opaque
*
* \param bitmap a bitmap, as returned by bitmap_create()
@@ -251,12 +199,6 @@ static int bitmap_get_height(void *bitmap)
return(height);
}
-/* get bytes per pixel */
-static size_t bitmap_get_bpp(void *bitmap)
-{
- return 4;
-}
-
/**
* Render content into a bitmap.
*
@@ -332,13 +274,10 @@ static struct gui_bitmap_table bitmap_table = {
.destroy = bitmap_destroy,
.set_opaque = bitmap_set_opaque,
.get_opaque = framebuffer_bitmap_get_opaque,
- .test_opaque = bitmap_test_opaque,
.get_buffer = bitmap_get_buffer,
.get_rowstride = bitmap_get_rowstride,
.get_width = bitmap_get_width,
.get_height = bitmap_get_height,
- .get_bpp = bitmap_get_bpp,
- .save = bitmap_save,
.modified = bitmap_modified,
.render = bitmap_render,
};
diff --git a/frontends/framebuffer/corewindow.c b/frontends/framebuffer/corewindow.c
index dbd8d013b..b1cb1626f 100644
--- a/frontends/framebuffer/corewindow.c
+++ b/frontends/framebuffer/corewindow.c
@@ -192,15 +192,17 @@ fb_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
}
-struct core_window_callback_table fb_cw_cb_table = {
+struct core_window_table fb_cw_cb_table = {
.invalidate = fb_cw_invalidate,
- .update_size = fb_cw_update_size,
+ .set_extent = fb_cw_update_size,
.set_scroll = fb_cw_set_scroll,
.get_scroll = fb_cw_get_scroll,
- .get_window_dimensions = fb_cw_get_window_dimensions,
+ .get_dimensions = fb_cw_get_window_dimensions,
.drag_status = fb_cw_drag_status
};
+struct core_window_table *framebuffer_core_window_table = &fb_cw_cb_table;
+
/* exported function documented fb/corewindow.h */
nserror fb_corewindow_init(fbtk_widget_t *parent, struct fb_corewindow *fb_cw)
{
@@ -209,7 +211,6 @@ nserror fb_corewindow_init(fbtk_widget_t *parent, struct fb_corewindow *fb_cw)
furniture_width = nsoption_int(fb_furniture_size);
/* setup the core window callback table */
- fb_cw->cb_table = &fb_cw_cb_table;
fb_cw->drag_status = CORE_WINDOW_DRAG_NONE;
/* container window */
diff --git a/frontends/framebuffer/corewindow.h b/frontends/framebuffer/corewindow.h
index 5546c09b6..4b8f1a822 100644
--- a/frontends/framebuffer/corewindow.h
+++ b/frontends/framebuffer/corewindow.h
@@ -21,6 +21,8 @@
#include "netsurf/core_window.h"
+extern struct core_window_table *framebuffer_core_window_table;
+
/**
* fb core window state
*/
@@ -49,9 +51,6 @@ struct fb_corewindow {
/** drag status set by core */
core_window_drag_status drag_status;
- /** table of callbacks for core window operations */
- struct core_window_callback_table *cb_table;
-
/**
* callback to draw on drawable area of fb core window
*
diff --git a/frontends/framebuffer/font_internal.c b/frontends/framebuffer/font_internal.c
index d755681c6..4d28c61ad 100644
--- a/frontends/framebuffer/font_internal.c
+++ b/frontends/framebuffer/font_internal.c
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include "utils/nsoption.h"
+#include "utils/utils.h"
#include "utils/utf8.h"
#include "netsurf/utf8.h"
#include "netsurf/layout.h"
@@ -270,7 +271,8 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale)
break;
}
}
- /* Fall through. */
+ fallthrough;
+
case FB_BOLD:
section = fb_bold_section_table[ucs4 / 256];
if (section != 0 || ucs4 / 256 == 0) {
@@ -281,7 +283,8 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale)
break;
}
}
- /* Fall through. */
+ fallthrough;
+
case FB_ITALIC:
section = fb_italic_section_table[ucs4 / 256];
if (section != 0 || ucs4 / 256 == 0) {
@@ -292,7 +295,8 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale)
break;
}
}
- /* Fall through. */
+ fallthrough;
+
case FB_REGULAR:
section = fb_regular_section_table[ucs4 / 256];
if (section != 0 || ucs4 / 256 == 0) {
@@ -303,7 +307,8 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale)
break;
}
}
- /* Fall through. */
+ fallthrough;
+
default:
glyph_data = get_codepoint(ucs4, style & FB_ITALIC);
break;
diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c
index 934ba05c8..f0a8f5e58 100644
--- a/frontends/framebuffer/gui.c
+++ b/frontends/framebuffer/gui.c
@@ -55,6 +55,7 @@
#include "framebuffer/fetch.h"
#include "framebuffer/bitmap.h"
#include "framebuffer/local_history.h"
+#include "framebuffer/corewindow.h"
#define NSFB_TOOLBAR_DEFAULT_LAYOUT "blfsrutc"
@@ -1000,7 +1001,7 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
break;
}
/* Z or Y pressed but not undo or redo; */
- /* Fall through */
+ fallthrough;
default:
ucs4 = fbtk_keycode_to_ucs4(cbi->event->value.keycode,
@@ -2188,6 +2189,7 @@ main(int argc, char** argv)
struct netsurf_table framebuffer_table = {
.misc = &framebuffer_misc_table,
.window = &framebuffer_window_table,
+ .corewindow = framebuffer_core_window_table,
.clipboard = framebuffer_clipboard_table,
.fetch = framebuffer_fetch_table,
.utf8 = framebuffer_utf8_table,
diff --git a/frontends/framebuffer/local_history.c b/frontends/framebuffer/local_history.c
index c1963e2b1..0c9c195e3 100644
--- a/frontends/framebuffer/local_history.c
+++ b/frontends/framebuffer/local_history.c
@@ -160,8 +160,7 @@ fb_local_history_init(fbtk_widget_t *parent,
return res;
}
- res = local_history_init(ncwin->core.cb_table,
- (struct core_window *)ncwin,
+ res = local_history_init((struct core_window *)ncwin,
bw,
&ncwin->session);
if (res != NSERROR_OK) {