From 339155f63dafe7d8d8595a48dbba7c6c468957ac Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 10 Feb 2019 14:08:59 +0900 Subject: [PATCH] shareable: Use CompositeModeSourceOver when possible at Fill --- internal/shareable/shareable.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/shareable/shareable.go b/internal/shareable/shareable.go index e86dc6f0c..1eb0c039c 100644 --- a/internal/shareable/shareable.go +++ b/internal/shareable/shareable.go @@ -296,7 +296,11 @@ func (i *Image) Fill(r, g, b, a uint8) { rf, gf, bf, af) is := graphics.QuadIndices() - i.DrawImage(emptyImage, vs, is, nil, graphics.CompositeModeCopy, graphics.FilterNearest, graphics.AddressClampToZero) + c := graphics.CompositeModeSourceOver + if a < 0xff { + c = graphics.CompositeModeCopy + } + i.DrawImage(emptyImage, vs, is, nil, c, graphics.FilterNearest, graphics.AddressClampToZero) } func (i *Image) ReplacePixels(p []byte) {