Using drawInRect I’m getting inconsistent results
Sometimes the images draw correctly, and sometimes the images look like they are half a pixel off:

On the top left, you’ll see that the cap image of the slider draws normal, then the fill has blurry edges, even though they are drawn with the same x, y …
// top cap
[topCap drawInRect:NSMakeRect(5, 5, 11, 7)
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1];
// background fill
[topFill drawInRect:NSMakeRect(5, 12, 11, (CGRectGetHeight(aRect) - 23))
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1];
Bottom left arrow, the same situation.
Center right arrow, similar situation. You can see the left cap image renders correctly, then the background fill (a 1px wide image) gets all blurry.
I’m wondering if it has something to do with stretching the image, because it seems the images that I’m trying to fill a rectangle with render poorly.
Thanks for any insight.
If you know why drawInRect distorts the image please leave an answer. Here is the way I found to get around this:
For some areas I used
colorWithPatternImageThe problem I ran into with this is that the pattern origin is set to the window not the view, so sometimes the pattern would misalign.
For several areas I used
NSDrawThreePartImagewhich correctly tiled the image without distorting it. Even when I did not have 3 images, I just put the same image in 3 times.