summaryrefslogtreecommitdiff
path: root/riscos/mng.c
diff options
context:
space:
mode:
Diffstat (limited to 'riscos/mng.c')
-rw-r--r--riscos/mng.c93
1 files changed, 9 insertions, 84 deletions
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;
}
/**