[sixel] restrict to 99, but use true 100 scale for accuracy

This commit is contained in:
nick black 2022-01-08 19:12:00 -05:00
parent 5943d4e256
commit 1af9b16276
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -38,7 +38,8 @@ typedef struct onode {
// convert rgb [0..255] to sixel [0..99]
static inline unsigned
ss(unsigned c){
return round(c * 99.0 / 255);
unsigned r = round(c * 100.0 / 255); // use real [0..100] scaling
return r > 99 ? 99: r;
}
// get the keys for an rgb point. the returned value is on [0..999], and maps