From 382f6365fd2af6329c0b80796a99f1127cf4ae11 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 4 Oct 2019 01:52:27 +0900 Subject: [PATCH] shareable: Avoid defer for performance --- internal/shareable/image.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/shareable/image.go b/internal/shareable/image.go index 3a990afc0..84848a036 100644 --- a/internal/shareable/image.go +++ b/internal/shareable/image.go @@ -388,8 +388,9 @@ func (i *Image) replacePixels(p []byte) { func (i *Image) At(x, y int) (byte, byte, byte, byte) { backendsM.Lock() - defer backendsM.Unlock() - return i.at(x, y) + r, g, b, a := i.at(x, y) + backendsM.Unlock() + return r, g, b, a } func (i *Image) at(x, y int) (byte, byte, byte, byte) {