clip.Path.Quad doesn't work on android

Seems that there's a problem with path.quad():

	gtx.Constraints.Max.Y = gtx.Px(unit.Dp(200))
	heightQuad := float32(gtx.Px(unit.Dp(40)))
	heightRect := float32(gtx.Constraints.Max.Y) - (heightQuad)
	widthAll := float32(gtx.Constraints.Max.X)

	c := clip.Path{}
	c.Move(f32.Pt(0, 0))
	c.Line(f32.Pt(widthAll, 0))
	c.Line(f32.Pt(0, heightRect))
	fmt.Println("pos", c.Pos())
	c.Line(f32.Pt(-widthAll, 0))
	c.Line(f32.Pt(0, -heightRect))
	c.Move(f32.Pt(0, heightRect))
	c.Quad(f32.Pt(widthAll/2, heightQuad), f32.Pt(widthAll, 0))
	outline := clip.Outline{Path: c.End()}
	paint.Fill(gtx.Ops, color.NRGBA{R: 230, G: 24, B: 93, A: 255})

On Windows (and JS on Windows) it works correctly: https://imgur.com/tyEo7Kr

On Android (and JS on Android) it not work: https://imgur.com/mhxK0z4

On Android (with New-Rendering) it works: https://imgur.com/fdGx6Hi

Assigned to
3 months ago
3 months ago
No labels applied.

~eliasnaur 3 months ago

Another example: on my Pixel Android device, enabling "transform" in the kitchen example leaves a blank white window.

I'm probably not going to look at this anytime soon, I'd rather work towards removing the old renderer.

~inkeliz 3 months ago*

That is odd that only on Android it happens, even on JS. I thought that it's related to the PxPerDp, but I think it's not.

I hope that the new render gets better, currently it doesn't work well on 3 out of 4 devices that I have. I send one video about that: https://slack-files.com/T029RQSE6-F01J2G0MKDJ-5a75f6dc25. I need to create some small code to reproduce that issue, but on my app that issue (shown on the video) occurr everytime. It's minimize if I cache the CallOp, but it doesn't fix 100%.

In general:

  • Morotola Droid Maxx: Significantly slower + Image artifacts. (doesn't test too much).
  • Xiaomi 7A: Significantly slower (90ms+ vs 8ms) + Image artifacts + Black Page on rotate (need to touch to display the image again).
  • Morotola E6S: Significantly slower (60ms+ vs 5ms) + Currupted fonts/characters + Long white-screen on startup.
  • Xiaomi Note 9: Significantly slower (25ms+ vs 2ms). (no other issues).

I'm trying to make some small code that causes all the issues above, but I don't figure out what is causing that. However, on my app that is the results.

~eliasnaur 3 months ago

Don't worry, before the old renderer can be removed the new renderer has to switch to be default, which should shake out performance and rendering issues. I have a selection of odd Androids to test on, and I'll be sure to check in with you.

~inkeliz 3 months ago*

I don't know if it helps to find the issue, but...

On Android, using:

c.Cube(f32.Pt(widthAll/2, heightQuad), f32.Pt(widthAll/2, heightQuad), f32.Pt(widthAll, 0))

Creates the same correct curve (i.e: https://imgur.com/fdGx6Hi ).

However... On Windows it's wrong.

On Windows I need to use:

c.Cube(f32.Pt(0, 0), f32.Pt(widthAll/2, heightQuad), f32.Pt(widthAll, 0))

In order to have the same effect (https://imgur.com/tyEo7Kr ). But, it breaks on Android, again.

In general, on Android I need to use the first point to f32.Pt(widthAll/2, heightQuad) and on Windows I need to set it to f32.Pt(0,0). However, on JS it's big problem, because the GOOS is always JS and I can't switch the behavior from Windows/Android. Maybe using some browser detection, but it doesn't seems good.

~inkeliz 3 months ago

I don't know, but anyway...


c.Cube(f32.Pt(widthAll/2, heightQuad), f32.Pt(widthAll/2, heightQuad), f32.Pt(widthAll, 0))

Fixes the problem on all plataforms now. I not sure why it doesn't work at first on Windows. 🤦‍♂️

Register here or Log in to comment, or comment via email.