I am trying to draw a shadow on a form using CALayer
:
You can create an empty Cocoa project in Xcode, replace the contents of your app.delegate.m file with the above code, and try it yourself.
It seems that the specific geometry of the shadow path causes CALayer
go nuts.
For instance:
CGPathAddRect(shadowPath, NULL, CGRectMake(4, 0, 100, 48)); CGPathAddRect(shadowPath, NULL, CGRectMake(120, 50, 116, 48));
This looks completely normal:
Now I'm going to make the first rectangle wider by 20 points:
CGPathAddRect(shadowPath, NULL, CGRectMake(4, 0, 120, 48)); CGPathAddRect(shadowPath, NULL, CGRectMake(120, 50, 116, 48));
... no longer looks so good. Plus 10 points:
CGPathAddRect(shadowPath, NULL, CGRectMake(4, 0, 130, 48)); CGPathAddRect(shadowPath, NULL, CGRectMake(120, 50, 116, 48));
Now this is wrong, isn't it?
So the question is: what the hell is going on, am I doing it wrong or something like that? You think this is a mistake, and I have to file a report?