diff options
-rw-r--r-- | gtk/bitmap.c | 7 | ||||
-rw-r--r-- | monkey/bitmap.c | 44 | ||||
-rw-r--r-- | monkey/bitmap.h | 24 | ||||
-rw-r--r-- | monkey/fetch.h | 5 | ||||
-rw-r--r-- | monkey/main.c | 2 |
5 files changed, 66 insertions, 16 deletions
diff --git a/gtk/bitmap.c b/gtk/bitmap.c index 03b5d9857..978838d2e 100644 --- a/gtk/bitmap.c +++ b/gtk/bitmap.c @@ -26,16 +26,15 @@ #include <assert.h> #include <stdbool.h> #include <string.h> - #include <cairo.h> #include <gtk/gtk.h> +#include "utils/log.h" #include "content/content.h" -#include "gtk/scaffolding.h" -#include "gtk/bitmap.h" #include "image/bitmap.h" -#include "utils/log.h" +#include "gtk/scaffolding.h" +#include "gtk/bitmap.h" /** diff --git a/monkey/bitmap.c b/monkey/bitmap.c index 79bab8cd5..16c98b594 100644 --- a/monkey/bitmap.c +++ b/monkey/bitmap.c @@ -18,9 +18,12 @@ #include <stdbool.h> #include <stdio.h> +#include <stdlib.h> #include "image/bitmap.h" +#include "monkey/bitmap.h" + struct bitmap { void *ptr; size_t rowstride; @@ -29,7 +32,7 @@ struct bitmap { unsigned int state; }; -void *bitmap_create(int width, int height, unsigned int state) +static void *bitmap_create(int width, int height, unsigned int state) { struct bitmap *ret = calloc(sizeof(*ret), 1); if (ret == NULL) @@ -49,14 +52,14 @@ void *bitmap_create(int width, int height, unsigned int state) return ret; } -void bitmap_destroy(void *bitmap) +static void bitmap_destroy(void *bitmap) { struct bitmap *bmap = bitmap; free(bmap->ptr); free(bmap); } -void bitmap_set_opaque(void *bitmap, bool opaque) +static void bitmap_set_opaque(void *bitmap, bool opaque) { struct bitmap *bmap = bitmap; @@ -66,56 +69,73 @@ void bitmap_set_opaque(void *bitmap, bool opaque) bmap->state &= ~(BITMAP_OPAQUE); } -bool bitmap_test_opaque(void *bitmap) +static bool bitmap_test_opaque(void *bitmap) { return false; } -bool bitmap_get_opaque(void *bitmap) +static bool bitmap_get_opaque(void *bitmap) { struct bitmap *bmap = bitmap; return (bmap->state & BITMAP_OPAQUE) == BITMAP_OPAQUE; } -unsigned char *bitmap_get_buffer(void *bitmap) +static unsigned char *bitmap_get_buffer(void *bitmap) { struct bitmap *bmap = bitmap; return (unsigned char *)(bmap->ptr); } -size_t bitmap_get_rowstride(void *bitmap) +static size_t bitmap_get_rowstride(void *bitmap) { struct bitmap *bmap = bitmap; return bmap->width * 4; } -size_t bitmap_get_bpp(void *bitmap) +static size_t bitmap_get_bpp(void *bitmap) { /* OMG?! */ return 4; } -bool bitmap_save(void *bitmap, const char *path, unsigned flags) +static bool bitmap_save(void *bitmap, const char *path, unsigned flags) { return true; } -void bitmap_modified(void *bitmap) +static void bitmap_modified(void *bitmap) { struct bitmap *bmap = bitmap; bmap->state |= BITMAP_MODIFIED; } -int bitmap_get_width(void *bitmap) +static int bitmap_get_width(void *bitmap) { struct bitmap *bmap = bitmap; return bmap->width; } -int bitmap_get_height(void *bitmap) +static int bitmap_get_height(void *bitmap) { struct bitmap *bmap = bitmap; return bmap->height; } + +static struct gui_bitmap_table bitmap_table = { + .create = bitmap_create, + .destroy = bitmap_destroy, + .set_opaque = bitmap_set_opaque, + .get_opaque = 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, +}; + +struct gui_bitmap_table *monkey_bitmap_table = &bitmap_table; diff --git a/monkey/bitmap.h b/monkey/bitmap.h new file mode 100644 index 000000000..e293ce93f --- /dev/null +++ b/monkey/bitmap.h @@ -0,0 +1,24 @@ +/* + * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org> + * + * 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/>. + */ + +#ifndef NS_MONKEY_BITMAP_H +#define NS_MONKEY_BITMAP_H + +extern struct gui_bitmap_table *monkey_bitmap_table; + +#endif /* NS_MONKEY_BITMAP_H */ diff --git a/monkey/fetch.h b/monkey/fetch.h index 59e8696d1..f146e2ef8 100644 --- a/monkey/fetch.h +++ b/monkey/fetch.h @@ -16,4 +16,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef NS_MONKEY_FETCH_H +#define NS_MONKEY_FETCH_H + struct gui_fetch_table *monkey_fetch_table; + +#endif /* NS_MONKEY_FETCH_H */ diff --git a/monkey/main.c b/monkey/main.c index a58bec50d..81406bc27 100644 --- a/monkey/main.c +++ b/monkey/main.c @@ -37,6 +37,7 @@ #include "monkey/filetype.h" #include "monkey/fetch.h" #include "monkey/schedule.h" +#include "monkey/bitmap.h" char **respaths; /** resource search path vector */ @@ -140,6 +141,7 @@ main(int argc, char **argv) .window = monkey_window_table, .download = monkey_download_table, .fetch = monkey_fetch_table, + .bitmap = monkey_bitmap_table, }; ret = netsurf_register(&monkey_table); |