about summary refs log tree commit diff stats
path: root/adapter
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-10-22 20:32:44 +0200
committerbptato <nincsnevem662@gmail.com>2024-10-22 20:53:33 +0200
commitb0bb61e830e76169f41db186b5946ae6859f4e6a (patch)
tree1ec2d343fe6bfa3f5fdacd1ca0e69cb57c558539 /adapter
parentb9455ef09f4d33dd9e3cb291ed6e689b51301e22 (diff)
downloadchawan-b0bb61e830e76169f41db186b5946ae6859f4e6a.tar.gz
color: use 64-bit SWAR
I originally left this at 32-bits because I was on a 32-bit arch, but
that is no longer the case.
Diffstat (limited to 'adapter')
-rw-r--r--adapter/img/sixel.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/adapter/img/sixel.nim b/adapter/img/sixel.nim
index 7b501d38..49a8a969 100644
--- a/adapter/img/sixel.nim
+++ b/adapter/img/sixel.nim
@@ -168,7 +168,7 @@ proc quantize(img: openArray[RGBAColorBE]; outk: var uint;
   for c0 in img:
     let c0 = c0.argb()
     transparent = transparent or c0.a != 255
-    let c = RGBColor(uint32(c0).fastmul(100))
+    let c = RGBColor(ARGBColor(uint32(c0) or 0xFF000000u32).fastmul(100))
     K += root.insert(c, trimMap)
     while K > palette:
       trimMap.trim(K)
@@ -414,7 +414,7 @@ proc encode(os: PosixStream; img: openArray[RGBAColorBE];
       for j in 0 ..< realw:
         let m = n + offx + j
         let c0 = img[m].argb()
-        let c1 = ARGBColor(uint32(c0).fastmul1(100))
+        let c1 = c0.fastmul(100)
         let c2 = c1.correctDither(j, dither)
         if c2.a < 50: # transparent
           let diff = (int32(c2.a), 0i32, 0i32, 0i32)