mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
gpu: remove redundant panics when handling ops
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
-12
@@ -133,9 +133,6 @@ type imageOp struct {
|
|||||||
|
|
||||||
func decodeStrokeOp(data []byte) float32 {
|
func decodeStrokeOp(data []byte) float32 {
|
||||||
_ = data[4]
|
_ = data[4]
|
||||||
if ops.OpType(data[0]) != ops.TypeStroke {
|
|
||||||
panic("invalid op")
|
|
||||||
}
|
|
||||||
bo := binary.LittleEndian
|
bo := binary.LittleEndian
|
||||||
return math.Float32frombits(bo.Uint32(data[1:]))
|
return math.Float32frombits(bo.Uint32(data[1:]))
|
||||||
}
|
}
|
||||||
@@ -179,9 +176,6 @@ type linearGradientOpData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func decodeImageOp(data []byte, refs []interface{}) imageOpData {
|
func decodeImageOp(data []byte, refs []interface{}) imageOpData {
|
||||||
if ops.OpType(data[0]) != ops.TypeImage {
|
|
||||||
panic("invalid op")
|
|
||||||
}
|
|
||||||
handle := refs[1]
|
handle := refs[1]
|
||||||
if handle == nil {
|
if handle == nil {
|
||||||
return imageOpData{}
|
return imageOpData{}
|
||||||
@@ -193,9 +187,6 @@ func decodeImageOp(data []byte, refs []interface{}) imageOpData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func decodeColorOp(data []byte) color.NRGBA {
|
func decodeColorOp(data []byte) color.NRGBA {
|
||||||
if ops.OpType(data[0]) != ops.TypeColor {
|
|
||||||
panic("invalid op")
|
|
||||||
}
|
|
||||||
return color.NRGBA{
|
return color.NRGBA{
|
||||||
R: data[1],
|
R: data[1],
|
||||||
G: data[2],
|
G: data[2],
|
||||||
@@ -205,9 +196,6 @@ func decodeColorOp(data []byte) color.NRGBA {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func decodeLinearGradientOp(data []byte) linearGradientOpData {
|
func decodeLinearGradientOp(data []byte) linearGradientOpData {
|
||||||
if ops.OpType(data[0]) != ops.TypeLinearGradient {
|
|
||||||
panic("invalid op")
|
|
||||||
}
|
|
||||||
bo := binary.LittleEndian
|
bo := binary.LittleEndian
|
||||||
return linearGradientOpData{
|
return linearGradientOpData{
|
||||||
stop1: f32.Point{
|
stop1: f32.Point{
|
||||||
|
|||||||
Reference in New Issue
Block a user