From 1ebfa8b911455887f820868b5e966856b56d6df4 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 4 May 2024 00:26:37 +0900 Subject: [PATCH] internal/ui: refactoring: remove unused code --- internal/ui/context.go | 16 ---------------- internal/ui/image.go | 4 ++-- internal/ui/monitor_glfw.go | 7 ------- internal/ui/ui_darwin.go | 1 - 4 files changed, 2 insertions(+), 26 deletions(-) diff --git a/internal/ui/context.go b/internal/ui/context.go index ff419c975..755f6d650 100644 --- a/internal/ui/context.go +++ b/internal/ui/context.go @@ -73,21 +73,6 @@ func (c *context) updateFrame(graphicsDriver graphicsdriver.Graphics, outsideWid return c.updateFrameImpl(graphicsDriver, clock.UpdateFrame(), outsideWidth, outsideHeight, deviceScaleFactor, ui, false) } -func (c *context) forceUpdateFrame(graphicsDriver graphicsdriver.Graphics, outsideWidth, outsideHeight float64, deviceScaleFactor float64, ui *UserInterface) error { - n := 1 - if ui.GraphicsLibrary() == GraphicsLibraryDirectX { - // On DirectX, both framebuffers in the swap chain should be updated. - // Or, the rendering result becomes unexpected when the window is resized. - n = 2 - } - for i := 0; i < n; i++ { - if err := c.updateFrameImpl(graphicsDriver, 1, outsideWidth, outsideHeight, deviceScaleFactor, ui, true); err != nil { - return err - } - } - return nil -} - func (c *context) updateFrameImpl(graphicsDriver graphicsdriver.Graphics, updateCount int, outsideWidth, outsideHeight float64, deviceScaleFactor float64, ui *UserInterface, forceDraw bool) (err error) { // The given outside size can be 0 e.g. just after restoring from the fullscreen mode on Windows (#1589) // Just ignore such cases. Otherwise, creating a zero-sized framebuffer causes a panic. @@ -308,7 +293,6 @@ func (c *context) runInFrame(f func()) { f() } <-ch - return } func (c *context) processFuncsInFrame(ui *UserInterface) error { diff --git a/internal/ui/image.go b/internal/ui/image.go index 0a971a8c4..093bfb654 100644 --- a/internal/ui/image.go +++ b/internal/ui/image.go @@ -98,7 +98,7 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [ i.bigOffscreenBuffer = i.ui.newBigOffscreenImage(i, imageType) } - i.bigOffscreenBuffer.drawTriangles(srcs, vertices, indices, blend, dstRegion, srcRegions, shader, uniforms, fillRule, canSkipMipmap, false) + i.bigOffscreenBuffer.drawTriangles(srcs, vertices, indices, blend, dstRegion, srcRegions, shader, uniforms, fillRule, canSkipMipmap) return } @@ -217,7 +217,7 @@ func (i *bigOffscreenImage) deallocate() { i.dirty = false } -func (i *bigOffscreenImage) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices []float32, indices []uint32, blend graphicsdriver.Blend, dstRegion image.Rectangle, srcRegions [graphics.ShaderImageCount]image.Rectangle, shader *Shader, uniforms []uint32, fillRule graphicsdriver.FillRule, canSkipMipmap bool, antialias bool) { +func (i *bigOffscreenImage) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices []float32, indices []uint32, blend graphicsdriver.Blend, dstRegion image.Rectangle, srcRegions [graphics.ShaderImageCount]image.Rectangle, shader *Shader, uniforms []uint32, fillRule graphicsdriver.FillRule, canSkipMipmap bool) { if i.blend != blend { i.flush() } diff --git a/internal/ui/monitor_glfw.go b/internal/ui/monitor_glfw.go index d491e993b..ef8feb95b 100644 --- a/internal/ui/monitor_glfw.go +++ b/internal/ui/monitor_glfw.go @@ -97,13 +97,6 @@ func (m *monitors) primaryMonitor() *Monitor { return m.monitors[0] } -func (m *monitors) monitorFromID(id int) *Monitor { - m.m.Lock() - defer m.m.Unlock() - - return m.monitors[id] -} - // monitorFromPosition returns a monitor for the given position (x, y), // or returns nil if monitor is not found. // The position is in GLFW pixels. diff --git a/internal/ui/ui_darwin.go b/internal/ui/ui_darwin.go index 7d3a36c09..f1fd13f3f 100644 --- a/internal/ui/ui_darwin.go +++ b/internal/ui/ui_darwin.go @@ -242,7 +242,6 @@ var ( sel_setOrigResizable = objc.RegisterName("setOrigResizable:") sel_toggleFullScreen = objc.RegisterName("toggleFullScreen:") sel_windowDidBecomeKey = objc.RegisterName("windowDidBecomeKey:") - sel_windowDidDeminiaturize = objc.RegisterName("windowDidDeminiaturize:") sel_windowDidEnterFullScreen = objc.RegisterName("windowDidEnterFullScreen:") sel_windowDidExitFullScreen = objc.RegisterName("windowDidExitFullScreen:") sel_windowDidMiniaturize = objc.RegisterName("windowDidMiniaturize:")