From 09dcba40ab5a6aa68ce7528eed9b7604dd5442a3 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 22 Jul 2018 04:32:36 +0900 Subject: [PATCH] shareable: Rename variables --- internal/shareable/shareable.go | 14 +++++++------- internal/shareable/shareable_test.go | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/shareable/shareable.go b/internal/shareable/shareable.go index abc88704a..4ba309e89 100644 --- a/internal/shareable/shareable.go +++ b/internal/shareable/shareable.go @@ -91,8 +91,8 @@ type Image struct { backend *backend - node *packing.Node - sharedCount int + node *packing.Node + countForShare int } func (i *Image) isShared() bool { @@ -182,7 +182,7 @@ func (i *Image) QuadVertices(sx0, sy0, sx1, sy1 int, a, b, c, d, tx, ty float32) return graphicsutil.QuadVertices(w, h, sx0+dx, sy0+dy, sx1+dx, sy1+dy, a, b, c, d, tx, ty) } -const ReshareCount = 10 +const MaxCountForShare = 10 func (i *Image) DrawImage(img *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode opengl.CompositeMode, filter graphics.Filter) { backendsM.Lock() @@ -208,12 +208,12 @@ func (i *Image) DrawImage(img *Image, vertices []float32, indices []uint16, colo i.backend.restorable.DrawImage(img.backend.restorable, vertices, indices, colorm, mode, filter) - i.sharedCount = 0 + i.countForShare = 0 if !img.isShared() && img.shareable() { - img.sharedCount++ - if img.sharedCount >= ReshareCount { + img.countForShare++ + if img.countForShare >= MaxCountForShare { img.forceShared() - img.sharedCount = 0 + img.countForShare = 0 } } } diff --git a/internal/shareable/shareable_test.go b/internal/shareable/shareable_test.go index 4748b38cb..4902709ca 100644 --- a/internal/shareable/shareable_test.go +++ b/internal/shareable/shareable_test.go @@ -150,7 +150,7 @@ func TestReshared(t *testing.T) { } // Use img1 as a render source. - for i := 0; i < ReshareCount-1; i++ { + for i := 0; i < MaxCountForShare-1; i++ { img0.DrawImage(img1, vs, is, nil, opengl.CompositeModeCopy, graphics.FilterNearest) want := false if got := img1.IsSharedForTesting(); got != want {