guard against bad pre-mult ARGB
Closes PR 11572
This commit is contained in:
parent
1d89cfc9d7
commit
0476ab4fc4
|
@ -614,9 +614,13 @@
|
||||||
[a (bytes-ref data (+ ri A))]
|
[a (bytes-ref data (+ ri A))]
|
||||||
[unmult (lambda (a v)
|
[unmult (lambda (a v)
|
||||||
(if use-alpha?
|
(if use-alpha?
|
||||||
(if (zero? a)
|
(if (unsafe-fx= 0 a)
|
||||||
255
|
255
|
||||||
(unsafe-fxquotient (fx* v 255) a))
|
;; `min' shouldn't be necessary, but it's
|
||||||
|
;; just in case the data is ill-formed
|
||||||
|
(unsafe-fxmin 255 (unsafe-fxquotient
|
||||||
|
(unsafe-fx* v 255)
|
||||||
|
a)))
|
||||||
v))])
|
v))])
|
||||||
(when alpha-channel?
|
(when alpha-channel?
|
||||||
(bytes-set! bstr pi a))
|
(bytes-set! bstr pi a))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user