summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--!NCNetSurf/!Run,feb4
-rw-r--r--!NetSurf/!Run,feb4
-rw-r--r--content/content.c7
-rw-r--r--content/content.h2
-rw-r--r--render/html.h2
-rw-r--r--riscos/draw.c2
-rw-r--r--riscos/draw.h2
-rw-r--r--riscos/gif.c88
-rw-r--r--riscos/gif.h3
-rw-r--r--riscos/htmlredraw.c113
-rw-r--r--riscos/image.c256
-rw-r--r--riscos/image.h24
-rw-r--r--riscos/jpeg.c92
-rw-r--r--riscos/jpeg.h2
-rw-r--r--riscos/mng.c93
-rw-r--r--riscos/mng.h2
-rw-r--r--riscos/plugin.c2
-rw-r--r--riscos/plugin.h2
-rw-r--r--riscos/png.c91
-rw-r--r--riscos/png.h2
-rw-r--r--riscos/print.c13
-rw-r--r--riscos/sprite.c55
-rw-r--r--riscos/sprite.h2
-rw-r--r--riscos/thumbnail.c4
-rw-r--r--riscos/window.c9
25 files changed, 404 insertions, 472 deletions
diff --git a/!NCNetSurf/!Run,feb b/!NCNetSurf/!Run,feb
index 16a4359cb..847637727 100644
--- a/!NCNetSurf/!Run,feb
+++ b/!NCNetSurf/!Run,feb
@@ -36,8 +36,8 @@ RMEnsure MimeMap 0.10 RMLoad System:Modules.Network.MimeMap
RMEnsure MimeMap 0.10 Error NCNetSurf requires MimeMap 0.10 or later.
| Ensure Tinct is installed.
-RMEnsure Tinct 0.05 RMLoad <NetSurf$Dir>.Resources.Tinct
-RMEnsure Tinct 0.05 Error NetSurf requires Tinct 0.05 or later.
+RMEnsure Tinct 0.07 RMLoad <NetSurf$Dir>.Resources.Tinct
+RMEnsure Tinct 0.07 Error NetSurf requires Tinct 0.07 or later.
| Ensue that the Wimp Scrap directory has been set.
WimpSlot -Min 32k -Max 32k
diff --git a/!NetSurf/!Run,feb b/!NetSurf/!Run,feb
index 8075c4f12..ab38922a1 100644
--- a/!NetSurf/!Run,feb
+++ b/!NetSurf/!Run,feb
@@ -42,8 +42,8 @@ RMEnsure MimeMap 0.10 Error NetSurf requires MimeMap 0.10 or later
| Ensure Tinct is loaded
| http://www.tinct.net
-RMEnsure Tinct 0.05 RMLoad System:Modules.Tinct
-RMEnsure Tinct 0.05 Error NetSurf requires Tinct 0.05 or later. This can be downloaded from http://www.tinct.net
+RMEnsure Tinct 0.07 RMLoad System:Modules.Tinct
+RMEnsure Tinct 0.07 Error NetSurf requires Tinct 0.07 or later. This can be downloaded from http://www.tinct.net
Wimpslot -min 2240k -max 2240k
Set NetSurf$Running yes
diff --git a/content/content.c b/content/content.c
index a74892eb9..4fd6c9b71 100644
--- a/content/content.c
+++ b/content/content.c
@@ -154,7 +154,7 @@ struct handler_entry {
bool (*redraw)(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
void (*open)(struct content *c, struct browser_window *bw,
struct content *page, struct box *box,
struct object_params *params);
@@ -697,12 +697,13 @@ void content_quit(void)
bool content_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale)
+ float scale, unsigned long background_colour)
{
assert(c != 0);
if (handler_map[c->type].redraw)
return handler_map[c->type].redraw(c, x, y, width, height,
- clip_x0, clip_y0, clip_x1, clip_y1, scale);
+ clip_x0, clip_y0, clip_x1, clip_y1, scale,
+ background_colour);
return true;
}
diff --git a/content/content.h b/content/content.h
index 48a15ed00..4a28eb442 100644
--- a/content/content.h
+++ b/content/content.h
@@ -277,7 +277,7 @@ void content_quit(void);
bool content_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
void content_add_user(struct content *c,
void (*callback)(content_msg msg, struct content *c, void *p1,
void *p2, union content_msg_data data),
diff --git a/render/html.h b/render/html.h
index ef22c0d1a..74b19434c 100644
--- a/render/html.h
+++ b/render/html.h
@@ -95,6 +95,6 @@ void html_close(struct content *c);
bool html_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
#endif
diff --git a/riscos/draw.c b/riscos/draw.c
index 37d476306..3a1642ff1 100644
--- a/riscos/draw.c
+++ b/riscos/draw.c
@@ -59,7 +59,7 @@ void draw_destroy(struct content *c)
bool draw_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale)
+ float scale, unsigned long background_colour)
{
os_error *error;
os_trfm matrix;
diff --git a/riscos/draw.h b/riscos/draw.h
index ef92d057e..e73006c5d 100644
--- a/riscos/draw.h
+++ b/riscos/draw.h
@@ -19,5 +19,5 @@ void draw_destroy(struct content *c);
bool draw_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
#endif
diff --git a/riscos/gif.c b/riscos/gif.c
index f8a7aeda1..b98de849c 100644
--- a/riscos/gif.c
+++ b/riscos/gif.c
@@ -11,7 +11,6 @@
#include <stdbool.h>
#include <stdlib.h>
#include <swis.h>
-#include "oslib/colourtrans.h"
#include "oslib/osfile.h"
#include "oslib/osspriteop.h"
#include "netsurf/utils/config.h"
@@ -19,8 +18,8 @@
#include "netsurf/riscos/gif.h"
#include "netsurf/riscos/gifread.h"
#include "netsurf/riscos/gui.h"
+#include "netsurf/riscos/image.h"
#include "netsurf/riscos/options.h"
-#include "netsurf/riscos/tinct.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/messages.h"
#include "netsurf/utils/utils.h"
@@ -125,24 +124,16 @@ bool nsgif_convert(struct content *c, int iwidth, int iheight) {
bool nsgif_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale) {
+ float scale, unsigned long background_colour) {
int previous_frame;
unsigned int frame, current_frame;
- unsigned int tinct_options;
- os_factors f;
- osspriteop_trans_tab *table;
- unsigned int size;
- _kernel_oserror *e;
- os_error *error;
/* If we have a gui_window then we work from there, if not we use the global
settings. We default to the first image if we don't have a GUI as we are
drawing a thumbnail unless something has gone very wrong somewhere else.
*/
if (ro_gui_current_redraw_gui) {
- tinct_options = (ro_gui_current_redraw_gui->option.filter_sprites?tinct_BILINEAR_FILTER:0) |
- (ro_gui_current_redraw_gui->option.dither_sprites?tinct_DITHER:0);
if (ro_gui_current_redraw_gui->option.animate_images) {
current_frame = c->data.gif.current_frame;
} else {
@@ -158,8 +149,6 @@ bool nsgif_redraw(struct content *c, int x, int y,
current_frame = 0;
}
}
- tinct_options = (option_filter_sprites?tinct_BILINEAR_FILTER:0) |
- (option_dither_sprites?tinct_DITHER:0);
}
/* Decode from the last frame to the current frame
@@ -174,75 +163,10 @@ bool nsgif_redraw(struct content *c, int x, int y,
gif_decode_frame(c->data.gif.gif, frame);
}
- /* Tinct currently only handles 32bpp sprites that have an embedded alpha mask. Any
- sprites not matching the required specifications are ignored. See the Tinct
- documentation for further information.
- */
- if (!print_active) {
- e = _swix(Tinct_PlotScaledAlpha, _INR(2,7),
- (char *)c->data.gif.gif->frame_image +
- c->data.gif.gif->frame_image->first,
- x, (int)(y - height),
- width, height,
- tinct_options);
- if (e) {
- LOG(("tinct_plotscaledalpha: 0x%x: %s", e->errnum, e->errmess));
- return false;
- }
- }
- else {
- error = xcolourtrans_generate_table_for_sprite(
- c->data.gif.gif->frame_image,
- (osspriteop_id)((char *)
- c->data.gif.gif->frame_image +
- c->data.gif.gif->frame_image->first),
- colourtrans_CURRENT_MODE,
- colourtrans_CURRENT_PALETTE,
- 0, colourtrans_GIVEN_SPRITE, 0, 0, &size);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
-
- table = calloc(size, sizeof(char));
-
- error = xcolourtrans_generate_table_for_sprite(
- c->data.gif.gif->frame_image,
- (osspriteop_id)((char *)
- c->data.gif.gif->frame_image +
- c->data.gif.gif->frame_image->first),
- colourtrans_CURRENT_MODE,
- colourtrans_CURRENT_PALETTE,
- table, colourtrans_GIVEN_SPRITE, 0, 0, 0);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- free(table);
- return false;
- }
-
- f.xmul = width;
- f.ymul = height;
- f.xdiv = c->width * 2;
- f.ydiv = c->height * 2;
-
- error = xosspriteop_put_sprite_scaled(osspriteop_PTR,
- c->data.gif.gif->frame_image,
- (osspriteop_id)((char *)
- c->data.gif.gif->frame_image +
- c->data.gif.gif->frame_image->first),
- x, (int)(y - height),
- osspriteop_USE_MASK | osspriteop_USE_PALETTE,
- &f, table);
- if (error) {
- LOG(("xosspriteop_put_sprite_scaled: 0x%x: %s", error->errnum, error->errmess));
- free(table);
- return false;
- }
-
- free(table);
- }
-
- return true;
+ return image_redraw(c->data.gif.gif->frame_image, x, y, width,
+ height, c->width * 2, c->height * 2,
+ background_colour, false, false,
+ IMAGE_PLOT_TINCT_ALPHA);
}
diff --git a/riscos/gif.h b/riscos/gif.h
index 1a800438f..891991b4a 100644
--- a/riscos/gif.h
+++ b/riscos/gif.h
@@ -9,7 +9,6 @@
#ifndef _NETSURF_RISCOS_GIF_H_
#define _NETSURF_RISCOS_GIF_H_
-#include "oslib/osspriteop.h"
#include "netsurf/riscos/gifread.h"
struct content;
@@ -31,6 +30,6 @@ void nsgif_destroy(struct content *c);
bool nsgif_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
#endif
diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c
index a3ecce1c6..49f926eb9 100644
--- a/riscos/htmlredraw.c
+++ b/riscos/htmlredraw.c
@@ -13,7 +13,6 @@
#include <assert.h>
#include <stdbool.h>
#include <string.h>
-#include "swis.h"
#include "oslib/colourtrans.h"
#include "oslib/draw.h"
#include "oslib/font.h"
@@ -27,8 +26,8 @@
#include "netsurf/render/form.h"
#include "netsurf/render/html.h"
#include "netsurf/riscos/gui.h"
+#include "netsurf/riscos/image.h"
#include "netsurf/riscos/options.h"
-#include "netsurf/riscos/tinct.h"
#include "netsurf/riscos/toolbar.h"
#include "netsurf/riscos/ufont.h"
#include "netsurf/riscos/wimp.h"
@@ -59,7 +58,8 @@ static bool html_redraw_radio(int x, int y, int width, int height,
static bool html_redraw_file(int x, int y, int width, int height,
struct box *box, float scale);
static bool html_redraw_background(int x, int y, int width, int height,
- struct box *box, float scale);
+ struct box *box, float scale,
+ unsigned long background_colour);
bool gui_redraw_debug = false;
static int ro_gui_redraw_box_depth;
@@ -73,16 +73,17 @@ static os_trfm trfm = { {
/**
* Draw a CONTENT_HTML to a RISC OS window.
*
- * \param c content of type CONTENT_HTML
- * \param x coordinate for top-left of redraw
- * \param y coordinate for top-left of redraw
- * \param width available width (not used for HTML redraw)
- * \param height available height (not used for HTML redraw)
- * \param clip_x0 clip rectangle
- * \param clip_y0 clip rectangle
- * \param clip_x1 clip rectangle
- * \param clip_y1 clip rectangle
- * \param scale scale for redraw
+ * \param c content of type CONTENT_HTML
+ * \param x coordinate for top-left of redraw
+ * \param y coordinate for top-left of redraw
+ * \param width available width (not used for HTML redraw)
+ * \param height available height (not used for HTML redraw)
+ * \param clip_x0 clip rectangle
+ * \param clip_y0 clip rectangle
+ * \param clip_x1 clip rectangle
+ * \param clip_y1 clip rectangle
+ * \param scale scale for redraw
+ * \param background_colour the background colour
* \return true if successful, false otherwise
*
* x, y, clip_[xy][01] are in RISC OS screen absolute OS-units.
@@ -91,9 +92,8 @@ static os_trfm trfm = { {
bool html_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale)
+ float scale, unsigned long background_colour)
{
- unsigned long background_colour = 0xffffff;
struct box *box;
os_error *error;
@@ -195,7 +195,7 @@ bool html_redraw_box(struct box *box,
if (!html_redraw_rectangle(x, y, padding_width,
padding_height, os_COLOUR_MAGENTA))
return false;
- if (html_redraw_rectangle(x + padding_left, y - padding_top,
+ if (!html_redraw_rectangle(x + padding_left, y - padding_top,
width, height, os_COLOUR_CYAN))
return false;
if (!html_redraw_rectangle(x - (box->border[LEFT] +
@@ -343,7 +343,8 @@ bool html_redraw_box(struct box *box,
/* plot background image */
if (!html_redraw_background(x, y, width, clip_y1 - clip_y0,
- box, scale))
+ box, scale,
+ current_background_color))
return false;
/* restore previous graphics window */
@@ -354,7 +355,8 @@ bool html_redraw_box(struct box *box,
if (box->object) {
if (!content_redraw(box->object, x + padding_left, y - padding_top,
- width, height, x0, y0, x1, y1, scale))
+ width, height, x0, y0, x1, y1, scale,
+ current_background_color))
return false;
} else if (box->gadget && box->gadget->type == GADGET_CHECKBOX) {
@@ -858,9 +860,8 @@ bool html_redraw_file(int x, int y, int width, int height,
}
bool html_redraw_background(int xi, int yi, int width, int height,
- struct box *box, float scale)
+ struct box *box, float scale, unsigned long background_colour)
{
- unsigned int tinct_options = 0;
int x = 0;
int y = 0;
unsigned int image_width, image_height;
@@ -869,6 +870,8 @@ bool html_redraw_background(int xi, int yi, int width, int height,
bool fixed = false;
wimp_window_state state;
os_error *error;
+ bool repeat_x = false;
+ bool repeat_y = false;
if (box->background == 0) return true;
@@ -876,8 +879,11 @@ bool html_redraw_background(int xi, int yi, int width, int height,
if (ro_gui_current_redraw_gui) {
- /* read state of window we're drawing in */
+ /* exit if background images aren't wanted */
+ if (!ro_gui_current_redraw_gui->option.background_images)
+ return true;
+ /* read state of window we're drawing in */
state.w = ro_gui_current_redraw_gui->window;
error = xwimp_get_window_state(&state);
if (error) {
@@ -887,16 +893,11 @@ bool html_redraw_background(int xi, int yi, int width, int height,
/* invalidate state.w */
state.w = 0;
}
-
- /* Set the plot options */
- if (!ro_gui_current_redraw_gui->option.background_images)
+ }
+ else {
+ /* exit if background images aren't wanted */
+ if (!option_background_images)
return true;
- tinct_options = (ro_gui_current_redraw_gui->option.filter_sprites?tinct_BILINEAR_FILTER:0) |
- (ro_gui_current_redraw_gui->option.dither_sprites?tinct_DITHER:0);
- } else {
- if (!option_background_images) return true;
- tinct_options = (option_filter_sprites?tinct_BILINEAR_FILTER:0) |
- (option_dither_sprites?tinct_DITHER:0);
}
/* Get the image dimensions for our positioning and scaling */
@@ -919,13 +920,13 @@ bool html_redraw_background(int xi, int yi, int width, int height,
/* handle background-repeat */
switch (box->style->background_repeat) {
case CSS_BACKGROUND_REPEAT_REPEAT:
- tinct_options |= tinct_FILL_HORIZONTALLY | tinct_FILL_VERTICALLY;
+ repeat_x = repeat_y = true;
break;
case CSS_BACKGROUND_REPEAT_REPEAT_X:
- tinct_options |= tinct_FILL_HORIZONTALLY;
+ repeat_x = true;
break;
case CSS_BACKGROUND_REPEAT_REPEAT_Y:
- tinct_options |= tinct_FILL_VERTICALLY;
+ repeat_y = true;
break;
case CSS_BACKGROUND_REPEAT_NO_REPEAT:
break;
@@ -1014,35 +1015,47 @@ bool html_redraw_background(int xi, int yi, int width, int height,
switch (box->background->type) {
#ifdef WITH_PNG
case CONTENT_PNG:
- _swix(Tinct_PlotScaledAlpha, _IN(2) | _IN(3) | _IN(4) | _IN(5) | _IN(6) | _IN(7),
- ((char*) box->background->data.png.sprite_area + box->background->data.png.sprite_area->first),
- x, y - image_height, image_width, image_height,
- tinct_options);
+ image_redraw(box->background->data.png.sprite_area,
+ x, y, image_width, image_height,
+ box->background->width * 2,
+ box->background->height * 2,
+ background_colour,
+ repeat_x, repeat_y,
+ IMAGE_PLOT_TINCT_ALPHA);
break;
#endif
-#ifdef WITH_PNG
+#ifdef WITH_MNG
case CONTENT_JNG:
case CONTENT_MNG:
- _swix(Tinct_PlotScaledAlpha, _IN(2) | _IN(3) | _IN(4) | _IN(5) | _IN(6) | _IN(7),
- ((char*) box->background->data.mng.sprite_area + box->background->data.mng.sprite_area->first),
- x, y - image_height, image_width, image_height,
- tinct_options);
+ image_redraw(box->background->data.mng.sprite_area,
+ x, y, image_width, image_height,
+ box->background->width * 2,
+ box->background->height * 2,
+ background_colour,
+ repeat_x, repeat_y,
+ IMAGE_PLOT_TINCT_ALPHA);
break;
#endif
#ifdef WITH_JPEG
case CONTENT_JPEG:
- _swix(Tinct_PlotScaled, _IN(2) | _IN(3) | _IN(4) | _IN(5) | _IN(6) | _IN(7),
- ((char*) box->background->data.jpeg.sprite_area + box->background->data.jpeg.sprite_area->first),
- x, y - image_height, image_width, image_height,
- tinct_options);
+ image_redraw(box->background->data.jpeg.sprite_area,
+ x, y, image_width, image_height,
+ box->background->width * 2,
+ box->background->height * 2,
+ background_colour,
+ repeat_x, repeat_y,
+ IMAGE_PLOT_TINCT_OPAQUE);
break;
#endif
#ifdef WITH_GIF
case CONTENT_GIF:
- _swix(Tinct_PlotScaledAlpha, _IN(2) | _IN(3) | _IN(4) | _IN(5) | _IN(6) | _IN(7),
- ((char*) box->background->data.gif.gif->frame_image + box->background->data.gif.gif->frame_image->first),
- x, y - image_height, image_width, image_height,
- tinct_options);
+ image_redraw(box->background->data.gif.gif->frame_image,
+ x, y, image_width, image_height,
+ box->background->width * 2,
+ box->background->height * 2,
+ background_colour,
+ repeat_x, repeat_y,
+ IMAGE_PLOT_TINCT_ALPHA);
break;
#endif
/**\todo Add draw/sprite background support? */
diff --git a/riscos/image.c b/riscos/image.c
new file mode 100644
index 000000000..2eb00e649
--- /dev/null
+++ b/riscos/image.c
@@ -0,0 +1,256 @@
+/*
+ * This file is part of NetSurf, http://netsurf.sourceforge.net/
+ * Licensed under the GNU General Public License,
+ * http://www.opensource.org/licenses/gpl-license
+ * Copyright 2004 John M Bell <jmb202@ecs.soton.ac.uk>
+ */
+
+#include <stdbool.h>
+#include "swis.h"
+
+#include "oslib/colourtrans.h"
+#include "oslib/osspriteop.h"
+
+#include "netsurf/riscos/image.h"
+#include "netsurf/riscos/gui.h"
+#include "netsurf/riscos/options.h"
+#include "netsurf/riscos/tinct.h"
+#include "netsurf/utils/log.h"
+#include "netsurf/utils/utils.h"
+
+
+static bool image_redraw_tinct_alpha(osspriteop_area *area, int x, int y,
+ int req_width, int req_height, int width, int height,
+ unsigned long background_colour, bool repeatx, bool repeaty);
+static bool image_redraw_tinct_opaque(osspriteop_area *area, int x, int y,
+ int req_width, int req_height, int width, int height,
+ unsigned long background_colour, bool repeatx, bool repeaty);
+static bool image_redraw_os(osspriteop_area *area, int x, int y,
+ int req_width, int req_height, int width, int height);
+
+/**
+ * Plot an image at the given coordinates using the method specified
+ *
+ * \param area The sprite area containing the sprite
+ * \param x Left edge of sprite
+ * \param y Top edge of sprite
+ * \param req_width The requested width of the sprite
+ * \param req_height The requested height of the sprite
+ * \param width The actual width of the sprite
+ * \param height The actual height of the sprite
+ * \param background_colour The background colour to blend to
+ * \param repeatx Repeat the image in the x direction
+ * \param repeaty Repeat the image in the y direction
+ * \param type The plot method to use
+ * \return true on success, false otherwise
+ */
+bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
+ int req_height, int width, int height,
+ unsigned long background_colour,
+ bool repeatx, bool repeaty,image_type type)
+{
+ switch (type) {
+ case IMAGE_PLOT_TINCT_ALPHA:
+ return image_redraw_tinct_alpha(area, x, y,
+ req_width, req_height,
+ width, height,
+ background_colour,
+ repeatx, repeaty);
+ case IMAGE_PLOT_TINCT_OPAQUE:
+ return image_redraw_tinct_opaque(area, x, y,
+ req_width, req_height,
+ width, height,
+ background_colour,
+ repeatx, repeaty);
+ case IMAGE_PLOT_OS:
+ return image_redraw_os(area, x, y, req_width,
+ req_height, width, height);
+ default:
+ break;
+ }
+
+ return false;
+}
+
+/**
+ * Plot an alpha channel image at the given coordinates using tinct
+ *
+ * \param area The sprite area containing the sprite
+ * \param x Left edge of sprite
+ * \param y Top edge of sprite
+ * \param req_width The requested width of the sprite
+ * \param req_height The requested height of the sprite
+ * \param width The actual width of the sprite
+ * \param height The actual height of the sprite
+ * \param background_colour The background colour to blend to
+ * \return true on success, false otherwise
+ */
+bool image_redraw_tinct_alpha(osspriteop_area *area, int x, int y,
+ int req_width, int req_height, int width, int height,
+ unsigned long background_colour, bool repeatx, bool repeaty)
+{
+ unsigned int tinct_options;
+ _kernel_oserror *error;
+
+ if (ro_gui_current_redraw_gui) {
+ tinct_options =
+ (ro_gui_current_redraw_gui->option.filter_sprites ?
+ tinct_BILINEAR_FILTER : 0)
+ |
+ (ro_gui_current_redraw_gui->option.dither_sprites ?
+ tinct_DITHER : 0);
+ } else {
+ tinct_options =
+ (option_filter_sprites ? tinct_BILINEAR_FILTER : 0)
+ |
+ (option_dither_sprites ? tinct_DITHER : 0);
+ }
+
+ if (print_active) {
+ tinct_options |= tinct_USE_OS_SPRITE_OP |
+ background_colour << tinct_BACKGROUND_SHIFT;
+ }
+
+ if (repeatx)
+ tinct_options |= tinct_FILL_HORIZONTALLY;
+
+ if (repeaty)
+ tinct_options |= tinct_FILL_VERTICALLY;
+
+ error = _swix(Tinct_PlotScaledAlpha, _INR(2,7),
+ (char*)area + area->first, x, y - req_height,
+ req_width, req_height, tinct_options);
+ if (error) {
+ LOG(("xtinct_plotscaledalpha: 0x%x: %s",
+ error->errnum, error->errmess));
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Plot an opaque image at the given coordinates using tinct
+ *
+ * \param area The sprite area containing the sprite
+ * \param x Left edge of sprite
+ * \param y Top edge of sprite
+ * \param req_width The requested width of the sprite
+ * \param req_height The requested height of the sprite
+ * \param width The actual width of the sprite
+ * \param height The actual height of the sprite
+ * \param background_colour The background colour to blend to
+ * \return true on success, false otherwise
+ */
+bool image_redraw_tinct_opaque(osspriteop_area *area, int x, int y,
+ int req_width, int req_height, int width, int height,
+ unsigned long background_colour, bool repeatx, bool repeaty)
+{
+ unsigned int tinct_options;
+ _kernel_oserror *error;
+
+ if (ro_gui_current_redraw_gui) {
+ tinct_options =
+ (ro_gui_current_redraw_gui->option.filter_sprites ?
+ tinct_BILINEAR_FILTER : 0)
+ |
+ (ro_gui_current_redraw_gui->option.dither_sprites ?
+ tinct_DITHER : 0);
+ } else {
+ tinct_options =
+ (option_filter_sprites ? tinct_BILINEAR_FILTER : 0)
+ |
+ (option_dither_sprites ? tinct_DITHER : 0);
+ }
+
+ if (print_active) {
+ tinct_options |= tinct_USE_OS_SPRITE_OP |
+ background_colour << tinct_BACKGROUND_SHIFT;
+ }
+
+ if (repeatx)
+ tinct_options |= tinct_FILL_HORIZONTALLY;
+
+ if (repeaty)
+ tinct_options |= tinct_FILL_VERTICALLY;
+
+ error = _swix(Tinct_PlotScaled, _INR(2,7),
+ (char*)area + area->first, x, y - req_height,
+ req_width, req_height, tinct_options);
+ if (error) {
+ LOG(("xtinct_plotscaled: 0x%x: %s",
+ error->errnum, error->errmess));
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Plot an image at the given coordinates using os_spriteop
+ *
+ * \param area The sprite area containing the sprite
+ * \param x Left edge of sprite
+ * \param y Top edge of sprite
+ * \param req_width The requested width of the sprite
+ * \param req_height The requested height of the sprite
+ * \param width The actual width of the sprite
+ * \param height The actual height of the sprite
+ * \return true on success, false otherwise
+ */
+bool image_redraw_os(osspriteop_area *area, int x, int y, int req_width,
+ int req_height, int width, int height)
+{
+ unsigned int size;
+ os_factors f;
+ osspriteop_trans_tab *table;
+ os_error *error;
+
+ error = xcolourtrans_generate_table_for_sprite(
+ area, (osspriteop_id)((char*) area + area->first),
+ colourtrans_CURRENT_MODE,
+ colourtrans_CURRENT_PALETTE,
+ 0, colourtrans_GIVEN_SPRITE, 0, 0, &size);
+ if (error) {
+ LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
+ return false;
+ }
+
+ table = calloc(size, sizeof(char));
+ if (!table) {
+ LOG(("malloc failed"));
+ warn_user("NoMemory", 0);
+ return false;
+ }
+
+ error = xcolourtrans_generate_table_for_sprite(
+ area, (osspriteop_id)((char*) area + area->first),
+ colourtrans_CURRENT_MODE,
+ colourtrans_CURRENT_PALETTE,
+ table, colourtrans_GIVEN_SPRITE, 0, 0, 0);
+ if (error) {
+ LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
+ free(table);
+ return false;
+ }
+
+ f.xmul = req_width;
+ f.ymul = req_height;
+ f.xdiv = width * 2;
+ f.ydiv = height * 2;
+
+ error = xosspriteop_put_sprite_scaled(osspriteop_PTR,
+ area, (osspriteop_id)((char*) area + area->first),
+ x, (int)(y - req_height),
+ 0, &f, table);
+ if (error) {
+ LOG(("xosspriteop_put_sprite_scaled: 0x%x: %s", error->errnum, error->errmess));
+ free(table);
+ return false;
+ }
+
+ free(table);
+
+ return true;
+}
+
diff --git a/riscos/image.h b/riscos/image.h
new file mode 100644
index 000000000..17b9f08b6
--- /dev/null
+++ b/riscos/image.h
@@ -0,0 +1,24 @@
+/*
+ * This file is part of NetSurf, http://netsurf.sourceforge.net/
+ * Licensed under the GNU General Public License,
+ * http://www.opensource.org/licenses/gpl-license
+ * Copyright 2004 John M Bell <jmb202@ecs.soton.ac.uk>
+ */
+
+#ifndef _NETSURF_RISCOS_IMAGE_H_
+#define _NETSURF_RISCOS_IMAGE_H_
+
+struct osspriteop_area;
+
+typedef enum {
+ IMAGE_PLOT_TINCT_ALPHA,
+ IMAGE_PLOT_TINCT_OPAQUE,
+ IMAGE_PLOT_OS
+} image_type;
+
+bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
+ int req_height, int width, int height,
+ unsigned long background_colour,
+ bool repeatx, bool repeaty, image_type type);
+
+#endif
diff --git a/riscos/jpeg.c b/riscos/jpeg.c
index 9a4ff0927..356748187 100644
--- a/riscos/jpeg.c
+++ b/riscos/jpeg.c
@@ -19,15 +19,13 @@
#include <swis.h>
#define JPEG_INTERNAL_OPTIONS
#include "libjpeg/jpeglib.h"
-#include "oslib/colourtrans.h"
#include "oslib/osspriteop.h"
#include "netsurf/utils/config.h"
#include "netsurf/content/content.h"
-#include "netsurf/desktop/gui.h"
#include "netsurf/riscos/gui.h"
+#include "netsurf/riscos/image.h"
#include "netsurf/riscos/jpeg.h"
#include "netsurf/riscos/options.h"
-#include "netsurf/riscos/tinct.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/messages.h"
#include "netsurf/utils/utils.h"
@@ -247,89 +245,9 @@ void nsjpeg_destroy(struct content *c)
bool nsjpeg_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale)
+ float scale, unsigned long background_colour)
{
- unsigned int tinct_options;
- unsigned int size;
- os_factors f;
- osspriteop_trans_tab *table;
- _kernel_oserror *e;
- os_error *error;
-
- /* If we have a gui_window then we work from there, if not we use the global
- settings as we are drawing a thumbnail.
- */
- if (ro_gui_current_redraw_gui) {
- tinct_options = (ro_gui_current_redraw_gui->option.filter_sprites?tinct_BILINEAR_FILTER:0) |
- (ro_gui_current_redraw_gui->option.dither_sprites?tinct_DITHER:0);
- } else {
- tinct_options = (option_filter_sprites?tinct_BILINEAR_FILTER:0) |
- (option_dither_sprites?tinct_DITHER:0);
- }
-
- /* Tinct currently only handles 32bpp sprites that have an embedded alpha mask. Any
- sprites not matching the required specifications are ignored. See the Tinct
- documentation for further information.
- */
- if (!print_active) {
- e = _swix(Tinct_PlotScaled, _INR(2,7),
- (char *) c->data.jpeg.sprite_area +
- c->data.jpeg.sprite_area->first,
- x, y - height,
- width, height,
- tinct_options);
- if (e) {
- LOG(("tinct_plotscaled: 0x%x: %s", e->errnum, e->errmess));
- return false;
- }
- }
- else {
- error = xcolourtrans_generate_table_for_sprite(
- c->data.jpeg.sprite_area,
- (osspriteop_id)((char*)c->data.jpeg.sprite_area +
- c->data.jpeg.sprite_area->first),
- colourtrans_CURRENT_MODE,
- colourtrans_CURRENT_PALETTE,
- 0, colourtrans_GIVEN_SPRITE, 0, 0, &size);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
-
- table = calloc(size, sizeof(char));
-
- error = xcolourtrans_generate_table_for_sprite(
- c->data.jpeg.sprite_area,
- (osspriteop_id)((char*)c->data.jpeg.sprite_area +
- c->data.jpeg.sprite_area->first),
- colourtrans_CURRENT_MODE,
- colourtrans_CURRENT_PALETTE,
- table, colourtrans_GIVEN_SPRITE, 0, 0, 0);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- free(table);
- return false;
- }
-
- f.xmul = width;
- f.ymul = height;
- f.xdiv = c->width * 2;
- f.ydiv = c->height * 2;
-
- error = xosspriteop_put_sprite_scaled(osspriteop_PTR,
- c->data.jpeg.sprite_area,
- (osspriteop_id)((char*)c->data.jpeg.sprite_area +
- c->data.jpeg.sprite_area->first),
- x, (int)(y - height),
- 0, &f, table);
- if (error) {
- LOG(("xosspriteop_put_sprite_scaled: 0x%x: %s", error->errnum, error->errmess));
- free(table);
- return false;
- }
-
- free(table);
- }
-
- return true;
+ return image_redraw(c->data.jpeg.sprite_area, x, y, width, height,
+ c->width * 2, c->height *2, background_colour,
+ false, false, IMAGE_PLOT_TINCT_OPAQUE);
}
diff --git a/riscos/jpeg.h b/riscos/jpeg.h
index 9c7ff38ae..90c7492a5 100644
--- a/riscos/jpeg.h
+++ b/riscos/jpeg.h
@@ -22,6 +22,6 @@ void nsjpeg_destroy(struct content *c);
bool nsjpeg_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
#endif
diff --git a/riscos/mng.c b/riscos/mng.c
index 53c87cbe4..fa44a9928 100644
--- a/riscos/mng.c
+++ b/riscos/mng.c
@@ -11,15 +11,14 @@
#include <stdlib.h>
#include <swis.h>
#include "libmng/libmng.h"
-#include "oslib/colourtrans.h"
#include "oslib/os.h"
#include "oslib/osspriteop.h"
#include "netsurf/utils/config.h"
#include "netsurf/content/content.h"
#include "netsurf/riscos/gui.h"
-#include "netsurf/riscos/options.h"
+#include "netsurf/riscos/image.h"
#include "netsurf/riscos/mng.h"
-#include "netsurf/riscos/tinct.h"
+#include "netsurf/riscos/options.h"
#include "netsurf/riscos/wimp.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/messages.h"
@@ -381,93 +380,19 @@ void nsmng_destroy(struct content *c) {
bool nsmng_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale) {
- unsigned int tinct_options;
- unsigned int size;
- os_factors f;
- osspriteop_trans_tab *table;
- _kernel_oserror *e;
- os_error *error;
-
- /* If we have a gui_window then we work from there, if not we use the global
- settings as we are drawing a thumbnail.
- */
- if (ro_gui_current_redraw_gui) {
- tinct_options = (ro_gui_current_redraw_gui->option.filter_sprites?tinct_BILINEAR_FILTER:0) |
- (ro_gui_current_redraw_gui->option.dither_sprites?tinct_DITHER:0);
- } else {
- tinct_options = (option_filter_sprites?tinct_BILINEAR_FILTER:0) |
- (option_dither_sprites?tinct_DITHER:0);
- }
-
- /* Tinct currently only handles 32bpp sprites that have an embedded alpha mask. Any
- sprites not matching the required specifications are ignored. See the Tinct
- documentation for further information.
- */
- if (!print_active) {
- e = _swix(Tinct_PlotScaledAlpha, _INR(2,7),
- ((char *) c->data.mng.sprite_area + c->data.mng.sprite_area->first),
- x, y - height,
- width, height,
- tinct_options);
- if (e) {
- LOG(("xtince_plotscaledalpha: 0x%x: %s", e->errnum, e->errmess));
- return false;
- }
- }
- else {
- error = xcolourtrans_generate_table_for_sprite(
- c->data.mng.sprite_area,
- (osspriteop_id)((char*)c->data.mng.sprite_area +
- c->data.mng.sprite_area->first),
- colourtrans_CURRENT_MODE,
- colourtrans_CURRENT_PALETTE,
- 0, colourtrans_GIVEN_SPRITE, 0, 0, &size);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
-
- table = calloc(size, sizeof(char));
-
- error = xcolourtrans_generate_table_for_sprite(
- c->data.mng.sprite_area,
- (osspriteop_id)((char*)c->data.mng.sprite_area +
- c->data.mng.sprite_area->first),
- colourtrans_CURRENT_MODE,
- colourtrans_CURRENT_PALETTE,
- table, colourtrans_GIVEN_SPRITE, 0, 0, 0);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- free(table);
- return false;
- }
+ float scale, unsigned long background_colour)
+{
+ bool ret;
- f.xmul = width;
- f.ymul = height;
- f.xdiv = c->width * 2;
- f.ydiv = c->height * 2;
-
- error = xosspriteop_put_sprite_scaled(osspriteop_PTR,
- c->data.mng.sprite_area,
- (osspriteop_id)((char*)c->data.mng.sprite_area +
- c->data.mng.sprite_area->first),
- x, (int)(y - height),
- osspriteop_USE_MASK | osspriteop_USE_PALETTE,
- &f, table);
- if (error) {
- LOG(("xosspriteop_put_sprite_scaled: 0x%x: %s", error->errnum, error->errmess));
- free(table);
- return false;
- }
+ ret = image_redraw(c->data.mng.sprite_area, x, y, width, height,
+ c->width * 2, c->height * 2, background_colour,
+ false, false, IMAGE_PLOT_TINCT_ALPHA);
- free(table);
- }
/* Check if we need to restart the animation
*/
if (c->data.mng.waiting) nsmng_animate(c);
- return true;
+ return ret;
}
/**
diff --git a/riscos/mng.h b/riscos/mng.h
index 6dee782ea..d5ba0ea2e 100644
--- a/riscos/mng.h
+++ b/riscos/mng.h
@@ -29,5 +29,5 @@ void nsmng_destroy(struct content *c);
bool nsmng_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
#endif
diff --git a/riscos/plugin.c b/riscos/plugin.c
index da939d2c8..8c1d7abaa 100644
--- a/riscos/plugin.c
+++ b/riscos/plugin.c
@@ -201,7 +201,7 @@ void plugin_destroy(struct content *c)
bool plugin_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale)
+ float scale, unsigned long background_colour)
{
/* do nothing */
LOG(("plugin_redraw"));
diff --git a/riscos/plugin.h b/riscos/plugin.h
index 8d3bfd798..2788d2d32 100644
--- a/riscos/plugin.h
+++ b/riscos/plugin.h
@@ -48,7 +48,7 @@ void plugin_destroy(struct content *c);
bool plugin_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
void plugin_open(struct content *c, struct browser_window *bw,
struct content *page, struct box *box,
struct object_params *params);
diff --git a/riscos/png.c b/riscos/png.c
index 2578e5990..8d6ae8265 100644
--- a/riscos/png.c
+++ b/riscos/png.c
@@ -10,16 +10,14 @@
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
-#include <swis.h>
#include "libpng/png.h"
-#include "oslib/colourtrans.h"
#include "oslib/osspriteop.h"
#include "netsurf/utils/config.h"
#include "netsurf/content/content.h"
#include "netsurf/riscos/gui.h"
+#include "netsurf/riscos/image.h"
#include "netsurf/riscos/options.h"
#include "netsurf/riscos/png.h"
-#include "netsurf/riscos/tinct.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/messages.h"
#include "netsurf/utils/utils.h"
@@ -271,89 +269,10 @@ void nspng_destroy(struct content *c)
bool nspng_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale)
+ float scale, unsigned long background_colour)
{
- unsigned int tinct_options;
- unsigned int size;
- os_factors f;
- osspriteop_trans_tab *table;
- _kernel_oserror *e;
- os_error *error;
-
- /* If we have a gui_window then we work from there, if not we use the global
- settings as we are drawing a thumbnail.
- */
- if (ro_gui_current_redraw_gui) {
- tinct_options = (ro_gui_current_redraw_gui->option.filter_sprites?tinct_BILINEAR_FILTER:0) |
- (ro_gui_current_redraw_gui->option.dither_sprites?tinct_DITHER:0);
- } else {
- tinct_options = (option_filter_sprites?tinct_BILINEAR_FILTER:0) |
- (option_dither_sprites?tinct_DITHER:0);
- }
-
- /* Tinct currently only handles 32bpp sprites that have an embedded alpha mask. Any
- sprites not matching the required specifications are ignored. See the Tinct
- documentation for further information.
- */
- if (!print_active) {
- e = _swix(Tinct_PlotScaledAlpha, _INR(2,7),
- ((char *) c->data.png.sprite_area + c->data.png.sprite_area->first),
- x, y - height,
- width, height,
- tinct_options);
- if (e) {
- LOG(("xtinct_plotscaled_alpha: 0x%x: %s", e->errnum, e->errmess));
- return false;
- }
- }
- else {
- error = xcolourtrans_generate_table_for_sprite(
- c->data.png.sprite_area,
- (osspriteop_id)((char*)c->data.png.sprite_area +
- c->data.png.sprite_area->first),
- colourtrans_CURRENT_MODE,
- colourtrans_CURRENT_PALETTE,
- 0, colourtrans_GIVEN_SPRITE, 0, 0, &size);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
-
- table = calloc(size, sizeof(char));
-
- error = xcolourtrans_generate_table_for_sprite(
- c->data.png.sprite_area,
- (osspriteop_id)((char*)c->data.png.sprite_area +
- c->data.png.sprite_area->first),
- colourtrans_CURRENT_MODE,
- colourtrans_CURRENT_PALETTE,
- table, colourtrans_GIVEN_SPRITE, 0, 0, 0);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
-
- f.xmul = width;
- f.ymul = height;
- f.xdiv = c->width * 2;
- f.ydiv = c->height * 2;
-
- error = xosspriteop_put_sprite_scaled(osspriteop_PTR,
- c->data.png.sprite_area,
- (osspriteop_id)((char*)c->data.png.sprite_area +
- c->data.png.sprite_area->first),
- x, (int)(y - height),
- osspriteop_USE_MASK | osspriteop_USE_PALETTE,
- &f, table);
- if (error) {
- LOG(("xosspriteop_put_sprite_scaled: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
-
-
- free(table);
- }
-
- return true;
+ return image_redraw(c->data.png.sprite_area, x, y, width, height,
+ c->width * 2, c->height * 2, background_colour,
+ false, false, IMAGE_PLOT_TINCT_ALPHA);
}
#endif
diff --git a/riscos/png.h b/riscos/png.h
index 9b5b5c932..b9cc784c0 100644
--- a/riscos/png.h
+++ b/riscos/png.h
@@ -29,5 +29,5 @@ void nspng_destroy(struct content *c);
bool nspng_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
#endif
diff --git a/riscos/print.c b/riscos/print.c
index ddb92963d..8cb35c319 100644
--- a/riscos/print.c
+++ b/riscos/print.c
@@ -27,11 +27,7 @@
#include "netsurf/utils/log.h"
#include "netsurf/utils/utils.h"
-/** \todo position images correctly (seem to be offset
- * to the right and upwards by half the print margin width)
- * \todo fix images when printing with the PostScript driver
- * (redraws appear not to be intercepted)
- * \todo landscape format pages
+/** \todo landscape format pages
* \todo be somewhat more intelligent and try not to crop pages
* half way up a line of text
* \todo make use of print stylesheets
@@ -104,9 +100,7 @@ void ro_gui_print_open(struct gui_window *g, int x, int y, bool sub_menu, bool k
ro_gui_set_icon_selected_state(dialog_print, ICON_PRINT_FG_IMAGES, true);
ro_gui_set_icon_shaded_state(dialog_print, ICON_PRINT_FG_IMAGES, true);
- ro_gui_set_icon_selected_state(dialog_print, ICON_PRINT_BG_IMAGES, false/*print_bg_images*/);
- ro_gui_set_icon_shaded_state(dialog_print, ICON_PRINT_BG_IMAGES, true);
-
+ ro_gui_set_icon_selected_state(dialog_print, ICON_PRINT_BG_IMAGES, print_bg_images);
ro_gui_set_icon_selected_state(dialog_print, ICON_PRINT_IN_BACKGROUND, false);
@@ -119,6 +113,7 @@ void ro_gui_print_open(struct gui_window *g, int x, int y, bool sub_menu, bool k
ro_gui_set_icon_shaded_state(dialog_print, ICON_PRINT_PRINT, true);
}
else {
+ ro_gui_set_icon_shaded_state(dialog_print, ICON_PRINT_PRINT, false);
ro_gui_set_window_title(dialog_print, pdName);
}
@@ -637,7 +632,7 @@ void print_document(struct gui_window *g, const char *filename)
c->width * 2, c->height * 2,
b.x0, b.y0,
b.x1-1, b.y1-1,
- print_scale)) {
+ print_scale, 0xFFFFFF)) {
ro_gui_current_redraw_gui = NULL;
goto error;
}
diff --git a/riscos/sprite.c b/riscos/sprite.c
index b994cbef7..f4a187f1d 100644
--- a/riscos/sprite.c
+++ b/riscos/sprite.c
@@ -12,6 +12,7 @@
#include "oslib/osspriteop.h"
#include "netsurf/utils/config.h"
#include "netsurf/content/content.h"
+#include "netsurf/riscos/image.h"
#include "netsurf/riscos/sprite.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/messages.h"
@@ -100,56 +101,10 @@ void sprite_destroy(struct content *c)
bool sprite_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale)
+ float scale, unsigned long background_colour)
{
- unsigned int size;
- osspriteop_area *area = (osspriteop_area*)c->data.sprite.data;
- osspriteop_trans_tab *table;
- os_factors factors;
- os_error *error;
-
- error = xcolourtrans_generate_table_for_sprite(
- area,
- (osspriteop_id)((char*)(c->data.sprite.data) +
- area->first),
- colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE,
- 0, colourtrans_GIVEN_SPRITE, 0, 0, &size);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
- table = xcalloc(size, 1);
- error = xcolourtrans_generate_table_for_sprite(
- area,
- (osspriteop_id)((char*)(c->data.sprite.data) +
- area->first),
- colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE,
- table, colourtrans_GIVEN_SPRITE, 0, 0, 0);
- if (error) {
- LOG(("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess));
- free(table);
- return false;
- }
-
- factors.xmul = width;
- factors.ymul = height;
- factors.xdiv = c->width * 2;
- factors.ydiv = c->height * 2;
-
- error = xosspriteop_put_sprite_scaled(osspriteop_PTR,
- area,
- (osspriteop_id)((char*)(c->data.sprite.data) +
- area->first),
- x, (int)(y - height),
- osspriteop_USE_MASK | osspriteop_USE_PALETTE, &factors, table);
- if (error) {
- LOG(("xosspriteop_put_sprite_scaled: 0x%x: %s", error->errnum, error->errmess));
- free(table);
- return false;
- }
-
- xfree(table);
-
- return true;
+ return image_redraw(c->data.sprite.data, x, y, width, height,
+ c->width * 2, c->height * 2, background_colour,
+ false, false, IMAGE_PLOT_OS);
}
#endif
diff --git a/riscos/sprite.h b/riscos/sprite.h
index 422533034..6090adb71 100644
--- a/riscos/sprite.h
+++ b/riscos/sprite.h
@@ -24,5 +24,5 @@ void sprite_destroy(struct content *c);
bool sprite_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
- float scale);
+ float scale, unsigned long background_colour);
#endif
diff --git a/riscos/thumbnail.c b/riscos/thumbnail.c
index 60c412c0f..2c0953113 100644
--- a/riscos/thumbnail.c
+++ b/riscos/thumbnail.c
@@ -105,7 +105,7 @@ void thumbnail_create(struct content *content, osspriteop_area *area,
(osspriteop_header *)(oversampled_area + 1));
if (save_area == NULL) return;
content_redraw(content, 0, height * 2, width * 2, height * 2,
- 0, 0, width * 2, height * 2, scale);
+ 0, 0, width * 2, height * 2, scale, 0xFFFFFF);
thumbnail_restore_output(save_area);
/* Scale back
@@ -152,7 +152,7 @@ void thumbnail_create(struct content *content, osspriteop_area *area,
os_ACTION_OVERWRITE, 0);
os_clg();
content_redraw(content, 0, height * 2, width * 2, height * 2,
- 0, 0, width * 2, height * 2, scale);
+ 0, 0, width * 2, height * 2, scale, 0xFFFFFF);
thumbnail_restore_output(save_area);
}
}
diff --git a/riscos/window.c b/riscos/window.c
index 0d942d478..25fe4cbc7 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -450,7 +450,8 @@ void ro_gui_window_redraw(struct gui_window *g, wimp_draw *redraw)
redraw->clip.y0,
redraw->clip.x1 - 1,
redraw->clip.y1 - 1,
- g->option.scale);
+ g->option.scale,
+ 0xFFFFFF);
}
if (ro_gui_current_redraw_gui->option.buffer_everything) {
ro_gui_buffer_close();
@@ -546,7 +547,8 @@ void gui_window_update_box(struct gui_window *g,
c->width * 2, c->height * 2,
update.clip.x0, update.clip.y0,
update.clip.x1 - 1, update.clip.y1 - 1,
- g->option.scale);
+ g->option.scale,
+ 0xFFFFFF);
} else {
assert(data->redraw.object);
content_redraw(data->redraw.object,
@@ -562,7 +564,8 @@ void gui_window_update_box(struct gui_window *g,
g->option.scale,
update.clip.x0, update.clip.y0,
update.clip.x1 - 1, update.clip.y1 - 1,
- g->option.scale);
+ g->option.scale,
+ 0xFFFFFF);
}
if (use_buffer) ro_gui_buffer_close();