Added some stuff to draw debug bounding boxes
This commit is contained in:
parent
d9c9895e82
commit
79d8891c5b
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -21,6 +21,9 @@ type Backend struct {
|
||||
canvas *xgraphics.Image
|
||||
channel chan(stone.Event)
|
||||
|
||||
drawCellBounds bool
|
||||
drawBufferBounds bool
|
||||
|
||||
drawLock sync.Mutex
|
||||
|
||||
font struct {
|
||||
|
Loading…
Reference in New Issue
Block a user