Skip to content

Commit

Permalink
internal/ui: refactoring: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed May 3, 2024
1 parent c658a25 commit 1ebfa8b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 26 deletions.
16 changes: 0 additions & 16 deletions internal/ui/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -308,7 +293,6 @@ func (c *context) runInFrame(f func()) {
f()
}
<-ch
return
}

func (c *context) processFuncsInFrame(ui *UserInterface) error {
Expand Down
4 changes: 2 additions & 2 deletions internal/ui/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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()
}
Expand Down
7 changes: 0 additions & 7 deletions internal/ui/monitor_glfw.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion internal/ui/ui_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down

0 comments on commit 1ebfa8b

Please sign in to comment.