mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
gpu: avoid bounds checks in decode
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
@@ -186,6 +186,7 @@ func decodeImageOp(data []byte, refs []interface{}) imageOpData {
|
||||
}
|
||||
|
||||
func decodeColorOp(data []byte) color.NRGBA {
|
||||
data = data[:ops.TypeColorLen]
|
||||
return color.NRGBA{
|
||||
R: data[1],
|
||||
G: data[2],
|
||||
@@ -195,6 +196,7 @@ func decodeColorOp(data []byte) color.NRGBA {
|
||||
}
|
||||
|
||||
func decodeLinearGradientOp(data []byte) linearGradientOpData {
|
||||
data = data[:ops.TypeLinearGradientLen]
|
||||
bo := binary.LittleEndian
|
||||
return linearGradientOpData{
|
||||
stop1: f32.Point{
|
||||
|
||||
Reference in New Issue
Block a user