summaryrefslogtreecommitdiff
path: root/desktop/gui_factory.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-04-13 23:19:04 +0100
committerVincent Sanders <vince@kyllikki.org>2015-04-13 23:19:04 +0100
commitf37e52c39475e6efd3740c5ae1ec4f290662928f (patch)
tree88d01618e903975743a3cb74bff9bf8df54c2a45 /desktop/gui_factory.c
parent7a28131e4953934150967eb7886bc06678e249e8 (diff)
downloadnetsurf-f37e52c39475e6efd3740c5ae1ec4f290662928f.tar.gz
netsurf-f37e52c39475e6efd3740c5ae1ec4f290662928f.tar.bz2
Move bitmap operations into an operation table.
The generic bitmap handlers provided by each frontend are called back from the core and therefore should be in an operation table. This was one of the very few remaining interfaces stopping the core code from being split into a library.
Diffstat (limited to 'desktop/gui_factory.c')
-rw-r--r--desktop/gui_factory.c79
1 files changed, 78 insertions, 1 deletions
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index df88b8c34..cab11eb0a 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -16,10 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "utils/errors.h"
+#include "utils/file.h"
+#include "image/bitmap.h"
#include "content/hlcache.h"
#include "content/backing_store.h"
-#include "utils/file.h"
#include "desktop/save_pdf.h"
#include "desktop/download.h"
#include "desktop/searchweb.h"
@@ -552,6 +558,71 @@ static nserror verify_file_register(struct gui_file_table *gft)
return NSERROR_OK;
}
+/**
+ * verify bitmap table is valid
+ *
+ * \param gbt The bitmap table to verify.
+ * \return NSERROR_OK if teh table is valid else NSERROR_BAD_PARAMETER.
+ */
+static nserror verify_bitmap_register(struct gui_bitmap_table *gbt)
+{
+ /* check table is present */
+ if (gbt == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ /* check the mandantory fields are set */
+ if (gbt->create == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->destroy == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->set_opaque == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->get_opaque == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->test_opaque == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->get_buffer == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->get_rowstride == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->get_width == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->get_height == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->get_bpp == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->save == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (gbt->modified == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ return NSERROR_OK;
+}
+
static void gui_default_quit(void)
{
}
@@ -651,6 +722,12 @@ nserror netsurf_register(struct netsurf_table *gt)
return err;
}
+ /* bitmap table */
+ err = verify_bitmap_register(gt->bitmap);
+ if (err != NSERROR_OK) {
+ return err;
+ }
+
/* file table */
if (gt->file == NULL) {
gt->file = default_file_table;