Dirty rects getting merged together makes for inefficient drawing
Dirty rects getting merged together makes for inefficient drawing
- Subject: Dirty rects getting merged together makes for inefficient drawing
- From: Ben Haller <email@hidden>
- Date: Mon, 19 Oct 2009 17:12:37 -0400
Hi all. I expected this to be an FAQ, but my searches have turned
up nothing relevant, so here goes.
I've got a window with a view hierarchy like this:
1. Superview that does no drawing and is not opaque
A. Subview #1: a tableview that is opaque
B. Subview #2: a graph view that is opaque
C. Subview #3: another graph view that is opaque
The tableview is on top, the two graph are on the bottom, on the
left and on the right respectively. My app alternates calculating and
drawing the results. Typically, what needs to get drawn is *one*
column of the tableview, plus both graphs. I'm carefully calling
setNeedsDisplayInRect: for only the bits that need to be drawn; I'm
using [frameOfCellAtColumn:row:] to get the frame of the cells that
need to be redrawn, and invalidating only them, for example.
If I turn off all redrawing of the graphs, then Quartz Debug shows
me that my invalidating in the tableview is minimal; only the column
that needs to be drawn flashes. If I turn off all redrawing of the
tableview, QuartzDebug similarly shows that my invalidating in the
graphs is minimal. So taken separately, it's all good. But when
drawing of all the views is turned on, somebody is merging together
the dirty rects and causing pretty much the entire content of the
window to redraw. This means that a ton of extra table cells are
redrawing unnecessarily, and I see the overhead from this very clearly
in Instruments/Sampler (text drawing is not fast!).
So my question is: is there any way I can exert any control over
the merging of dirty rects? I thought maybe adding some vertical
space between the tableview and the graph views would "disconnect"
them and make the dirty rects get handled separately; but no dice;
even adding 100 pixels of vertical space doesn't prevent the merge.
Is the merging dependent upon the view hierarchy or opacity in some
way? Or are there CG calls somewhere in the bowels that I could use
to change a "merge threshold" or something?
I'm not sure whether this is a Cocoa or a CG question really, but
since I'm using nothing but Cocoa calls at present, I figured I'd try
this list first...
Thanks!
Ben Haller
Stick Software
_______________________________________________
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