From 006344401cfaedda64387fd59c1626b71cb178d6 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 15 Aug 2004 19:06:24 +0000 Subject: [project @ 2004-08-15 19:06:23 by jmb] Rationalise image redraw. Supply background colour when redrawing contents Reenable printing of background images Require Tinct 0.07 svn path=/import/netsurf/; revision=1234 --- riscos/jpeg.c | 92 ++++------------------------------------------------------- 1 file changed, 5 insertions(+), 87 deletions(-) (limited to 'riscos/jpeg.c') 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 #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); } -- cgit v1.2.3