Replaced tomo.Image with tomo.Canvas and tomo.Pattern
This is the first step in transitioning the API over to the new design. The new tomo.Canvas interface gives drawing functions direct access to data buffers and eliminates overhead associated with calling functions for every pixel. The entire artist package will be remade around this.
This commit is contained in:
@@ -57,7 +57,7 @@ func (element *Container) Adopt (child tomo.Element, expand bool) {
|
||||
|
||||
return
|
||||
},
|
||||
Draw: func (region tomo.Image) {
|
||||
Draw: func (region tomo.Canvas) {
|
||||
element.drawChildRegion(child, region)
|
||||
},
|
||||
})
|
||||
@@ -318,10 +318,9 @@ func (element *Container) recalculate () {
|
||||
func (element *Container) draw () {
|
||||
bounds := element.core.Bounds()
|
||||
|
||||
artist.Rectangle (
|
||||
artist.FillRectangle (
|
||||
element.core,
|
||||
theme.BackgroundImage(),
|
||||
nil, 0,
|
||||
bounds)
|
||||
|
||||
for _, entry := range element.children {
|
||||
@@ -329,7 +328,7 @@ func (element *Container) draw () {
|
||||
}
|
||||
}
|
||||
|
||||
func (element *Container) drawChildRegion (child tomo.Element, region tomo.Image) {
|
||||
func (element *Container) drawChildRegion (child tomo.Element, region tomo.Canvas) {
|
||||
if element.warping { return }
|
||||
for _, entry := range element.children {
|
||||
if entry.Element == child {
|
||||
|
||||
@@ -93,10 +93,9 @@ func (element *Label) updateMinimumSize () {
|
||||
func (element *Label) draw () {
|
||||
bounds := element.core.Bounds()
|
||||
|
||||
artist.Rectangle (
|
||||
artist.FillRectangle (
|
||||
element.core,
|
||||
theme.BackgroundImage(),
|
||||
nil, 0,
|
||||
bounds)
|
||||
|
||||
textBounds := element.drawer.LayoutBounds()
|
||||
|
||||
Reference in New Issue
Block a user