TinyVG / specification

The specification for TinyVG. This is the central authority for the file system

Home Page:https://tinyvg.tech/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid specification for coordinate_range values

kenshaw opened this issue · comments

The coordinate_range field is specified as Default (8-bit) and Reduced (16-bit), however, the reference implementation is flipped, using u8 for reduced and u16 for default -- from lib/parsing.zig:

                      const width: u32 = switch (range) {    
                          .reduced => mapZeroToMax(try reader.readIntLittle(u8)),    
                          .default => mapZeroToMax(try reader.readIntLittle(u16)),    
                          .enhanced => std.math.cast(u32, mapZeroToMax(try reader.readIntLittle(u32))) catch return error.InvalidData,    
                      };    
                      const height: u32 = switch (range) {    
                          .reduced => mapZeroToMax(try reader.readIntLittle(u8)),    
                          .default => mapZeroToMax(try reader.readIntLittle(u16)),    
                          .enhanced => std.math.cast(u32, mapZeroToMax(try reader.readIntLittle(u32))) catch return error.InvalidData,    
                      };  

Screenshot from specification.pdf:
Screenshot from 2021-12-23 11-09-21

This appears to have been fixed in 49ba3c0. I was working off an old PDF.

This appears to have been fixed in 49ba3c0. I was working off an old PDF.

Yeah, you're not the first person finding this. Thanks for the report!