gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some diffs to optimize drawing


From: Nicola Pero
Subject: Re: Some diffs to optimize drawing
Date: Sun, 2 Feb 2003 23:44:52 +0000 (GMT)

On Mon, 3 Feb 2003, Alexander Malmberg wrote:

> Nicola Pero wrote:
> [snip]
> > Regarding clipping text in cells - I remember what you say - discussing
> > this issue - years ago - and instead of fixing the text system to only
> > draw in the given rect, hacking it inefficiently by clipping the drawing
> > in the cell.  The hack is still there, but hidden down there in the system
> > - we've moved it inside the string drawing code itself, it's no longer in
> > the cell.  The string drawing code, when given a rect to draw, actually
> > clips drawing to the rect, then forgets about it and inefficiently draws
> > the whole string, even parts of the string which extend outside the rect.
> > 
> > Fixing this issue is still an open task! :-)
> > 
> > But thanks for reminding us - maybe Alexander, in his text system
> > rewriting/upgrade, is interested in looking at that too ? :-)
> 
> I've already looked at it. :) (I'm using a patched NSStringDrawing based
> on the new text system, and noted this when rewriting it.)
> 
> The clipping rect can't be avoided. The text system can only draw whole
> glyphs, so glyphs partially inside the rect have to be handled by the
> clipping rect.

Well - I suppose the idea would be that the clipping rect can be avoided
in *most* cases - in most cases (as you note below) the text is drawn by a
cell, and it's fully visible.

The string drawing code could use clipping *only if* it detects that any
glyph to draw might (partially or entirely) fall outside the given
rect.  Then, it clips to prevent boundary glyphs from falling partially
out.  But in all other cases - which is in most cases - it could avoid
clipping completely.


> There is still some speed to be gained by only drawing glyphs that might
> be inside the rect. There are methods for this, and NSTextView uses
> them, but I haven't done that in NSStringDrawing. I don't think it's a
> big performance hit, though. As far as I know, the only text that should
> pass through NSStringDrawing is text from cells, and that's mostly
> completely visible one line labels.

Yes - I agree - I'm not sure it will be a big performance hit.  Maybe if
we can avoid clipping (as explained above), that might improve
performance, at least in cases like scrolling a browser column in a save
panel, where you draw a lot of cells quickly.  I'm frankly not sure, but
it's worth trying.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]