Commit ecd55cb3 authored by Robert Sprowson's avatar Robert Sprowson

Add missing targa palette entry size handling

The targa (TGA) reader had an oddly empty "ELSE" clause in the code that reads palette entries, so while 24b entries worked the 16b and 32b variants didn't. This would typically show an all black image (all palette entries uninitialised).
Tested with some sample 16b images, 32b ones should be right by inspection.

Version 1.49. Tagged as 'ChangeFSI-1_49'
parent d1156009
/* (1.48)
/* (1.49)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.48
#define Module_MajorVersion_CMHG 1.49
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 02 Aug 2014
#define Module_Date_CMHG 04 Aug 2014
#define Module_MajorVersion "1.48"
#define Module_Version 148
#define Module_MajorVersion "1.49"
#define Module_Version 149
#define Module_MinorVersion ""
#define Module_Date "02 Aug 2014"
#define Module_Date "04 Aug 2014"
#define Module_ApplicationDate "02-Aug-14"
#define Module_ApplicationDate "04-Aug-14"
#define Module_ComponentName "ChangeFSI"
#define Module_ComponentPath "mixed/RiscOS/Sources/Apps/ChangeFSI"
#define Module_FullVersion "1.48"
#define Module_HelpVersion "1.48 (02 Aug 2014)"
#define Module_LibraryVersionInfo "1:48"
#define Module_FullVersion "1.49"
#define Module_HelpVersion "1.49 (04 Aug 2014)"
#define Module_LibraryVersionInfo "1:49"
......@@ -3102,30 +3102,40 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
WHEN 2000
REM Truevision TGA
PTR#c%=0
L%=BGET#c%
C%=BGET#c%
I%=BGET#c%
J%=FNHW
K%=FNHW
M%=BGET#c%
L%=BGET#c% : REM Size of image id field
C%=BGET#c% : REM Palette type
I%=BGET#c% : REM Image type
J%=FNHW : REM Index of first palette entry
K%=FNHW : REM Number of colour map entries
M%=BGET#c% : REM Bits per palette entry
sx%=FNW
sx%=FNHW
sy%=FNHW
B%=BGET#c%
ID%=BGET#c%
B%=BGET#c% : REM Bytes per pixel
ID%=BGET#c%: REM Flags
IF ID% AND &10 hflip%=NOT hflip%
IF (ID% AND &20)=0 vflip%=NOT vflip%
PTR#c%=PTR#c%+L%
CASE C% OF
WHEN 1
IF M%=&18 THEN
FOR C%=J% TO K%-1
b%(C%)=BGET#c%/255*F
g%(C%)=BGET#c%/255*F
r%(C%)=BGET#c%/255*F
NEXT
ELSE
ENDIF
CASE M% OF
WHEN 16
FOR C%=J% TO K%-1
D%=FNHW
b%(C%)=( D% AND31)/31*F
g%(C%)=((D%>>5) AND31)/31*F
r%(C%)=((D%>>10)AND31)/31*F
NEXT
WHEN 24,32
FOR C%=J% TO K%-1
b%(C%)=BGET#c%/255*F
g%(C%)=BGET#c%/255*F
r%(C%)=BGET#c%/255*F
IF M%=32 THEN junk%=BGET#c%
NEXT
OTHERWISE
ERROR 42, "Odd size TGA palette entries"
ENDCASE
OTHERWISE
PROCnopal
ENDCASE
......@@ -8314,13 +8324,12 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
DCD datacache%
.numlefttogo
DCD cache%
.multibytefromcache%
.multibytefromcache%
CMP R3,#0
MOVEQ PC,R14
STMFD SP !,{R0,R14}
.multibytefromcachel
BL bytefromcache%
STRB R0,[R2],#1
SUBS R3,R3,#1
......
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