From ce6dbbb5db1d4ffe77ca99411ddb2d19694eff9c Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sat, 14 Jun 2003 11:34:02 +0000 Subject: [project @ 2003-06-14 11:34:02 by bursa] Scale JPEGs and PNGs when plotting. svn path=/import/netsurf/; revision=179 --- riscos/gui.c | 4 ++-- riscos/jpeg.c | 11 ++++++++--- riscos/png.c | 11 ++++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) (limited to 'riscos') diff --git a/riscos/gui.c b/riscos/gui.c index ac6efda03..c0ca96be9 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -1,5 +1,5 @@ /** - * $Id: gui.c,v 1.31 2003/06/08 04:00:05 jmb Exp $ + * $Id: gui.c,v 1.32 2003/06/14 11:34:02 bursa Exp $ */ #include "netsurf/desktop/options.h" @@ -903,7 +903,7 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw) content_redraw(c, (int) redraw->box.x0 - (int) redraw->xscroll, (int) redraw->box.y1 - (int) redraw->yscroll - (int) c->height * 2, - c->width, c->height); + c->width * 2, c->height * 2); } more = wimp_get_rectangle(redraw); } diff --git a/riscos/jpeg.c b/riscos/jpeg.c index 090f36cf4..f3f939551 100644 --- a/riscos/jpeg.c +++ b/riscos/jpeg.c @@ -1,5 +1,5 @@ /** - * $Id: jpeg.c,v 1.4 2003/05/10 11:13:34 bursa Exp $ + * $Id: jpeg.c,v 1.5 2003/06/14 11:34:02 bursa Exp $ * * This is just a temporary implementation using the JPEG renderer * available in some versions of RISC OS. @@ -66,9 +66,14 @@ void jpeg_destroy(struct content *c) void jpeg_redraw(struct content *c, long x, long y, unsigned long width, unsigned long height) { - /* TODO: scale to width, height */ + os_factors factors; + factors.xmul = width; + factors.ymul = height; + factors.xdiv = c->width * 2; + factors.ydiv = c->height * 2; + xjpeg_plot_scaled((jpeg_image *) c->data.jpeg.data, - x, y, 0, (int) c->data.jpeg.length, + x, y, &factors, (int) c->data.jpeg.length, jpeg_SCALE_DITHERED); } diff --git a/riscos/png.c b/riscos/png.c index 63e26c89e..b3d174d05 100644 --- a/riscos/png.c +++ b/riscos/png.c @@ -1,5 +1,5 @@ /** - * $Id: png.c,v 1.2 2003/06/05 14:24:58 bursa Exp $ + * $Id: png.c,v 1.3 2003/06/14 11:34:02 bursa Exp $ */ #include @@ -283,9 +283,9 @@ void nspng_destroy(struct content *c) void nspng_redraw(struct content *c, long x, long y, unsigned long width, unsigned long height) { - /* TODO: scale to width, height */ int size; osspriteop_trans_tab *table; + os_factors factors; xcolourtrans_generate_table_for_sprite(c->data.png.sprite_area, (osspriteop_id) (c->data.png.sprite_area + 1), @@ -297,10 +297,15 @@ void nspng_redraw(struct content *c, long x, long y, colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE, table, colourtrans_GIVEN_SPRITE, 0, 0, 0); + factors.xmul = width; + factors.ymul = height; + factors.xdiv = c->width * 2; + factors.ydiv = c->height * 2; + xosspriteop_put_sprite_scaled(osspriteop_PTR, c->data.png.sprite_area, (osspriteop_id) (c->data.png.sprite_area + 1), - x, y, 0, 0, table); + x, y, os_ACTION_OVERWRITE, &factors, table); xfree(table); } -- cgit v1.2.3