Severe Ruby rendering issue
Posted: Thu Jan 22, 2015 8:58 pm
This is not related to the newest version, so I post it here. The issue is hard to describe and difficult to present in a schematic. Instead I made a graphic to make it more obvious.
Here's the scenario: You want to compose a grid out of rectangles. In the graphic below the chess-board-pattern represents the pixels of an area, the red lines are the rectangles, white is an area outside a view's area
The rectangles are supposed to have a width and height of 4. So, when drawing from pixel 1, they cover pixels 1, 2, 3 and 4. Or, when starting at 0, they cover 0, 1, 2 and 3. If you now draw the rectangles in a loop, stepping plus 4 pixels, you get the second graphic as a result. If you do the same thing in Ruby instead of your painting app, you get the third graphic as result. You can clearly see that the dimensions are misinterpreted. A width of 4 results in a width of 5. 1 pixel off, exactly, each time, no matter how you draw. Of course, I did set smoothing off and tried with both, normal and inset alignment. Every time the same issue.
The last two graphics show why this is so severe. You have a view area of exactly 8 pixels. The graphic to the left shows how it should look like, the one to the right shows what Flowstone produces. You can clearly see, how it is drawing outside the view area. You don't see this from the view. But you see it immediatly when using that view in another view that's larger. All of a sudden the lines to the right and bottom are drawn! Even worse, this behavior also extends the area for generated redraw orders. I placed two views adjacent. That means, whatever one does can't influence the other. And indeed it behaves so normally.
But when Flowstone extends the area unwillingly it is continously influenced by the other view, leading to continous redraws. From my tests I had thousands of redraws in just seconds, and the redrawing only ends if the other view is moved by one pixel (ctrl+arrow).
This all is giving me headaches and also is the reason for the delay in updates for the sprite font engine.
Here's the scenario: You want to compose a grid out of rectangles. In the graphic below the chess-board-pattern represents the pixels of an area, the red lines are the rectangles, white is an area outside a view's area
The rectangles are supposed to have a width and height of 4. So, when drawing from pixel 1, they cover pixels 1, 2, 3 and 4. Or, when starting at 0, they cover 0, 1, 2 and 3. If you now draw the rectangles in a loop, stepping plus 4 pixels, you get the second graphic as a result. If you do the same thing in Ruby instead of your painting app, you get the third graphic as result. You can clearly see that the dimensions are misinterpreted. A width of 4 results in a width of 5. 1 pixel off, exactly, each time, no matter how you draw. Of course, I did set smoothing off and tried with both, normal and inset alignment. Every time the same issue.
The last two graphics show why this is so severe. You have a view area of exactly 8 pixels. The graphic to the left shows how it should look like, the one to the right shows what Flowstone produces. You can clearly see, how it is drawing outside the view area. You don't see this from the view. But you see it immediatly when using that view in another view that's larger. All of a sudden the lines to the right and bottom are drawn! Even worse, this behavior also extends the area for generated redraw orders. I placed two views adjacent. That means, whatever one does can't influence the other. And indeed it behaves so normally.
But when Flowstone extends the area unwillingly it is continously influenced by the other view, leading to continous redraws. From my tests I had thousands of redraws in just seconds, and the redrawing only ends if the other view is moved by one pixel (ctrl+arrow).
This all is giving me headaches and also is the reason for the delay in updates for the sprite font engine.