Commit a42c3c38 authored by Robert Sprowson's avatar Robert Sprowson

Simplify _swix to os_swix.

Function main_icon_bboxes() reordered to only call the SWIs it needs to fulfil the requested information.

Version 2.04. Tagged as 'Paint-2_04'
parent f11f2074
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.03"
Module_Version SETA 203
Module_MajorVersion SETS "2.04"
Module_Version SETA 204
Module_MinorVersion SETS ""
Module_Date SETS "05 Dec 2010"
Module_ApplicationDate SETS "05-Dec-10"
Module_Date SETS "07 Dec 2010"
Module_ApplicationDate SETS "07-Dec-10"
Module_ComponentName SETS "Paint"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Paint"
Module_FullVersion SETS "2.03"
Module_HelpVersion SETS "2.03 (05 Dec 2010)"
Module_FullVersion SETS "2.04"
Module_HelpVersion SETS "2.04 (07 Dec 2010)"
END
/* (2.03)
/* (2.04)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.03
#define Module_MajorVersion_CMHG 2.04
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 05 Dec 2010
#define Module_Date_CMHG 07 Dec 2010
#define Module_MajorVersion "2.03"
#define Module_Version 203
#define Module_MajorVersion "2.04"
#define Module_Version 204
#define Module_MinorVersion ""
#define Module_Date "05 Dec 2010"
#define Module_Date "07 Dec 2010"
#define Module_ApplicationDate "05-Dec-10"
#define Module_ApplicationDate "07-Dec-10"
#define Module_ComponentName "Paint"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Paint"
#define Module_FullVersion "2.03"
#define Module_HelpVersion "2.03 (05 Dec 2010)"
#define Module_LibraryVersionInfo "2:3"
#define Module_FullVersion "2.04"
#define Module_HelpVersion "2.04 (07 Dec 2010)"
#define Module_LibraryVersionInfo "2:4"
This diff is collapsed.
......@@ -879,8 +879,8 @@ static void stop_insdel_graphics (void)
}
static void insdel_drawEOR(main_sprite_window *sprw, int x0, int y0)
{ int xmul = sprw->blobsize.scale_xmul*insdel_sprite->mode.scale_xmul;
{
int xmul = sprw->blobsize.scale_xmul*insdel_sprite->mode.scale_xmul;
int xdiv = sprw->blobsize.scale_xdiv;
int ymul = sprw->blobsize.scale_ymul*insdel_sprite->mode.scale_ymul;
int ydiv = sprw->blobsize.scale_ydiv;
......@@ -987,7 +987,8 @@ static void insdeltool_null (main_window *window, wimp_mousestr *mpos)
static void insdeltool_redraw (main_window *window, int x0, int y0)
{ ftracef0 ("insdeltool_redraw\n");
{
ftracef0 ("insdeltool_redraw\n");
if (window->data->sprite.sprite->needsnull)
insdel_drawEOR(&window->data->sprite, x0, y0);
......@@ -1105,15 +1106,15 @@ static void sprite_palette_has_changed (main_sprite *sprite)
void menus_set_palette (main_sprite *sprite, int entries, int *palette)
/*Note: this routine assumes the palette is the right length for the
sprite.*/
{ BOOL create = palette != NULL;
char *start, *end;
int old_size, new_size, diff;
sprite_area **sarea = &sprite->file->spritearea;
sprite_header *header;
/*Note: this routine assumes the palette is the right length for the
sprite.*/
ftracef1 ("%s palette\n", create? "Create": "Delete");
header = psprite_address (sprite);
......@@ -2223,7 +2224,7 @@ void menus_file_handler (void *handle, char *hit)
window->data->file.filename == NULL?
msgs_lookup ("PntF4"): window->data->file.filename);
dbox_setnumeric (d, d_File_Number, sarea->number);
_swix (OS_ConvertFileSize, _INR(0,2), sarea->size, &sizestring, 32);
os_swix3 (OS_ConvertFileSize, sarea->size, &sizestring, 32);
dbox_setfield (d, d_File_Size, sizestring);
dbox_setfield (d, d_File_Mod, yesno (window->data->file.modified));
dbox_show (d);
......@@ -2245,6 +2246,7 @@ void menus_file_handler (void *handle, char *hit)
BOOL byname = (hit[1] == m_Misc_SBName);
sprite_tosort tosort[count];
sprite_tosort *tosortptr[count];
os_regset regs;
if (count < 2) break; /* Not worth sorting */
......@@ -2268,16 +2270,18 @@ void menus_file_handler (void *handle, char *hit)
count++;
}
if (((int)&tosortptr) & 0xE0000000)
regs.r[0] = count;
regs.r[1] = (int)&tosortptr;
regs.r[2] = byname ? 4 : 2;
if (regs.r[1] & 0xE0000000)
{ /* Too high - give it to HeapSort32 to jiggle the pointers */
if (wimpt_complain (_swix (OS_HeapSort32, _INR(0,2) | _IN(7),
count, &tosortptr, byname ? 4 : 2, 0)))
regs.r[7] = 0;
if (wimpt_complain (os_swix (OS_HeapSort32, &regs)) != NULL)
break;
}
else
{ /* Give it to HeapSort to jiggle the pointers */
if (wimpt_complain (_swix (OS_HeapSort, _INR(0,2),
count, &tosortptr, byname ? 4 : 2)))
if (wimpt_complain (os_swix (OS_HeapSort, &regs)) != NULL)
break;
}
......@@ -2371,8 +2375,8 @@ void menus_file_handler (void *handle, char *hit)
if (window->selection.count==0) break;
visdelay_begin();
for (count = 1, sprite = window->data->file.sprites; sprite != NULL;
sprite = next, count++)
for (count=1, sprite=window->data->file.sprites; sprite != NULL;
sprite = next, count++)
{ visdelay_percent(count*100/total);
next = sprite->link;
if (sprite->flags & MSF_SELECTED)
......@@ -2678,7 +2682,8 @@ static void hack_entry (menu menyoo, int entryno, char *name)
menu menus_file_maker (void *handle)
{ main_window *window =(main_window *) handle;
{
main_window *window =(main_window *) handle;
main_file *file = &window->data->file;
int len;
......
......@@ -421,25 +421,26 @@ main_sprite *psprite_new (int offset, int spriteno, main_file *parent)
static void table_new (void *a0, void *a1, int dmode, int *dpal, int flags,
int *size, char **table)
{ int junk;
ftracef0 ("table_new\n");
os_swi6r (ColourTrans_GenerateTable, a0, a1, dmode, dpal, 0 /*read size*/,
flags, &junk, &junk, &junk, &junk, size, &junk);
ftracef1 ("size %d\n", *size);
if (*size == 0)
{ ftracef0 ("table_new\n");
os_swi6r (ColourTrans_GenerateTable,
a0, a1, dmode, dpal, 0 /*read size*/, flags,
NULL, NULL, NULL, NULL, size, NULL);
ftracef1 ("size %d\n", *size);
if (*size == 0)
*table = NULL;
else
{ if (!flex_alloc ((flex_ptr) table, *size))
{ ftracef0 ("*** failed to find memory\n");
*table = NULL;
else
{ if (!flex_alloc ((flex_ptr) table, *size))
{ ftracef0 ("*** failed to find memory\n");
*table = NULL;
return;
}
return;
}
os_swi6 (ColourTrans_GenerateTable, a0, a1, dmode, dpal, *table,
flags);
}
}
os_swi6 (ColourTrans_GenerateTable, a0, a1, dmode, dpal, *table,
flags);
} }
/*********************************************
* Call the SWI to build a translation table *
*********************************************/
......@@ -1059,13 +1060,13 @@ os_error *psprite_set_plot_info (main_file *file)
int psprite_palsize (main_sprite *sprite)
{ sprite_header *header = psprite_address (sprite);
int size, junk, lb_bpp = bbc_modevar (header->mode, bbc_Log2BPP);
int size, lb_bpp = bbc_modevar (header->mode, bbc_Log2BPP);
/*Find out the palette size*/
if (psprite_haspal (sprite))
os_swi6r (ColourTrans_ReadPalette,
sprite->file->spritearea, header, 0 /*read size*/, 0, 1 << 0 /*sprite
in R1*/, 0, &junk, &junk, &junk, &size, &junk, &junk);
in R1*/, 0, NULL, NULL, NULL, &size, NULL, NULL);
else
size = ENTRIES (lb_bpp)*sizeof (int);
ftracef1 ("psprite_palsize: palette size is %d\n", size);
......@@ -1163,6 +1164,7 @@ os_error *psprite_plot_scaled (int x, int y, main_sprite *sprite,
{ main_scaling_block scaling;
os_error *error;
os_regset regs;
ftracef1 ("psprite_plot_scaled \"%.12s\"\n",
psprite_address (sprite)->name);
......@@ -1182,21 +1184,15 @@ os_error *psprite_plot_scaled (int x, int y, main_sprite *sprite,
scaling.scale_xdiv, scaling.scale_ymul, scaling.scale_ydiv);
ftracef1 ("table at 0x%X\n", sprite->transtab->table);
/*Black*/
error = _swix
( OS_SpriteOp,
_IN(0)|_IN(1)|_IN(2)|_IN(3)|_IN(4)|_IN(5)|_IN(6)|_IN(7),
512 | 52,
sprite->file->spritearea,
psprite_address (sprite),
x, y,
mode | 8 /*use mask if present*/ |
#if 0 /*9th Feb 1995*/
psprite_haspal (sprite) << 4 /*ignore ttab*/ |
#endif
1 << 5 /*ttab is wide*/,
&scaling,
sprite->transtab->table
);
regs.r[0] = 512 | 52;
regs.r[1] = (int)sprite->file->spritearea;
regs.r[2] = (int)psprite_address (sprite);
regs.r[3] = x;
regs.r[4] = y;
regs.r[5] = mode | 8 /*use mask if present*/ | 1 << 5 /*ttab is wide*/;
regs.r[6] = (int)&scaling;
regs.r[7] = (int)sprite->transtab->table;
error = os_swix (OS_SpriteOp, &regs);
ftracef0 ("putting sprite scaled ... done\n");
#ifdef DUMPING
......@@ -1247,6 +1243,7 @@ os_error *psprite_plot_scaled_m (int x, int y, main_sprite *sprite,
{
main_scaling_block scaling;
os_error *error = NULL;
os_regset regs;
int op, flags = 0;
char *table = NULL;
......@@ -1284,10 +1281,16 @@ os_error *psprite_plot_scaled_m (int x, int y, main_sprite *sprite,
ftracef1 ("R7 0x%X\n", table);
ftracef4 ("factors (%d:%d, %d:%d)\n", scaling.scale_xmul,
scaling.scale_xdiv, scaling.scale_ymul, scaling.scale_ydiv);
error = _swix (OS_SpriteOp,
_IN(0)|_IN(1)|_IN(2)|_IN(3)|_IN(4)|_IN(5)|_IN(6)|_IN(7), op,
sprite->file->spritearea, psprite_address (sprite),
x, y, flags, &scaling, table);
regs.r[0] = op;
regs.r[1] = (int)sprite->file->spritearea;
regs.r[2] = (int)psprite_address (sprite);
regs.r[3] = x;
regs.r[4] = y;
regs.r[5] = flags;
regs.r[6] = (int)&scaling;
regs.r[7] = (int)table;
error = os_swix (OS_SpriteOp, &regs);
ftracef0 ("putting sprite scaled ... done\n");
#ifdef DUMPING
......@@ -1311,6 +1314,7 @@ os_error *psprite_plot_scaled_centred (int x, int y, main_sprite *sprite,
{ sprite_info infoblock;
main_scaling_block scaling;
os_error *error = NULL;
os_regset regs;
int op, flags = 0;
char *table = NULL;
......@@ -1354,10 +1358,16 @@ os_error *psprite_plot_scaled_centred (int x, int y, main_sprite *sprite,
ftracef1 ("R7 0x%X\n", table);
ftracef4 ("factors (%d:%d, %d:%d)\n", scaling.scale_xmul,
scaling.scale_xdiv, scaling.scale_ymul, scaling.scale_ydiv);
error = _swix (OS_SpriteOp,
_IN(0)|_IN(1)|_IN(2)|_IN(3)|_IN(4)|_IN(5)|_IN(6)|_IN(7), op,
sprite->file->spritearea, psprite_address (sprite),
x - infoblock.width, y - infoblock.height, flags, &scaling, table);
regs.r[0] = op;
regs.r[1] = (int)sprite->file->spritearea;
regs.r[2] = (int)psprite_address (sprite);
regs.r[3] = x - infoblock.width;
regs.r[4] = y - infoblock.height;
regs.r[5] = flags;
regs.r[6] = (int)&scaling;
regs.r[7] = (int)table;
error = os_swix (OS_SpriteOp, &regs);
ftracef0 ("putting sprite scaled ... done\n");
#ifdef DUMPING
......@@ -1719,7 +1729,7 @@ void psprite_setup_ecf (main_sprite *sprite, int ECF,
if (os_swix4 (OS_SpriteOp, 37 | 0x200 /*create/remove palette*/,
ECFblock->sarea, (int) ECFblock->sarea + sizeof (sprite_area),
1 /*create*/ | 1U << 31) != NULL) main_NO_ROOM ("ECF palette");
_swix (ColourTrans_ReadPalette, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_IN(4),
os_swix5 (ColourTrans_ReadPalette,
sprite->file->spritearea, psprite_address (sprite),
(int) ECFblock->sarea + sizeof (sprite_area) +
sizeof (sprite_header), 8 << (1 << splb_bpp), 1 << 1);
......@@ -1758,6 +1768,7 @@ os_error *psprite_plot_ecf_sprite (main_sprite *sprite, int ECF, int x,
int y)
{ os_error *error;
os_regset regs;
main_scaling_block scaling;
ftracef0 ("psprite_plot_ecf_sprite\n");
......@@ -1767,18 +1778,17 @@ os_error *psprite_plot_ecf_sprite (main_sprite *sprite, int ECF, int x,
ftracef0 ("putting ecf sprite scaled ...\n");
/*bad translation a pain*/
error = _swix
( OS_SpriteOp,
_IN(0)|_IN(1)|_IN(2)|_IN(3)|_IN(4)|_IN(5)|_IN(6)|_IN(7),
512 | 52,
sprite->ECFs [ECF].sarea,
sprite->ECFs [ECF].sarea + 1,
x, y,
psprite_haspal (sprite) << 4 /*use ttab if there is no palette*/ |
1 << 5 /*ttab is wide*/,
&scaling,
sprite->transtab->table
);
regs.r[0] = 512 | 52;
regs.r[1] = (int)sprite->ECFs [ECF].sarea;
regs.r[2] = (int)(sprite->ECFs [ECF].sarea + 1);
regs.r[3] = x;
regs.r[4] = y;
regs.r[5] = psprite_haspal (sprite) << 4 /*use ttab if there is no palette*/ |
1 << 5 /*ttab is wide*/;
regs.r[6] = (int)&scaling;
regs.r[7] = (int)sprite->transtab->table;
error = os_swix (OS_SpriteOp, &regs);
ftracef0 ("putting ecf sprite scaled ... done\n");
#ifdef DUMPING
......@@ -1930,12 +1940,6 @@ void Temporary_Name (sprite_area *sarea, char *name)
}
}
/*FIX A-RO-???? JRC 7 Oct '91: In {rotate,scale,shear}_sprite(), replace
addresses by names in sprite id
blocks; use 'sprite->file->spritearea' instead of 'sarea;' recover from
errors better; remove '#if 0' ... '#endif' blocks; use
sprite_change_size() instead of Change_Size().*/
void psprite_rotate (main_sprite *sprite, int degrees)
{ ftracef0 ("psprite_rotate\n");
......@@ -2790,8 +2794,8 @@ static void Create_Cb (dbox d, void *handle)
static BOOL Grey_Scale (int lb_bpp)
{ int colour_count = 1 << (1 << lb_bpp), palette [256], i, colour;
_kernel_swi_regs swi_regs;
_kernel_oserror *oserror;
os_regset swi_regs;
os_error *oserror;
BOOL incomplete;
/*Given that the current mode is 256 colours or less, is it a grey-scale
......@@ -2804,7 +2808,7 @@ static BOOL Grey_Scale (int lb_bpp)
swi_regs.r [4] = 7 /*read block of palette entries*/;
swi_regs.r [9] = 35 /*PaletteV*/;
if ((oserror = _kernel_swi (OS_CallAVector, &swi_regs, &swi_regs)) != NULL)
if ((oserror = os_swix (OS_CallAVector, &swi_regs)) != NULL)
{ ftracef1 ("error %s\n", oserror->errmess);
return FALSE;
}
......@@ -2825,7 +2829,7 @@ static BOOL Grey_Scale (int lb_bpp)
swi_regs.r [4] = 1 /*read palette entry*/;
swi_regs.r [9] = 35 /*PaletteV*/;
if ((oserror = _kernel_swi (OS_CallAVector, &swi_regs, &swi_regs)) !=
if ((oserror = os_swix (OS_CallAVector, &swi_regs)) !=
NULL)
{ ftracef1 ("error %s\n", oserror->errmess);
return FALSE;
......@@ -2836,16 +2840,11 @@ static BOOL Grey_Scale (int lb_bpp)
if (incomplete)
{ /*Resort to OS_ReadPalette*/
swi_regs.r [0] = i;
swi_regs.r [1] = 17;
if ((oserror = _kernel_swi (OS_ReadPalette, &swi_regs, &swi_regs)) !=
if ((oserror = os_swix3r (OS_ReadPalette, i, 17, 0, NULL, NULL, &colour)) !=
NULL)
{ ftracef1 ("error %s\n", oserror->errmess);
return FALSE;
}
colour = swi_regs.r [2];
}
if ((colour ^ colour << 8) >> 16 != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment