IPHONE – Do you have any performance loss when you call UIGRAPHICSGETCURRENTCONTEXT?

I am building a UIView with a custom drawRect function. This is a fairly complex view that requires drawing many different items. I basically break it down into each need to be drawn A function of the project.

What I want to know is should I pass the CGContextRef obtained from UIGraphicsGetCurrentContext() as a parameter to each function, or can I call it at the beginning of each function ? The latter option seems more suitable for me, but I want to know if there is a lot of performance loss?

It’s the same, unless you are saving/restoring the context. Anyway, get from this method Context is likely to never become a bottleneck.

I suggest that if you don’t save and restore state, you can use UIGraphicsGetCurrentContext(). However, if you are indeed saving state, then you should pass this , Because it will be easier to read your code.

I think this is a style issue…

I am building a UIView that defines the drawRect function. This is a fairly complex view that requires drawing many different items. I basically break it down into a function for each item that needs to be drawn.

I think What I know is should I pass the CGContextRef obtained from UIGraphicsGetCurrentContext() as a parameter to each function, or can I call it at the beginning of each function? The latter option seems more suitable for me, but I want to know if there is a lot of performance loss?

It is the same unless you are saving/restoring the context. In any case, getting the context from this method will most likely never become a bottleneck.

I suggest that if you don’t save and restore the state, you can use UIGraphicsGetCurrentContext(). However, if you are indeed saving the state, then you should pass this because it will be easier to read your code. < /p>

I think this is a style issue…

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1110 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.