Re: _NSWarnForDrawingImageWithNoCurrentContext
Re: _NSWarnForDrawingImageWithNoCurrentContext
- Subject: Re: _NSWarnForDrawingImageWithNoCurrentContext
- From: "Stephen J. Butler" <email@hidden>
- Date: Mon, 16 Dec 2013 17:57:30 -0600
Did you try the suggestion the warning listed? Breaking on "void
_NSWarnForDrawingImageWithNoCurrentContext()"? Because a stack trace for
when the error occurs would be helpful.
On Sat, Dec 14, 2013 at 6:32 AM, Leonardo <email@hidden> wrote:
> Hi, when I rotate my NSView, my image disappears for a second from the
> screen and I get this error message
>
> It does not make sense to draw an image when [NSGraphicsContext
> currentContext] is nil. This is a programming error. Break on void
> _NSWarnForDrawingImageWithNoCurrentContext() to debug. This will be logged
> only once. This may break in the future.
>
> So I have put a symbolic breakpoint there and I have found the line causing
> the error, which is in NSView's drawRect method:
>
> [mImage drawInRect:inRect fromRect:fillRect operation:NSCompositeSourceOver
> fraction:mOpacity];
>
> When the image disappears, I can quite see a white rectangle coming from my
> line
>
> NSRectFillUsingOperation(myBounds, NSCompositeSourceOver);
>
> So I'm sure myBounds rect is ok. To tune up my test I made sure that mImage
> is never nil and has positive size, iRect and fillRect have always positive
> size too and they never change, mOpacity is always 1.0 and the current
> context is always not nil. As my log says:
>
> imageSize 1251 x 705, inRect {{0, 0}, {300, 200}}, fillRect {{97, 0},
> {1057,
> 705}}, mOpacity 1.0, frameCenterRotation 2.647995, current context is not
> nil
>
> The error occurs when I rotate the view with frameCenterRotation, but not
> at
> any degree.
>
> - (void)setMAngle:(CGFloat)value
> {
> mAngle = value;
> [self setFrameCenterRotation:mAngle];
> [self setNeedsDisplay:YES];
> }
>
> For example, if I still rotate the NSView to frameCenterRotation 4.689613 I
> can quite see the image and I don't get the error.
> Furthermore, if I replace mOpacity with a fixed value 1.0 in the code
>
> [mImage drawInRect:inRect fromRect:fillRect operation:NSCompositeSourceOver
> fraction:1.0];
>
> the error NEVER occurs. However even using the CGFload variable mOpacity
> always = 1.0, the problem sometimes occurs when I rotate the view.
> Just to be sure I have even overrided the isOpaque method returning NO.
> Same
> trouble.
> I'm really puzzled. Any idea?
>
>
> Regards
> -- Leonardo
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden