• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect


  • Subject: Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
  • From: David Duncan <email@hidden>
  • Date: Mon, 14 Apr 2008 13:01:08 -0700

On Apr 14, 2008, at 12:46 PM, Carter R. Harrison wrote:

I'm getting the reference to the context by using:

CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];

in my view's initWithFrame: method.

Which isn't guaranteed to be anything in particular (and could in fact be NULL).


Based upon what you said, how would you recommend I draw to a CGLayer prior to the first invocation of drawRect: (at which point I could initialize a CGContextRef instance variable)?


You can't practically. All you can do is wait for your first - drawRect:, detect that you haven't created the CGLayer and do so (and draw to the layer) and then proceed as normal.

Now, if you really just want to record some drawing that you use over and over and over again, then you can just draw to a bitmap context and grab an image of that context to draw. It should have very similar performance characteristics for drawing, but will be easier for the system to manage (since an image is immutable).
--
David Duncan
Apple DTS Animation and Printing
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


References: 
 >EXC_BAD_ACCESS when calling CGContextDrawLayerInRect (From: "Carter R. Harrison" <email@hidden>)
 >Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect (From: Nathan Vander Wilt <email@hidden>)
 >Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect (From: "Carter R. Harrison" <email@hidden>)
 >Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect (From: David Duncan <email@hidden>)
 >Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect (From: "Carter R. Harrison" <email@hidden>)

  • Prev by Date: Re: NSString value mangled in NSDictionary with Garbage Collection
  • Next by Date: Re: how should I go about downloading files
  • Previous by thread: Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
  • Next by thread: Re: Re: EXC_BAD_ACCESS when calling CGContextDrawLayerInRect
  • Index(es):
    • Date
    • Thread