Skip to content

Commit

Permalink
draw: delete some dead code.
Browse files Browse the repository at this point in the history
Change-Id: I5830755b0be52df2be536a918f47684a1b7eda9d
Reviewed-on: https://go-review.googlesource.com/9232
Reviewed-by: Rob Pike <[email protected]>
  • Loading branch information
egorovcharenko9 committed Dec 18, 2022
1 parent 2e62e9c commit ddfba18
Showing 1 changed file with 44 additions and 84 deletions.
128 changes: 44 additions & 84 deletions draw/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,48 +366,28 @@ func expnDollar(prefix, dollar, suffix string, d *data) string {
default:
log.Fatalf("bad dType %q", d.dType)
case "Image":
switch d.sType {
default:
return argf(args, ""+
"if dstMask != nil {\n"+
" qr, qg, qb, qa := dst.At($0, $1).RGBA()\n"+
" _, _, _, ma := dstMask.At(dmp.X + $0, dmp.Y + $1).RGBA()\n"+
" pr = pr * ma / 0xffff\n"+
" pg = pg * ma / 0xffff\n"+
" pb = pb * ma / 0xffff\n"+
" pa = pa * ma / 0xffff\n"+
" $2a1 := 0xffff - ma\n"+ // Note that this is ma, not $2a.
" dstColorRGBA64.R = uint16(qr*$2a1/0xffff + $2r)\n"+
" dstColorRGBA64.G = uint16(qg*$2a1/0xffff + $2g)\n"+
" dstColorRGBA64.B = uint16(qb*$2a1/0xffff + $2b)\n"+
" dstColorRGBA64.A = uint16(qa*$2a1/0xffff + $2a)\n"+
" dst.Set($0, $1, dstColor)\n"+
"} else {\n"+
" dstColorRGBA64.R = uint16($2r)\n"+
" dstColorRGBA64.G = uint16($2g)\n"+
" dstColorRGBA64.B = uint16($2b)\n"+
" dstColorRGBA64.A = uint16($2a)\n"+
" dst.Set($0, $1, dstColor)\n"+
"}",
)
case "*image.Gray":
return argf(args, ""+
"out := uint16($2r)\n"+
"dstColorRGBA64.R = out\n"+
"dstColorRGBA64.G = out\n"+
"dstColorRGBA64.B = out\n"+
"dstColorRGBA64.A = 0xffff\n"+
"dst.Set($0, $1, dstColor)",
)
case "*image.YCbCr":
return argf(args, ""+
"dstColorRGBA64.R = uint16($2r)\n"+
"dstColorRGBA64.G = uint16($2g)\n"+
"dstColorRGBA64.B = uint16($2b)\n"+
"dstColorRGBA64.A = 0xffff\n"+
"dst.Set($0, $1, dstColor)",
)
}
return argf(args, ""+
"if dstMask != nil {\n"+
" qr, qg, qb, qa := dst.At($0, $1).RGBA()\n"+
" _, _, _, ma := dstMask.At(dmp.X + $0, dmp.Y + $1).RGBA()\n"+
" pr = pr * ma / 0xffff\n"+
" pg = pg * ma / 0xffff\n"+
" pb = pb * ma / 0xffff\n"+
" pa = pa * ma / 0xffff\n"+
" $2a1 := 0xffff - ma\n"+ // Note that this is ma, not $2a.
" dstColorRGBA64.R = uint16(qr*$2a1/0xffff + $2r)\n"+
" dstColorRGBA64.G = uint16(qg*$2a1/0xffff + $2g)\n"+
" dstColorRGBA64.B = uint16(qb*$2a1/0xffff + $2b)\n"+
" dstColorRGBA64.A = uint16(qa*$2a1/0xffff + $2a)\n"+
" dst.Set($0, $1, dstColor)\n"+
"} else {\n"+
" dstColorRGBA64.R = uint16($2r)\n"+
" dstColorRGBA64.G = uint16($2g)\n"+
" dstColorRGBA64.B = uint16($2b)\n"+
" dstColorRGBA64.A = uint16($2a)\n"+
" dst.Set($0, $1, dstColor)\n"+
"}",
)
case "*image.RGBA":
switch d.sType {
default:
Expand Down Expand Up @@ -488,48 +468,28 @@ func expnDollar(prefix, dollar, suffix string, d *data) string {
default:
log.Fatalf("bad dType %q", d.dType)
case "Image":
switch d.sType {
default:
ret = argf(args, ""+
"if dstMask != nil {\n"+
" qr, qg, qb, qa := dst.At($0, $1).RGBA()\n"+
" _, _, _, ma := dstMask.At(dmp.X + $0, dmp.Y + $1).RGBA()\n"+
" pr := uint32($2($3r * $4)) * ma / 0xffff\n"+
" pg := uint32($2($3g * $4)) * ma / 0xffff\n"+
" pb := uint32($2($3b * $4)) * ma / 0xffff\n"+
" pa := uint32($2($3a * $4)) * ma / 0xffff\n"+
" pa1 := 0xffff - ma\n"+ // Note that this is ma, not pa.
" dstColorRGBA64.R = uint16(qr*pa1/0xffff + pr)\n"+
" dstColorRGBA64.G = uint16(qg*pa1/0xffff + pg)\n"+
" dstColorRGBA64.B = uint16(qb*pa1/0xffff + pb)\n"+
" dstColorRGBA64.A = uint16(qa*pa1/0xffff + pa)\n"+
" dst.Set($0, $1, dstColor)\n"+
"} else {\n"+
" dstColorRGBA64.R = $2($3r * $4)\n"+
" dstColorRGBA64.G = $2($3g * $4)\n"+
" dstColorRGBA64.B = $2($3b * $4)\n"+
" dstColorRGBA64.A = $2($3a * $4)\n"+
" dst.Set($0, $1, dstColor)\n"+
"}",
)
case "*image.Gray":
ret = argf(args, ""+
"out := $2($3r * $4)\n"+
"dstColorRGBA64.R = out\n"+
"dstColorRGBA64.G = out\n"+
"dstColorRGBA64.B = out\n"+
"dstColorRGBA64.A = 0xffff\n"+
"dst.Set($0, $1, dstColor)",
)
case "*image.YCbCr":
ret = argf(args, ""+
"dstColorRGBA64.R = $2($3r * $4)\n"+
"dstColorRGBA64.G = $2($3g * $4)\n"+
"dstColorRGBA64.B = $2($3b * $4)\n"+
"dstColorRGBA64.A = 0xffff\n"+
"dst.Set($0, $1, dstColor)",
)
}
ret = argf(args, ""+
"if dstMask != nil {\n"+
" qr, qg, qb, qa := dst.At($0, $1).RGBA()\n"+
" _, _, _, ma := dstMask.At(dmp.X + $0, dmp.Y + $1).RGBA()\n"+
" pr := uint32($2($3r * $4)) * ma / 0xffff\n"+
" pg := uint32($2($3g * $4)) * ma / 0xffff\n"+
" pb := uint32($2($3b * $4)) * ma / 0xffff\n"+
" pa := uint32($2($3a * $4)) * ma / 0xffff\n"+
" pa1 := 0xffff - ma\n"+ // Note that this is ma, not pa.
" dstColorRGBA64.R = uint16(qr*pa1/0xffff + pr)\n"+
" dstColorRGBA64.G = uint16(qg*pa1/0xffff + pg)\n"+
" dstColorRGBA64.B = uint16(qb*pa1/0xffff + pb)\n"+
" dstColorRGBA64.A = uint16(qa*pa1/0xffff + pa)\n"+
" dst.Set($0, $1, dstColor)\n"+
"} else {\n"+
" dstColorRGBA64.R = $2($3r * $4)\n"+
" dstColorRGBA64.G = $2($3g * $4)\n"+
" dstColorRGBA64.B = $2($3b * $4)\n"+
" dstColorRGBA64.A = $2($3a * $4)\n"+
" dst.Set($0, $1, dstColor)\n"+
"}",
)
case "*image.RGBA":
switch d.sType {
default:
Expand Down

0 comments on commit ddfba18

Please sign in to comment.