RectContainsPoint Negative Parameter Bug

I came across a bug earlier today: If the size input of a rectangle is negative, the RectContainsPoint Node doesnt recognize if a point is inside. Therefore the bool output of the node never turns true. Tested in 7.0 and 7.1.

Since this is my first post, I cannot attach the file but here is a screenshot:

hey bilimboyo,

confirmed and thanks for bringing this up, it has indeed been mentioned before.

as to whether this is a bug or not, it feels at least inconsistent between Skia rendering of rects and their hittest. since a change to this would be potentially breaking existing patches we’ve decided to rather not touch this.

instead, we’d like to encourage those who run into the issue to see if they can prevent this in their patch by asking the question: do negative sizes really make sense here?

hey joreg,

i don’t really see the point where a working rect contains point for negative sizes would break existing patches, but i don’t know the inner workings so i trust you on this & of course negative sizes don’t really make sense.
But it took 3 people some hours to find out why it was broken since we usually suspect that our work is causing things to not work :). Its also embedded in a way bigger framework of nodes.

To not risk breaking anything, would there be at least the option to add a Warning Log entry as soon as you feed in negative size bounds? That at least would immensly speed up troubleshooting.

While looking at this in more detail I just had a look at all Skia Primitives and they do really behave inconsistent with negative bounds and in my opinion should either:

  • all not draw with negative size bounds
  • all draw with negative size bounds

Nothing for right now but maybe for 8.0 :)

rectContainsBug.vl (53.1 KB)

1 Like

so it is the Circle and the DrawImage that don’t draw with negative size. for the circle it is specified that way in the original skia docs. for the drawimage i don’t find any mention but we’re not doing anything special there, so have to assume it is simply how the underlying graphics api is handling this.