x-backend #2

Merged
sashakoshka merged 34 commits from x-backend into main 2022-11-14 21:40:25 -07:00
3 changed files with 28 additions and 7 deletions
Showing only changes of commit 79d8891c5b - Show all commits

View File

@ -51,13 +51,15 @@ func (backend *Backend) drawRune (x, y int, character rune) {
Y: fixed.I(origin.Y - backend.metrics.descent),
},
character)
// strokeRectangle (
// &image.Uniform {
// C: backend.config.Color(stone.ColorForeground),
// },
// backend.canvas,
// backend.boundsOfCell(x, y))
if backend.drawCellBounds {
strokeRectangle (
&image.Uniform {
C: backend.config.Color(stone.ColorForeground),
},
backend.canvas,
backend.boundsOfCell(x, y))
}
draw.DrawMask (
backend.canvas,
@ -86,6 +88,18 @@ func (backend *Backend) drawCells (forceRedraw bool) (areas []image.Rectangle) {
areas = append(areas, backend.boundsOfCell(x, y))
backend.drawRune(x, y, content)
}}
if backend.drawBufferBounds && forceRedraw {
strokeRectangle (
&image.Uniform {
C: backend.config.Color(stone.ColorForeground),
},
backend.canvas,
image.Rectangle {
Min: backend.originOfCell(0, 0),
Max: backend.originOfCell(width, height),
})
}
return
}

View File

@ -126,6 +126,10 @@ func factory (application *stone.Application) (output stone.Backend, err error)
Connect(backend.connection, backend.window.Id)
xevent.KeyReleaseFun(backend.handleKeyRelease).
Connect(backend.connection, backend.window.Id)
// uncomment these to draw debug bounds
// backend.drawCellBounds = true
// backend.drawBufferBounds = true
output = backend
return

View File

@ -21,6 +21,9 @@ type Backend struct {
canvas *xgraphics.Image
channel chan(stone.Event)
drawCellBounds bool
drawBufferBounds bool
drawLock sync.Mutex
font struct {