Made the drawing time thing better
This commit is contained in:
parent
723f0cf5ef
commit
6967c40143
@ -20,7 +20,7 @@ type Artist struct {
|
|||||||
func NewArtist () (element *Artist) {
|
func NewArtist () (element *Artist) {
|
||||||
element = &Artist { }
|
element = &Artist { }
|
||||||
element.Core, element.core = core.NewCore(element)
|
element.Core, element.core = core.NewCore(element)
|
||||||
element.core.SetMinimumSize(400, 300)
|
element.core.SetMinimumSize(400, 400)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ func (element *Artist) Resize (width, height int) {
|
|||||||
element.core.AllocateCanvas(width, height)
|
element.core.AllocateCanvas(width, height)
|
||||||
bounds := element.Bounds()
|
bounds := element.Bounds()
|
||||||
element.cellBounds.Max.X = bounds.Dx() / 4
|
element.cellBounds.Max.X = bounds.Dx() / 4
|
||||||
element.cellBounds.Max.Y = bounds.Dy() / 4
|
element.cellBounds.Max.Y = (bounds.Dy() - 64) / 4
|
||||||
|
|
||||||
drawStart := time.Now()
|
drawStart := time.Now()
|
||||||
|
|
||||||
@ -90,10 +90,10 @@ func (element *Artist) Resize (width, height int) {
|
|||||||
textDrawer := artist.TextDrawer { }
|
textDrawer := artist.TextDrawer { }
|
||||||
textDrawer.SetFace(defaultfont.FaceRegular)
|
textDrawer.SetFace(defaultfont.FaceRegular)
|
||||||
textDrawer.SetText ([]rune (fmt.Sprintf (
|
textDrawer.SetText ([]rune (fmt.Sprintf (
|
||||||
"%dms\n%dns",
|
"%dms\n%dus",
|
||||||
drawTime.Milliseconds(),
|
drawTime.Milliseconds(),
|
||||||
drawTime.Nanoseconds())))
|
drawTime.Microseconds())))
|
||||||
textDrawer.Draw(element, uhex(0x000000FF), image.Pt(8, 16))
|
textDrawer.Draw(element, uhex(0xFFFFFFFF), image.Pt(8, bounds.Max.Y - 24))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (element *Artist) lines (weight int, bounds image.Rectangle) {
|
func (element *Artist) lines (weight int, bounds image.Rectangle) {
|
||||||
|
Reference in New Issue
Block a user