mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55: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 {
|
func decodeColorOp(data []byte) color.NRGBA {
|
||||||
|
data = data[:ops.TypeColorLen]
|
||||||
return color.NRGBA{
|
return color.NRGBA{
|
||||||
R: data[1],
|
R: data[1],
|
||||||
G: data[2],
|
G: data[2],
|
||||||
@@ -195,6 +196,7 @@ func decodeColorOp(data []byte) color.NRGBA {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func decodeLinearGradientOp(data []byte) linearGradientOpData {
|
func decodeLinearGradientOp(data []byte) linearGradientOpData {
|
||||||
|
data = data[:ops.TypeLinearGradientLen]
|
||||||
bo := binary.LittleEndian
|
bo := binary.LittleEndian
|
||||||
return linearGradientOpData{
|
return linearGradientOpData{
|
||||||
stop1: f32.Point{
|
stop1: f32.Point{
|
||||||
|
|||||||
Reference in New Issue
Block a user