~eliasnaur/gio

0777afb85f900d86e34027aa9c2bc33323316e6d — Egon Elbre 10 months ago 0057e87
gpu: avoid bounds checks in decode

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
1 files changed, 2 insertions(+), 0 deletions(-)

M gpu/gpu.go
M gpu/gpu.go => gpu/gpu.go +2 -0
@@ 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{