Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering of not changed canvas objects after an event (after eg. Button move over) #3211

Closed
2 tasks done
renlite opened this issue Aug 18, 2022 · 4 comments
Closed
2 tasks done
Labels
unverified A bug that has been reported but not verified

Comments

@renlite
Copy link
Contributor

renlite commented Aug 18, 2022

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

After an event occurs all canvas objects (eg. line, rectangle) on the screen will be rerendered, even though only one Widget has changed. This may affect the painting performance especially on Web (GL ES).

How to reproduce

  1. Set a breakpoint in internal/painter/gl/draw.go in the method func (p *painter) drawObject(o fyne.CanvasObject, pos fyne.Position, frame fyne.Size) {...}
  2. Move over a Button, click the Button and leave the Button
  3. The Button events will rerender all object on the screen, not only the objects of the Button that has changed

Screenshots

image

Example code

func (p *painter) drawObject(o fyne.CanvasObject, pos fyne.Position, frame fyne.Size) {
	switch obj := o.(type) {
	case *canvas.Circle:
		p.drawCircle(obj, pos, frame)
	case *canvas.Line:
		p.drawLine(obj, pos, frame)
	case *canvas.Image:
		p.drawImage(obj, pos, frame)
	case *canvas.Raster:
		p.drawRaster(obj, pos, frame)
	case *canvas.Rectangle:
		p.drawRectangle(obj, pos, frame)
	case *canvas.Text:
		p.drawText(obj, pos, frame)
	case *canvas.LinearGradient:
		p.drawGradient(obj, p.newGlLinearGradientTexture, pos, frame)
	case *canvas.RadialGradient:
		p.drawGradient(obj, p.newGlRadialGradientTexture, pos, frame)
	}
}

Fyne version

branche: develop

Go compiler version

1.17

Operating system

Windows

Operating system version

Windows 10

Additional Information

@renlite renlite added the unverified A bug that has been reported but not verified label Aug 18, 2022
@gavinwade12
Copy link
Contributor

Could you please provide a minimal version of your example code so this issue can easily be reproduced? :)

@renlite
Copy link
Contributor Author

renlite commented Aug 19, 2022

You can find the example in PR #3121: example/flexrect.go
In the draw.go there are println()commands included.
But the issue should happen on the master branche too.

@andydotxyz
Copy link
Member

Sounds like something is invalidating a texture that it shouldn't...
We don't have partial re-render so when the UI must paint we have to paint every element (from cache).
In the case of a button hover only the rectangle should be rendered, though all of them will be painted.

andydotxyz added a commit to andydotxyz/fyne that referenced this issue Dec 15, 2022
@andydotxyz
Copy link
Member

Resolved on develop ready for v2.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

3 participants