+ ADD R13,R13,#24 ;Recover the matrix block
+ LDMFD R13!,{R7,R14} ;Unstack R7 and link register
+ B draw__next ;And render the next object
+
+; --- draw__renderJPEG ----
+
+draw__renderJPEG ROUT
+
+ ; --- Make sure I have to render it ---
+
+ STMFD R13!,{R14} ;Save the link temporarily
+ BL draw__clip ;Do we have to render it?
+ BLCS rov_version ;Get the current OS version
+ CMPCS R0,#360 ;Is it RISC OS 3.60 yet?
+ LDMCCFD R13!,{R14} ;Restore the link again
+ BCC draw__next ;No -- then return
+
+ ; --- Build the transformation matrix ---
+
+ ADD R14,R7,#40 ;Find the transform matrix
+ LDR R6,[R10,#0] ;Load the scale factor
+ LDMIA R14,{R0-R5} ;Load all the bits I need
+ MOV R6,R6,LSR #8 ;Shift scale factor down
+ MOV R0,R0,ASR #8 ;Also shift down JPEG scale
+ MOV R1,R1,ASR #8 ;Also shift down JPEG scale
+ MOV R2,R2,ASR #8 ;Also shift down JPEG scale
+ MOV R3,R3,ASR #8 ;Also shift down JPEG scale
+ MUL R0,R6,R0 ;Apply scale to JPEG matrix
+ MUL R1,R6,R1 ;Apply scale to JPEG matrix
+ MUL R2,R6,R2 ;Apply scale to JPEG matrix
+ MUL R3,R6,R3 ;Apply scale to JPEG matrix
+ SUB R13,R13,#24 ;Make space for matrix
+ STMIA R13,{R0-R3} ;Save transform on stack
+ ADD R14,R10,#16 ;Point to my offsets
+ LDMIA R14,{R0,R1} ;Load the offsets out
+ MUL R4,R6,R4 ;Scale the JPEG x offset
+ MUL R5,R6,R5 ;Scale the JPEG y offset
+ ADD R4,R0,R4,ASR #8 ;Add on to original offset
+ ADD R5,R1,R5,ASR #8 ;Add on to original offset
+ ADD R14,R13,#16 ;Point to bit of matrix
+ STMIA R14,{R4,R5} ;Save these in the matrix
+
+ ; --- Now plot the JPEG in the right place ---
+
+ ADD R0,R7,#68 ;Point to the JPEG def
+ MOV R1,#2 ;R2 points to a matrix, dither
+ MOV R2,R13 ;Point to my matrix
+ LDR R3,[R0,#-4] ;Load length of JPEG
+ SWI JPEG_PlotTransformed ;Plot the JPEG