Hey, I’m facing a strange issue which is, as far as I tested it, related to the resolution of the Retina display. I’m drawing level meters in my audio plugin using the fillRect(…) function. The values used are all rounded to whole numbers (but declared as floats). Now, even when the level meter is zero (so no rectangle is drawn at all), there are three thin lines visible on a Retina display. On any other display it is all rendered fine.
Do you have an idea why? Is it some kind of rounding issue maybe?
I added some screenshots to explain the issue a bit better.
Thank you for your suggestion, but I’m really just drawing simple rectangles… But I do a lot of computation for the size of the rectangles, since it must be resizable and also depending from the components size…
So I do things like that for computing the width of the meterse.g.: const float meterWidth = ceil((getWidth() - scaleWidth - meterSpacing * (levels.size()-1)) / levels.size());
The lines are leftovers of the background rectangles, which have the colors of the visible meters. The meters theirselves are drawn over this background in the color of the parent component’s background to indicate the actual audio level. I think this is a common way to do these kind of things.
The interesting point for me is that the computation of the width of the background rectangles and the foreground rectangles (the actual always repainting levels) are computed the same, see above. Also their X-coordinate is the same. There are also no issues at all if I don’t use a Retina display.
I also tried drawing the rectangles with fixed values such as 15.0f for the width for example. Same result. So i guess, it must depend that I use fillRect with float values? Does it somehow behave differently on a Retina display maybe?