summaryrefslogtreecommitdiff
path: root/riscos/png.c
diff options
context:
space:
mode:
Diffstat (limited to 'riscos/png.c')
-rw-r--r--riscos/png.c91
1 files changed, 5 insertions, 86 deletions
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