summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-02-25 21:00:27 +0000
committerJames Bursa <james@netsurf-browser.org>2003-02-25 21:00:27 +0000
commit8edb43af7dbf0b28892f9d8a8d8ddae523e41b73 (patch)
treef83c7ed22bfac320b468979e181630e7ebc6dfe4 /riscos
parent9209f8e6cbd2423a243dcab05bbff2e41d193d3f (diff)
downloadnetsurf-8edb43af7dbf0b28892f9d8a8d8ddae523e41b73.tar.gz
netsurf-8edb43af7dbf0b28892f9d8a8d8ddae523e41b73.tar.bz2
[project @ 2003-02-25 21:00:27 by bursa]
Bug fixes, experimental JPEG support. svn path=/import/netsurf/; revision=100
Diffstat (limited to 'riscos')
-rw-r--r--riscos/gui.c53
-rw-r--r--riscos/jpeg.c59
-rw-r--r--riscos/jpeg.h17
3 files changed, 108 insertions, 21 deletions
diff --git a/riscos/gui.c b/riscos/gui.c
index 6ebcf5197..5881243c1 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -1,5 +1,5 @@
/**
- * $Id: gui.c,v 1.17 2003/02/09 12:58:15 bursa Exp $
+ * $Id: gui.c,v 1.18 2003/02/25 21:00:27 bursa Exp $
*/
#include "netsurf/riscos/font.h"
@@ -10,8 +10,10 @@
#include "oslib/os.h"
#include "oslib/wimp.h"
#include "oslib/colourtrans.h"
+#include "oslib/jpeg.h"
#include "netsurf/riscos/theme.h"
#include "netsurf/utils/log.h"
+#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
@@ -772,36 +774,45 @@ void ro_gui_toolbar_redraw(gui_window* g, wimp_draw* redraw)
void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw)
{
osbool more;
+ struct content *c = g->data.browser.bw->current_content;
- if (g->redraw_safety == SAFE && g->type == GUI_BROWSER_WINDOW)
+ if (g->redraw_safety == SAFE && g->type == GUI_BROWSER_WINDOW && c != NULL)
{
- if (g->data.browser.bw->current_content != NULL)
- {
- if (g->data.browser.bw->current_content->data.html.layout != NULL)
- {
- more = wimp_redraw_window(redraw);
- wimp_set_font_colours(wimp_COLOUR_WHITE, wimp_COLOUR_BLACK);
+ more = wimp_redraw_window(redraw);
+ wimp_set_font_colours(wimp_COLOUR_WHITE, wimp_COLOUR_BLACK);
- select_on = 0;
+ select_on = 0;
- while (more)
- {
- gadget_subtract_x = redraw->box.x0 - redraw->xscroll;
- gadget_subtract_y = redraw->box.y1 - redraw->yscroll;
+ while (more)
+ {
+ switch (c->type)
+ {
+ case CONTENT_HTML:
+ gadget_subtract_x = redraw->box.x0 - redraw->xscroll;
+ gadget_subtract_y = redraw->box.y1 - redraw->yscroll;
+ assert(c->data.html.layout != NULL);
ro_gui_window_redraw_box(g,
- g->data.browser.bw->current_content->data.html.layout->children,
+ c->data.html.layout->children,
redraw->box.x0 - redraw->xscroll, redraw->box.y1 - redraw->yscroll,
&redraw->clip, 0xffffff);
- more = wimp_get_rectangle(redraw);
- }
- return;
+ break;
+
+ case CONTENT_JPEG:
+ xjpeg_plot_scaled(c->data.jpeg.data,
+ redraw->box.x0 - redraw->xscroll,
+ redraw->box.y1 - redraw->yscroll - c->height * 2,
+ 0, c->data.jpeg.length, 0);
+ break;
}
+ more = wimp_get_rectangle(redraw);
}
}
-
- more = wimp_redraw_window(redraw);
- while (more)
- more = wimp_get_rectangle(redraw);
+ else
+ {
+ more = wimp_redraw_window(redraw);
+ while (more)
+ more = wimp_get_rectangle(redraw);
+ }
}
void gui_window_set_scroll(gui_window* g, int sx, int sy)
diff --git a/riscos/jpeg.c b/riscos/jpeg.c
new file mode 100644
index 000000000..48f43ca8e
--- /dev/null
+++ b/riscos/jpeg.c
@@ -0,0 +1,59 @@
+/**
+ * $Id: jpeg.c,v 1.1 2003/02/25 21:00:27 bursa Exp $
+ *
+ * This is just a temporary implementation using the JPEG renderer
+ * available in some versions of RISC OS.
+ */
+
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include "netsurf/content/content.h"
+#include "netsurf/riscos/jpeg.h"
+#include "netsurf/utils/utils.h"
+#include "oslib/jpeg.h"
+
+
+void jpeg_create(struct content *c)
+{
+ c->data.jpeg.data = xcalloc(0, 1);
+ c->data.jpeg.length = 0;
+}
+
+
+void jpeg_process_data(struct content *c, char *data, unsigned long size)
+{
+ c->data.jpeg.data = xrealloc(c->data.jpeg.data, c->data.jpeg.length + size);
+ memcpy(c->data.jpeg.data + c->data.jpeg.length, data, size);
+ c->data.jpeg.length += size;
+}
+
+
+int jpeg_convert(struct content *c, unsigned int width, unsigned int height)
+{
+ os_error *error;
+ int w, h;
+ error = xjpeginfo_dimensions(c->data.jpeg.data, (int) c->data.jpeg.length,
+ 0, &w, &h, 0, 0, 0);
+ if (error != 0)
+ return 1;
+ c->width = w;
+ c->height = h;
+ return 0;
+}
+
+
+void jpeg_revive(struct content *c, unsigned int width, unsigned int height)
+{
+}
+
+
+void jpeg_reformat(struct content *c, unsigned int width, unsigned int height)
+{
+}
+
+
+void jpeg_destroy(struct content *c)
+{
+ xfree(c->data.jpeg.data);
+}
diff --git a/riscos/jpeg.h b/riscos/jpeg.h
new file mode 100644
index 000000000..99601f729
--- /dev/null
+++ b/riscos/jpeg.h
@@ -0,0 +1,17 @@
+/**
+ * $Id: jpeg.h,v 1.1 2003/02/25 21:00:27 bursa Exp $
+ */
+
+#ifndef _NETSURF_RISCOS_JPEG_H_
+#define _NETSURF_RISCOS_JPEG_H_
+
+#include "netsurf/content/content.h"
+
+void jpeg_create(struct content *c);
+void jpeg_process_data(struct content *c, char *data, unsigned long size);
+int jpeg_convert(struct content *c, unsigned int width, unsigned int height);
+void jpeg_revive(struct content *c, unsigned int width, unsigned int height);
+void jpeg_reformat(struct content *c, unsigned int width, unsigned int height);
+void jpeg_destroy(struct content *c);
+
+#endif