text/v2: performance optimization by using image.RGBA

Apparently, image.RGBA doesn't use the slow path at draw.Draw, which
is called from a rasterizer's Draw.

Updates #2454
This commit is contained in:
Hajime Hoshi 2023-11-17 13:07:43 +09:00
parent 4755da6a08
commit ca8a2896b4

View File

@ -116,7 +116,7 @@ func segmentsToImage(segs []api.Segment, subpixelOffset fixed.Point26_6, glyphBo
} }
} }
dst := image.NewAlpha(image.Rect(0, 0, w, h)) dst := image.NewRGBA(image.Rect(0, 0, w, h))
rast.Draw(dst, dst.Bounds(), image.Opaque, image.Point{}) rast.Draw(dst, dst.Bounds(), image.Opaque, image.Point{})
return ebiten.NewImageFromImage(dst) return ebiten.NewImageFromImage(dst)
} }