x-backend #2
@ -51,13 +51,15 @@ func (backend *Backend) drawRune (x, y int, character rune) {
|
|||||||
Y: fixed.I(origin.Y - backend.metrics.descent),
|
Y: fixed.I(origin.Y - backend.metrics.descent),
|
||||||
},
|
},
|
||||||
character)
|
character)
|
||||||
|
|
||||||
// strokeRectangle (
|
if backend.drawCellBounds {
|
||||||
// &image.Uniform {
|
strokeRectangle (
|
||||||
// C: backend.config.Color(stone.ColorForeground),
|
&image.Uniform {
|
||||||
// },
|
C: backend.config.Color(stone.ColorForeground),
|
||||||
// backend.canvas,
|
},
|
||||||
// backend.boundsOfCell(x, y))
|
backend.canvas,
|
||||||
|
backend.boundsOfCell(x, y))
|
||||||
|
}
|
||||||
|
|
||||||
draw.DrawMask (
|
draw.DrawMask (
|
||||||
backend.canvas,
|
backend.canvas,
|
||||||
@ -86,6 +88,18 @@ func (backend *Backend) drawCells (forceRedraw bool) (areas []image.Rectangle) {
|
|||||||
areas = append(areas, backend.boundsOfCell(x, y))
|
areas = append(areas, backend.boundsOfCell(x, y))
|
||||||
backend.drawRune(x, y, content)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +126,10 @@ func factory (application *stone.Application) (output stone.Backend, err error)
|
|||||||
Connect(backend.connection, backend.window.Id)
|
Connect(backend.connection, backend.window.Id)
|
||||||
xevent.KeyReleaseFun(backend.handleKeyRelease).
|
xevent.KeyReleaseFun(backend.handleKeyRelease).
|
||||||
Connect(backend.connection, backend.window.Id)
|
Connect(backend.connection, backend.window.Id)
|
||||||
|
|
||||||
|
// uncomment these to draw debug bounds
|
||||||
|
// backend.drawCellBounds = true
|
||||||
|
// backend.drawBufferBounds = true
|
||||||
|
|
||||||
output = backend
|
output = backend
|
||||||
return
|
return
|
||||||
|
@ -21,6 +21,9 @@ type Backend struct {
|
|||||||
canvas *xgraphics.Image
|
canvas *xgraphics.Image
|
||||||
channel chan(stone.Event)
|
channel chan(stone.Event)
|
||||||
|
|
||||||
|
drawCellBounds bool
|
||||||
|
drawBufferBounds bool
|
||||||
|
|
||||||
drawLock sync.Mutex
|
drawLock sync.Mutex
|
||||||
|
|
||||||
font struct {
|
font struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user