From 6dc74d308bd2b59f6f1ec1da805aee37f0175476 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 8 Aug 2020 16:07:03 +0900 Subject: [PATCH] graphicsdriver/metal: Rename viewportSize to internalSize and use it more --- internal/graphicsdriver/metal/graphics.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/graphicsdriver/metal/graphics.go b/internal/graphicsdriver/metal/graphics.go index 09d3687d4..4923313ae 100644 --- a/internal/graphicsdriver/metal/graphics.go +++ b/internal/graphicsdriver/metal/graphics.go @@ -674,7 +674,7 @@ func (g *Graphics) draw(rps mtl.RenderPipelineState, dst *Image, srcs [graphics. // In Metal, the NDC's Y direction (upward) and the framebuffer's Y direction (downward) don't // match. Then, the Y direction must be inverted. - w, h := dst.viewportSize() + w, h := dst.internalSize() rce.SetViewport(mtl.Viewport{ OriginX: 0, OriginY: float64(h), @@ -728,11 +728,12 @@ func (g *Graphics) Draw(dstID, srcID driver.ImageID, indexLen int, indexOffset i } if err := g.t.Call(func() error { - w, h := dst.viewportSize() + w, h := dst.internalSize() sourceSize := []float32{0, 0} if filter != driver.FilterNearest { - sourceSize[0] = float32(graphics.InternalImageSize(srcs[0].width)) - sourceSize[1] = float32(graphics.InternalImageSize(srcs[0].height)) + w, h := srcs[0].internalSize() + sourceSize[0] = float32(w) + sourceSize[1] = float32(h) } esBody, esTranslate := colorM.UnsafeElements() scale := float32(0) @@ -840,8 +841,7 @@ func (i *Image) ID() driver.ImageID { return i.id } -// viewportSize must be called from the main thread. -func (i *Image) viewportSize() (int, int) { +func (i *Image) internalSize() (int, int) { if i.screen { return i.width, i.height }