Skip to content

Commit

Permalink
CHANGE: SWF codec - all three read-PlaceObject* functions now returns…
Browse files Browse the repository at this point in the history
… first 6 values pointing to same data [Depth move/place ClassName CharacterId Matrix Cxform], to simplify its processing, event when the values may be NONE in older PlaceObject tag versions.
  • Loading branch information
Oldes committed Jun 5, 2019
1 parent 6792776 commit b774dac
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/mezz/codec-swf.r
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import module [

readPair: has[n][
n: binary/read/with bin 'UB 5
to-pair binary/read bin [FB :n FB :n]
to pair! binary/read bin [FB :n FB :n]
]

readSBPair: has[n][
Expand Down Expand Up @@ -372,14 +372,19 @@ import module [
result
]

;@@ NOTE: to simplify processing, first 6 values returned from PlaceObject* are always:
;@@ [Depth move/place ClassName CharacterId Matrix Cxform]
read-PlaceObject: has[id depth][
binary/read bin [
id: UI16LE ;ID of character to place
depth: UI16LE ;Depth of character
]
reduce [
id depth
readMATRIX ;Transform matrix data
depth
none ; always place
none ; always without ClassName
id ; CharacterId
readMATRIX ; Transform matrix data
either tail? bin/buffer [none][readCXFORM] ;Color transform data
]
]
Expand All @@ -389,6 +394,7 @@ import module [
reduce [
binary/read bin 'UI16LE ;depth
flags/7 ;TRUE = move, else place
none ;ClassName (not exists)
either flags/6 [binary/read bin 'UI16LE ][none] ;CharacterId
either flags/5 [readMATRIX ][none] ;HasMatrix
either flags/4 [readCXFORMa ][none] ;HasCxform
Expand Down

0 comments on commit b774dac

Please sign in to comment.