[project @ 2003-06-14 11:34:02 by bursa]

Scale JPEGs and PNGs when plotting.

svn path=/import/netsurf/; revision=179
This commit is contained in:
James Bursa 2003-06-14 11:34:02 +00:00
parent bdad21d51c
commit ce6dbbb5db
3 changed files with 18 additions and 8 deletions

View File

@ -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" #include "netsurf/desktop/options.h"
@ -903,7 +903,7 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw)
content_redraw(c, content_redraw(c,
(int) redraw->box.x0 - (int) redraw->xscroll, (int) redraw->box.x0 - (int) redraw->xscroll,
(int) redraw->box.y1 - (int) redraw->yscroll - (int) c->height * 2, (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); more = wimp_get_rectangle(redraw);
} }

View File

@ -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 * This is just a temporary implementation using the JPEG renderer
* available in some versions of RISC OS. * 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, void jpeg_redraw(struct content *c, long x, long y,
unsigned long width, unsigned long height) 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, 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); jpeg_SCALE_DITHERED);
} }

View File

@ -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 <assert.h> #include <assert.h>
@ -283,9 +283,9 @@ void nspng_destroy(struct content *c)
void nspng_redraw(struct content *c, long x, long y, void nspng_redraw(struct content *c, long x, long y,
unsigned long width, unsigned long height) unsigned long width, unsigned long height)
{ {
/* TODO: scale to width, height */
int size; int size;
osspriteop_trans_tab *table; osspriteop_trans_tab *table;
os_factors factors;
xcolourtrans_generate_table_for_sprite(c->data.png.sprite_area, xcolourtrans_generate_table_for_sprite(c->data.png.sprite_area,
(osspriteop_id) (c->data.png.sprite_area + 1), (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, colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE,
table, colourtrans_GIVEN_SPRITE, 0, 0, 0); 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, xosspriteop_put_sprite_scaled(osspriteop_PTR,
c->data.png.sprite_area, c->data.png.sprite_area,
(osspriteop_id) (c->data.png.sprite_area + 1), (osspriteop_id) (c->data.png.sprite_area + 1),
x, y, 0, 0, table); x, y, os_ACTION_OVERWRITE, &factors, table);
xfree(table); xfree(table);
} }