Commit 6e3eb1c1 authored by ROOL's avatar ROOL 🤖

Add 4k and 64k new sprite selector

Detail:
  Put in minimal support to create 4k and 64k sprites (currently, TBGR only) so that the User Guide chapter makes sense.
  Previously it was only possible to create such sprites by switching to that mode and doing a screen capture.
Admin:
  Tested on RISC OS 4.02 (ie. without 4k & 64k support) and RISC OS 5.23 (ie. with).

Version 2.22. Tagged as 'Paint-2_22'
parent 205da1f5
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.21"
Module_Version SETA 221
Module_MajorVersion SETS "2.22"
Module_Version SETA 222
Module_MinorVersion SETS ""
Module_Date SETS "20 May 2017"
Module_ApplicationDate SETS "20-May-17"
Module_Date SETS "23 Sep 2017"
Module_ApplicationDate SETS "23-Sep-17"
Module_ComponentName SETS "Paint"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Paint"
Module_FullVersion SETS "2.21"
Module_HelpVersion SETS "2.21 (20 May 2017)"
Module_FullVersion SETS "2.22"
Module_HelpVersion SETS "2.22 (23 Sep 2017)"
END
/* (2.21)
/* (2.22)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.21
#define Module_MajorVersion_CMHG 2.22
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 20 May 2017
#define Module_Date_CMHG 23 Sep 2017
#define Module_MajorVersion "2.21"
#define Module_Version 221
#define Module_MajorVersion "2.22"
#define Module_Version 222
#define Module_MinorVersion ""
#define Module_Date "20 May 2017"
#define Module_Date "23 Sep 2017"
#define Module_ApplicationDate "20-May-17"
#define Module_ApplicationDate "23-Sep-17"
#define Module_ComponentName "Paint"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Paint"
#define Module_FullVersion "2.21"
#define Module_HelpVersion "2.21 (20 May 2017)"
#define Module_LibraryVersionInfo "2:21"
#define Module_FullVersion "2.22"
#define Module_HelpVersion "2.22 (23 Sep 2017)"
#define Module_LibraryVersionInfo "2:22"
......@@ -2497,7 +2497,7 @@ static void Decode (int *lb_bpp_out, unsigned int *mode_out)
{ wimp_which_block which_block;
wimp_i results [7]; /*only 2 would be needed if function keys couldn't
wierdly set multiple icons in the same E S G*/
int x_eig = 0, y_eig = 0, lb_bpp = 0;
int x_eig = 0, y_eig = 0, lb_bpp = 0, cols = 0;
unsigned int mode;
ftracef0 ("Decode\n");
......@@ -2512,7 +2512,9 @@ static void Decode (int *lb_bpp_out, unsigned int *mode_out)
case d_Create_Colours_4: lb_bpp = 1; break;
case d_Create_Colours_16: lb_bpp = 2; break;
case d_Create_Colours_256: lb_bpp = 3; break;
case d_Create_Colours_32k: lb_bpp = 4; break;
case d_Create_Colours_4k: lb_bpp = 4, cols = 1<<12; break;
case d_Create_Colours_32k: lb_bpp = 4; cols = 1<<15; break;
case d_Create_Colours_64k: lb_bpp = 4; cols = 1<<16; break;
case d_Create_Colours_16M: lb_bpp = 5; break;
}
ftracef1 ("lb_bpp %d\n", lb_bpp);
......@@ -2548,6 +2550,15 @@ static void Decode (int *lb_bpp_out, unsigned int *mode_out)
mode = modes_2x2 [lb_bpp];
}
if ((mode == ~0u) && (lb_bpp == 4) && (cols != 1<<15))
{ /*Special handling of 16bpp.Always create TBGR for now.*/
if (cols == 1<<12)
mode = (15 << 27) | (16 << 20) | 0 | y_eig << 6 | x_eig << 4 | 1u;
else
mode = (10 << 27) | 180u >> y_eig << 14 | 180u >> x_eig << 1 | 1u;
ftracef1 ("mode 0x%X\n", mode);
}
if (mode == ~0u)
{ mode = lb_bpp + 1 << 27 | 180u >> y_eig << 14 | 180u >> x_eig << 1 | 1u;
ftracef1 ("mode 0x%X\n", mode);
......@@ -2885,10 +2896,22 @@ static BOOL Grey_Scale (int lb_bpp)
return TRUE;
}
static BOOL Have4k64k (void)
{
/*True if the OS can plot 4k and 64k TBGR, else false*/
/*The fallback for unknown sprite types in the kernel is 32bpp, so if
asking about 4k & 64k we get back 32bpp as the answer, the kernel
has used the fallback since it should be 16bpp*/
return (bbc_modevar (0x79004051u /* 4k TBGR */, bbc_Log2BPP) != 5 &&
bbc_modevar (0x501680B5u /* 64k TBGR */, bbc_Log2BPP) != 5);
}
static void Create_Handler (wimp_eventstr *e, void *handle)
{ int lb_bpp;
unsigned mode;
BOOL extd_16bpp = Have4k64k();
handle = handle;
......@@ -2905,11 +2928,15 @@ static void Create_Handler (wimp_eventstr *e, void *handle)
if (dbox_getnumeric (Create, d_Create_Palette_Colour) ||
dbox_getnumeric (Create, d_Create_Palette_Mono))
{ dbox_fadefield (Create, d_Create_Colours_32k);
{ dbox_fadefield (Create, d_Create_Colours_4k);
dbox_fadefield (Create, d_Create_Colours_32k);
dbox_fadefield (Create, d_Create_Colours_64k);
dbox_fadefield (Create, d_Create_Colours_16M);
}
else
{ dbox_unfadefield (Create, d_Create_Colours_32k);
{ if (extd_16bpp) dbox_unfadefield (Create, d_Create_Colours_4k);
dbox_unfadefield (Create, d_Create_Colours_32k);
if (extd_16bpp) dbox_unfadefield (Create, d_Create_Colours_64k);
dbox_unfadefield (Create, d_Create_Colours_16M);
}
......@@ -2944,8 +2971,8 @@ static void Create_Handler (wimp_eventstr *e, void *handle)
void psprite_create_show (main_window *window, BOOL auto_open,
char *sprite_name)
{ int width, height, x_eig, y_eig, lb_bpp;
BOOL grey_scale;
{ int width, height, x_eig, y_eig, lb_bpp, ncolour;
BOOL grey_scale, full_palette, extd_16bpp = Have4k64k();
wimp_w d_w;
ftracef0 ("psprite_create_show\n");
......@@ -2976,6 +3003,8 @@ void psprite_create_show (main_window *window, BOOL auto_open,
x_eig = bbc_modevar (-1, bbc_XEigFactor);
y_eig = bbc_modevar (-1, bbc_YEigFactor);
lb_bpp = bbc_modevar (-1, bbc_Log2BPP);
ncolour = bbc_modevar (-1, bbc_NColour);
full_palette = (bbc_modevar (-1, bbc_ModeFlags) & 0x80) != 0;
grey_scale = lb_bpp <= 3 && Grey_Scale (lb_bpp);
ftracef4 ("x_eig %d, y_eig %d, lb_bpp %d, grey_scale %s\n",
......@@ -3001,7 +3030,9 @@ void psprite_create_show (main_window *window, BOOL auto_open,
dbox_setnumeric (Create, d_Create_Colours_4, lb_bpp == 1);
dbox_setnumeric (Create, d_Create_Colours_16, lb_bpp == 2);
dbox_setnumeric (Create, d_Create_Colours_256, lb_bpp == 3);
dbox_setnumeric (Create, d_Create_Colours_32k, lb_bpp == 4);
dbox_setnumeric (Create, d_Create_Colours_4k, lb_bpp == 4 && (ncolour == 4095));
dbox_setnumeric (Create, d_Create_Colours_32k, lb_bpp == 4 && !full_palette);
dbox_setnumeric (Create, d_Create_Colours_64k, lb_bpp == 4 && full_palette);
dbox_setnumeric (Create, d_Create_Colours_16M, lb_bpp == 5);
ftracef1 ("bbc_modevar (6 << 27 | 1, bbc_Log2BPP) %d\n",
......@@ -3011,6 +3042,11 @@ void psprite_create_show (main_window *window, BOOL auto_open,
dbox_fadefield (Create, d_Create_Colours_32k);
dbox_fadefield (Create, d_Create_Colours_16M);
}
if (!extd_16bpp)
{ /*This OS can't do 4k and 64k.*/
dbox_fadefield (Create, d_Create_Colours_4k);
dbox_fadefield (Create, d_Create_Colours_64k);
}
Decode (&lb_bpp, &Mode);
......
......@@ -175,7 +175,9 @@
#define d_Create_Colours_4 9
#define d_Create_Colours_16 10
#define d_Create_Colours_256 11
#define d_Create_Colours_4k 33
#define d_Create_Colours_32k 12
#define d_Create_Colours_64k 32
#define d_Create_Colours_16M 13
#define d_Create_Mode_LabelL 6
#define d_Create_Mode 30
......
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