From dce453e1308cc4757e22c4fcd7eb287a959b02b1 Mon Sep 17 00:00:00 2001 From: Pierre Curto Date: Wed, 10 Nov 2021 13:38:14 +0100 Subject: [PATCH] gpu: remove redundant panics when handling ops Signed-off-by: Pierre Curto --- gpu/gpu.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/gpu/gpu.go b/gpu/gpu.go index 06d0c707..2b1aee16 100644 --- a/gpu/gpu.go +++ b/gpu/gpu.go @@ -133,9 +133,6 @@ type imageOp struct { func decodeStrokeOp(data []byte) float32 { _ = data[4] - if ops.OpType(data[0]) != ops.TypeStroke { - panic("invalid op") - } bo := binary.LittleEndian return math.Float32frombits(bo.Uint32(data[1:])) } @@ -179,9 +176,6 @@ type linearGradientOpData struct { } func decodeImageOp(data []byte, refs []interface{}) imageOpData { - if ops.OpType(data[0]) != ops.TypeImage { - panic("invalid op") - } handle := refs[1] if handle == nil { return imageOpData{} @@ -193,9 +187,6 @@ func decodeImageOp(data []byte, refs []interface{}) imageOpData { } func decodeColorOp(data []byte) color.NRGBA { - if ops.OpType(data[0]) != ops.TypeColor { - panic("invalid op") - } return color.NRGBA{ R: data[1], G: data[2], @@ -205,9 +196,6 @@ func decodeColorOp(data []byte) color.NRGBA { } func decodeLinearGradientOp(data []byte) linearGradientOpData { - if ops.OpType(data[0]) != ops.TypeLinearGradient { - panic("invalid op") - } bo := binary.LittleEndian return linearGradientOpData{ stop1: f32.Point{