summaryrefslogtreecommitdiff
path: root/frontends/riscos/content-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/riscos/content-handlers')
-rw-r--r--frontends/riscos/content-handlers/artworks.c57
-rw-r--r--frontends/riscos/content-handlers/awrender.s82
-rw-r--r--frontends/riscos/content-handlers/draw.c13
-rw-r--r--frontends/riscos/content-handlers/sprite.c15
4 files changed, 111 insertions, 56 deletions
diff --git a/frontends/riscos/content-handlers/artworks.c b/frontends/riscos/content-handlers/artworks.c
index 8ec4edcae..c107ec6b4 100644
--- a/frontends/riscos/content-handlers/artworks.c
+++ b/frontends/riscos/content-handlers/artworks.c
@@ -38,7 +38,9 @@
#include "utils/utils.h"
#include "netsurf/plotters.h"
#include "netsurf/content.h"
+#include "content/content.h"
#include "content/content_protected.h"
+#include "content/content_factory.h"
#include "content/llcache.h"
#include "riscos/content-handlers/artworks.h"
@@ -91,7 +93,7 @@ struct awinfo_block {
/* Assembler routines for interfacing with the ArtworksRenderer module */
extern os_error *awrender_init(const char **doc,
- unsigned long *doc_size,
+ size_t *doc_size,
void *routine,
void *workspace);
@@ -170,8 +172,8 @@ bool artworks_convert(struct content *c)
{
artworks_content *aw = (artworks_content *) c;
union content_msg_data msg_data;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
void *init_workspace;
void *init_routine;
os_error *error;
@@ -184,7 +186,8 @@ bool artworks_convert(struct content *c)
&used, NULL, NULL);
if (used >= 0) {
NSLOG(netsurf, INFO, "Alias$LoadArtWorksModules not defined");
- msg_data.error = messages_get("AWNotSeen");
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = messages_get("AWNotSeen");
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -194,7 +197,8 @@ bool artworks_convert(struct content *c)
if (error) {
NSLOG(netsurf, INFO, "xos_cli: 0x%x: %s", error->errnum,
error->errmess);
- msg_data.error = error->errmess;
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -205,7 +209,8 @@ bool artworks_convert(struct content *c)
if (error) {
NSLOG(netsurf, INFO, "AWRender_FileInitAddress: 0x%x: %s",
error->errnum, error->errmess);
- msg_data.error = error->errmess;
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -216,7 +221,8 @@ bool artworks_convert(struct content *c)
if (error) {
NSLOG(netsurf, INFO, "AWRender_RenderAddress: 0x%x: %s",
error->errnum, error->errmess);
- msg_data.error = error->errmess;
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -224,12 +230,13 @@ bool artworks_convert(struct content *c)
source_data = content__get_source_data(c, &source_size);
/* initialise (convert file to new format if required) */
- error = awrender_init(&source_data, &source_size,
+ error = awrender_init((const char **)&source_data, &source_size,
init_routine, init_workspace);
if (error) {
NSLOG(netsurf, INFO, "awrender_init: 0x%x : %s",
error->errnum, error->errmess);
- msg_data.error = error->errmess;
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -245,7 +252,8 @@ bool artworks_convert(struct content *c)
if (error) {
NSLOG(netsurf, INFO, "AWRender_DocBounds: 0x%x: %s",
error->errnum, error->errmess);
- msg_data.error = error->errmess;
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -261,7 +269,8 @@ bool artworks_convert(struct content *c)
if (!aw->block) {
NSLOG(netsurf, INFO,
"failed to create block for ArtworksRenderer");
- msg_data.error = messages_get("NoMemory");
+ msg_data.errordata.errorcode = NSERROR_NOMEM;
+ msg_data.errordata.errormsg = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -313,8 +322,8 @@ bool artworks_redraw(struct content *c, struct content_redraw_data *data,
};
artworks_content *aw = (artworks_content *) c;
struct awinfo_block info;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
os_error *error;
os_trfm matrix;
int vals[24];
@@ -389,17 +398,17 @@ bool artworks_redraw(struct content *c, struct content_redraw_data *data,
source_data = content__get_source_data(c, &source_size);
- error = awrender_render(source_data,
- &info,
- &matrix,
- vals,
- &aw->block,
- &aw->size,
- 110, /* fully anti-aliased */
- 0,
- source_size,
- aw->render_routine,
- aw->render_workspace);
+ error = awrender_render((const char *)source_data,
+ &info,
+ &matrix,
+ vals,
+ &aw->block,
+ &aw->size,
+ 110, /* fully anti-aliased */
+ 0,
+ source_size,
+ aw->render_routine,
+ aw->render_workspace);
if (error) {
NSLOG(netsurf, INFO, "awrender_render: 0x%x: %s",
diff --git a/frontends/riscos/content-handlers/awrender.s b/frontends/riscos/content-handlers/awrender.s
index 5bcafe520..fe37f66fb 100644
--- a/frontends/riscos/content-handlers/awrender.s
+++ b/frontends/riscos/content-handlers/awrender.s
@@ -209,12 +209,18 @@ errblk % 256
@ os_error *awrender_init(byte **doc, size_t *doc_size, void *init_routine, void *init_workspace);
.global awrender_init
-awrender_init: MOV ip,sp
+awrender_init:
+#ifndef __ARM_EABI__
+ MOV ip,sp
STMFD sp!,{a1,a2,v1,v2,fp,ip,lr,pc}
SUB fp,ip,#4
SUB ip,sp,#512
CMP ip,sl
BLMI __rt_stkovf_split_big
+#else
+ STMFD sp!,{a1,a2,v1,v2,fp,lr}
+ ADD fp,sp,#4*4
+#endif
LDR v2,=aw_temp
LDR a1,[a1]
@@ -235,14 +241,18 @@ awrender_init: MOV ip,sp
@ return updated block ptr & size to caller
- LDR a2,[fp,#-28]
- LDR a3,[fp,#-24]
+ LDR a2,[sp],#4
+ LDR a3,[sp],#4
LDR ip,[v2,#aw_rsz_block]
LDR lr,[v2,#aw_rsz_size]
STR ip,[a2]
STR lr,[a3]
- LDMEA fp,{v1,v2,fp,sp,pc}
+#ifndef __ARM_EABI__
+ LDMDB fp,{v1,v2,fp,sp,pc}
+#else
+ LDMIA sp!,{v1,v2,fp,pc}
+#endif
@ os_error *awrender_render(const char *doc,
@@ -258,37 +268,46 @@ awrender_init: MOV ip,sp
@ void *workspace);
.global awrender_render
-awrender_render: MOV ip,sp
- STMFD sp!,{v1-v4,fp,ip,lr,pc}
+awrender_render:
+#ifndef __ARM_EABI__
+ MOV ip,sp
+ STMFD sp!,{v1-v6,fp,ip,lr,pc}
SUB fp,ip,#4
SUB ip,sp,#512
CMP ip,sl
BLMI __rt_stkovf_split_big
+ ADD ip,fp,#4 @ ip -> stacked args
+#else
+ MOV ip,sp @ ip -> stacked args
+ STMFD sp!,{v1-v6,fp,lr}
+ ADD fp,sp,#6*4
+#endif
- LDR R12,[fp,#20]
LDR R14,=aw_temp
- LDR R5,[fp,#4]
- LDR R6,[fp,#12]
+ LDR R5,[ip,#0] @ rsz_block
+ LDR R6,[ip,#8] @ wysiwyg_setting
LDR R4,[R5] @ resizable block
- LDR R7,[fp,#16]
+ LDR R7,[ip,#12] @ output_dest
+ LDR R8,[ip,#16] @ doc_size
+ LDR R9,[ip,#4] @ rsz_size
STR R4,[R14,#aw_rsz_block]
STR R0,[R14,#aw_fixed_block] @ document ptr
- STR R12,[R14,#aw_fixed_size] @ document size
- LDR R12,[fp,#8]
+ STR R8,[R14,#aw_fixed_size] @ document size
STR R5,[sp,#-4]! @ ptr to receive block
- STR R12,[sp,#-4]! @ ptr to receive size
+ STR R9,[sp,#-4]! @ ptr to receive size
- LDR R12,[R12]
+ LDR R9,[R9]
ADR R5,aw_callback
- STR R12,[R14,#aw_rsz_size]
+ STR R9,[R14,#aw_rsz_size]
STR sl,[R14,#aw_sl]
STR fp,[R14,#aw_fp]
- LDR R12,[fp,#28]
+ LDR R8,[ip,#20] @ routine
+ LDR R12,[ip,#24] @ workspace
MOV lr,pc
- LDR pc,[fp,#24]
+ MOV pc,R8
MOVVC a1,#0
@ return updated block ptr & size to caller
@@ -301,7 +320,11 @@ awrender_render: MOV ip,sp
STR R5,[R12]
STR R6,[R4]
- LDMEA fp,{v1-v4,fp,sp,pc}
+#ifndef __ARM_EABI__
+ LDMDB fp,{v1-v6,fp,sp,pc}
+#else
+ LDMIA sp!,{v1-v6,fp,pc}
+#endif
@ Callback routine for block resizing
@@ -340,11 +363,18 @@ aw_callback: TEQ R11,#3
CMP R1,R2
BLS aw_read
- STMFD R13!,{R1,R10-R12,R14}
+ STMFD R13!,{R1,R4,R10-R12,R14}
+#ifdef __ARM_EABI__
+ MOV R4,R13 @ save original sp
+ BIC R13,R13,#7 @ align to multiple of 8
+#endif
LDR sl,[R11,#aw_sl]
LDR fp,[R11,#aw_fp]
BL realloc
- LDMFD R13!,{R1,R10-R12,R14}
+#ifdef __ARM_EABI__
+ MOV R13,R4 @ restore unaligned sp
+#endif
+ LDMFD R13!,{R1,R4,R10-R12,R14}
CMP R0,#0 @ did it work?
BEQ aw_nomem
@@ -359,7 +389,11 @@ aw_read: @ return details of fixed block
SUBS R11,R11,R11 @ clear V
MOV PC,R14
-aw_nomem: STMFD R13!,{R10,R12,R14}
+aw_nomem: STMFD R13!,{R4,R10,R12,R14}
+#ifdef __ARM_EABI__
+ MOV R4,R13 @ save original sp
+ BIC R13,R13,#7 @ align to multiple of 8
+#endif
LDR sl,[R11,#aw_sl]
LDR fp,[R11,#aw_fp]
ADR R0,tok_nomem
@@ -370,13 +404,17 @@ aw_nomem: STMFD R13!,{R10,R12,R14}
SUB R0,R0,#4 @ error number already 0
MOV R11,#0 @ restore reason code
CMP PC,#1<<31 @ set V
- LDMFD R13!,{R10,R12,PC}
+#ifdef __ARM_EABI__
+ MOV R13,R4 @ restore original sp
+#endif
+ LDMFD R13!,{R4,R10,R12,PC}
tok_nomem: .asciz "NoMemory"
.align
.bss
+ .align
aw_temp: .space sizeof_aw
.type aw_temp, %object
.size aw_temp, . - aw_temp
diff --git a/frontends/riscos/content-handlers/draw.c b/frontends/riscos/content-handlers/draw.c
index bb66f9dbb..522d5d3fe 100644
--- a/frontends/riscos/content-handlers/draw.c
+++ b/frontends/riscos/content-handlers/draw.c
@@ -35,7 +35,9 @@
#include "utils/utils.h"
#include "netsurf/plotters.h"
#include "netsurf/content.h"
+#include "content/content.h"
#include "content/content_protected.h"
+#include "content/content_factory.h"
#include "content/llcache.h"
#include "riscos/content-handlers/draw.h"
@@ -112,8 +114,8 @@ bool draw_convert(struct content *c)
{
draw_content *draw = (draw_content *) c;
union content_msg_data msg_data;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
const void *data;
os_box bbox;
os_error *error;
@@ -128,7 +130,8 @@ bool draw_convert(struct content *c)
if (error) {
NSLOG(netsurf, INFO, "xdrawfile_bbox: 0x%x: %s",
error->errnum, error->errmess);
- msg_data.error = error->errmess;
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -180,8 +183,8 @@ bool draw_redraw(struct content *c, struct content_redraw_data *data,
{
draw_content *draw = (draw_content *) c;
os_trfm matrix;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
const void *src_data;
os_error *error;
diff --git a/frontends/riscos/content-handlers/sprite.c b/frontends/riscos/content-handlers/sprite.c
index 3556aa555..f6ab68451 100644
--- a/frontends/riscos/content-handlers/sprite.c
+++ b/frontends/riscos/content-handlers/sprite.c
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Content for image/x-riscos-sprite (RISC OS implementation).
*
* No conversion is necessary: we can render RISC OS sprites directly under
@@ -35,7 +36,9 @@
#include "netsurf/plotters.h"
#include "netsurf/content.h"
#include "content/llcache.h"
+#include "content/content.h"
#include "content/content_protected.h"
+#include "content/content_factory.h"
#include "riscos/gui.h"
#include "riscos/image.h"
@@ -112,8 +115,8 @@ bool sprite_convert(struct content *c)
os_error *error;
int w, h;
union content_msg_data msg_data;
- const char *source_data;
- unsigned long source_size;
+ const uint8_t *source_data;
+ size_t source_size;
const void *sprite_data;
char *title;
@@ -125,7 +128,8 @@ bool sprite_convert(struct content *c)
/* check for bad data */
if ((int)source_size + 4 != area->used) {
- msg_data.error = messages_get("BadSprite");
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = messages_get("BadSprite");
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -139,7 +143,8 @@ bool sprite_convert(struct content *c)
"xosspriteop_read_sprite_info: 0x%x: %s",
error->errnum,
error->errmess);
- msg_data.error = error->errmess;
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}