summaryrefslogtreecommitdiff
path: root/frontends/riscos/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/riscos/image.c')
-rw-r--r--frontends/riscos/image.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/frontends/riscos/image.c b/frontends/riscos/image.c
index 0bad94810..5c90b05ba 100644
--- a/frontends/riscos/image.c
+++ b/frontends/riscos/image.c
@@ -27,6 +27,7 @@
#include "riscos/image.h"
#include "riscos/gui.h"
+#include "riscos/wimp.h"
#include "riscos/tinct.h"
/**
@@ -65,11 +66,11 @@ static bool image_redraw_tinct(osspriteop_id header, int x, int y,
if (alpha) {
error = _swix(Tinct_PlotScaledAlpha, _INR(2,7),
- header, x, y - req_height,
+ header, x, y,
req_width, req_height, tinct_options);
} else {
error = _swix(Tinct_PlotScaled, _INR(2,7),
- header, x, y - req_height,
+ header, x, y,
req_width, req_height, tinct_options);
}
@@ -144,13 +145,11 @@ static bool image_redraw_os(osspriteop_id header, int x, int y, int req_width,
if (tile) {
error = xosspriteop_plot_tiled_sprite(osspriteop_PTR,
- osspriteop_UNSPECIFIED, header,
- x, (int)(y - req_height),
+ osspriteop_UNSPECIFIED, header, x, y,
osspriteop_USE_MASK, &f, table);
} else {
error = xosspriteop_put_sprite_scaled(osspriteop_PTR,
- osspriteop_UNSPECIFIED, header,
- x, (int)(y - req_height),
+ osspriteop_UNSPECIFIED, header, x, y,
osspriteop_USE_MASK, &f, table);
}
if (error) {
@@ -173,17 +172,19 @@ static bool image_redraw_os(osspriteop_id header, int x, int y, int req_width,
* Only replaces mode if existing mode matches \ref old.
*
* \param[in] area The sprite area containing the sprite.
+ * \param[in] type Requested plot mode.
* \param[in] old Existing sprite mode to check for.
* \param[in] new Sprite mode to set if existing mode is expected.
*/
static inline void image__override_sprite_mode(
osspriteop_area *area,
+ image_type type,
os_mode old,
os_mode new)
{
osspriteop_header *sprite = (osspriteop_header *)(area + 1);
- if (sprite->mode == old) {
+ if (sprite->mode == old && type == IMAGE_PLOT_TINCT_ALPHA) {
sprite->mode = new;
}
}
@@ -210,6 +211,7 @@ bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
colour background_colour,
bool repeatx, bool repeaty, bool background, image_type type)
{
+ image_type used_type = type;
unsigned int tinct_options;
bool tinct_avoid = false;
bool res = false;
@@ -220,10 +222,13 @@ bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
osspriteop_id header = (osspriteop_id)
((char*) area + area->first);
+
req_width *= 2;
req_height *= 2;
width *= 2;
height *= 2;
+ y -= req_height;
+
tinct_options = background ? nsoption_int(plot_bg_quality) :
nsoption_int(plot_fg_quality);
@@ -234,12 +239,24 @@ bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
* is that we lose the optimisation for tiling tiny bitmaps.
*/
if (tinct_options & tinct_USE_OS_SPRITE_OP) {
- type = IMAGE_PLOT_OS;
+ used_type = IMAGE_PLOT_OS;
tinct_avoid = true;
}
}
- switch (type) {
+ if (tinct_avoid) {
+ int xeig;
+ int yeig;
+
+ if (ro_gui_wimp_read_eig_factors(os_CURRENT_MODE,
+ &xeig, &yeig)) {
+
+ req_width = (req_width / 2) * (4 >> xeig);
+ req_height = (req_height / 2) * (4 >> yeig);
+ }
+ }
+
+ switch (used_type) {
case IMAGE_PLOT_TINCT_ALPHA:
res = image_redraw_tinct(header, x, y,
req_width, req_height,
@@ -260,7 +277,7 @@ bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
case IMAGE_PLOT_OS:
if (tinct_avoid) {
- image__override_sprite_mode(area,
+ image__override_sprite_mode(area, type,
tinct_SPRITE_MODE,
alpha_SPRITE_MODE);
}
@@ -268,7 +285,7 @@ bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
req_height, width, height,
repeatx | repeaty);
if (tinct_avoid) {
- image__override_sprite_mode(area,
+ image__override_sprite_mode(area, type,
alpha_SPRITE_MODE,
tinct_SPRITE_MODE);
}