summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
Diffstat (limited to 'riscos')
-rw-r--r--riscos/buffer.c53
-rw-r--r--riscos/plotters.c23
2 files changed, 29 insertions, 47 deletions
diff --git a/riscos/buffer.c b/riscos/buffer.c
index ea14444dc..9db162cd5 100644
--- a/riscos/buffer.c
+++ b/riscos/buffer.c
@@ -15,6 +15,7 @@
#include "oslib/wimp.h"
#include "oslib/wimpreadsysinfo.h"
#include "netsurf/riscos/buffer.h"
+#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/options.h"
#include "netsurf/riscos/tinct.h"
#include "netsurf/riscos/wimp.h"
@@ -23,23 +24,6 @@
#define BUFFER_EXCLUSIVE_USER_REDRAW "Only support pure user redraw (faster)"
//#define BUFFER_EMULATE_32BPP "Redirect to a 32bpp sprite and plot with Tinct"
-/* SCREEN BUFFERING
- ================
-
- Because RISC OS provides no native way for windows to be buffered (ie
- the contents is only updated when the task has finished doing any
- drawing) certain situation cause the window contents to flicker in an
- undesirable manner. Examples of this are GIF and MNG animations, and
- web pages with fixed backgrounds.
-
- To overcome this, a very simple, transparent, interface is provided here
- to allow for output to be buffered. It should be noted that screen
- buffering can lower the perceived client response time as the user is
- unable to see that the application is doing anything.
-
- [rjw] - Mon 19th July 2004
-*/
-
static void ro_gui_buffer_free(void);
@@ -63,14 +47,18 @@ static osspriteop_save_area *context3;
*/
static os_mode mode;
+
/**
* Opens a buffer for writing to.
*
+ * The ro_plot_origin_ variables are updated to reflect the new screen origin,
+ * so the variables should be set before calling this function, and not
+ * changed until after ro_gui_buffer_close() has been called.
+ *
* \param redraw the current WIMP redraw area to buffer
*/
void ro_gui_buffer_open(wimp_draw *redraw) {
int size;
- int orig_x0, orig_y0;
int total_size;
os_coord sprite_size;
int bpp, word_width;
@@ -90,6 +78,19 @@ void ro_gui_buffer_open(wimp_draw *redraw) {
*/
clipping = redraw->clip;
+ /* Stop bad rectangles
+ */
+ LOG(("Clipping rectangle (%i, %i) to (%i,%i)",
+ clipping.x0, clipping.y0,
+ clipping.x1, clipping.y1));
+ if ((clipping.x1 < clipping.x0) ||
+ (clipping.y1 < clipping.y0)) {
+ LOG(("Invalid clipping rectangle (%i, %i) to (%i,%i)",
+ clipping.x0, clipping.y0,
+ clipping.x1, clipping.y1));
+ return;
+ }
+
/* Work out how much buffer we need
*/
sprite_size.x = clipping.x1 - clipping.x0 + 1;
@@ -98,7 +99,6 @@ void ro_gui_buffer_open(wimp_draw *redraw) {
if (sprite_size.y == 1) /* work around SpriteExtend bug */
sprite_size.y = 2;
-
#ifdef BUFFER_EMULATE_32BPP
bpp = 5;
palette = false;
@@ -119,6 +119,7 @@ void ro_gui_buffer_open(wimp_draw *redraw) {
buffer = (osspriteop_area *)malloc(total_size);
if (!buffer) {
LOG(("Failed to allocate memory"));
+ ro_gui_buffer_free();
return;
}
buffer->size = total_size;
@@ -200,15 +201,11 @@ void ro_gui_buffer_open(wimp_draw *redraw) {
return;
}
- /* Move the origin such that (x0, y0) becomes (0, 0). To do this
- we use VDU 29,(1 << 16) - x0; (1 << 16) - y0; because RISC OS
- is so insanely legacy driven.
+ /* Emulate an origin as the FontManager doesn't respect it in
+ most cases.
*/
- orig_x0 = (1 << 16) - clipping.x0;
- orig_y0 = (1 << 16) - clipping.y0;
- os_writec((char)29);
- os_writec(orig_x0 & 0xff); os_writec(orig_x0 >> 8);
- os_writec(orig_y0 & 0xff); os_writec(orig_y0 >> 8);
+ ro_plot_origin_x -= clipping.x0;
+ ro_plot_origin_y -= clipping.y0;
}
@@ -224,6 +221,8 @@ void ro_gui_buffer_close(void) {
/* Remove any previous redirection
*/
+ ro_plot_origin_x -= clipping.x0;
+ ro_plot_origin_y -= clipping.y0;
xosspriteop_switch_output_to_sprite(osspriteop_PTR,
context1, context2, context3,
0, 0, 0, 0);
diff --git a/riscos/plotters.c b/riscos/plotters.c
index dad6b74e4..a017c12c8 100644
--- a/riscos/plotters.c
+++ b/riscos/plotters.c
@@ -299,10 +299,6 @@ bool ro_plot_clip(int clip_x0, int clip_y0,
bool ro_plot_text(int x, int y, struct css_style *style,
const char *text, size_t length, colour bg, colour c)
{
- const os_VDU_VAR_LIST(3) var_list = { { os_VDUVAR_ORGX, os_VDUVAR_ORGY,
- os_VDUVAR_END_LIST } };
- int value_list[3];
- int dx = 0, dy = 0;
os_error *error;
error = xcolourtrans_set_font_colours(font_CURRENT,
@@ -312,23 +308,10 @@ bool ro_plot_text(int x, int y, struct css_style *style,
error->errnum, error->errmess));
return false;
}
-
- /* adjust by the origin (not if printing as the result is undefined) */
- if (!print_active) {
- error = xos_read_vdu_variables((const os_vdu_var_list *)
- &var_list, value_list);
- if (error) {
- LOG(("xos_read_vdu_variables: 0x%x: %s",
- error->errnum, error->errmess));
- return false;
- }
- dx = value_list[0];
- dy = value_list[1];
- }
-
+
return nsfont_paint(style, text, length,
- ro_plot_origin_x + dx + x * 2,
- ro_plot_origin_y + dy - y * 2,
+ ro_plot_origin_x + x * 2,
+ ro_plot_origin_y - y * 2,
ro_plot_scale);
}