Detect and handle gaps in the soft invalidated layout information.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16639 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2003-05-05 20:52:24 +00:00
parent da7cc04c00
commit 0c29bdf045
4 changed files with 25 additions and 16 deletions

View file

@ -1,3 +1,9 @@
2003-05-05 22:48 Alexander Malmberg <alexander@malmberg.org>
* Headers/gnustep/gui/GSLayoutManager.h, Source/GSLayoutManager.m,
Source/GSHorizontalTypesetter.m: Detect and handle gaps in the soft
invalidated layout information.
2003-05-02 Adam Fedor <fedor@gnu.org> 2003-05-02 Adam Fedor <fedor@gnu.org>
* Documentation/Gui/GNUmakefile: Remove GNUSTEP_MAKEFILES. * Documentation/Gui/GNUmakefile: Remove GNUSTEP_MAKEFILES.

View file

@ -330,6 +330,7 @@ layout information.
withShift: (NSSize)shift withShift: (NSSize)shift
inTextContainer: (NSTextContainer *)textContainer; inTextContainer: (NSTextContainer *)textContainer;
-(NSRect) _softInvalidateLineFragRect: (int)index -(NSRect) _softInvalidateLineFragRect: (int)index
firstGlyph: (unsigned int *)first_glyph
nextGlyph: (unsigned int *)next_glyph nextGlyph: (unsigned int *)next_glyph
inTextContainer: (NSTextContainer *)textContainer; inTextContainer: (NSTextContainer *)textContainer;
-(unsigned int) _softInvalidateFirstGlyphInTextContainer: (NSTextContainer *)textContainer; -(unsigned int) _softInvalidateFirstGlyphInTextContainer: (NSTextContainer *)textContainer;

View file

@ -415,7 +415,7 @@ Return values 0, 1, 2 are mostly the same as from
NSRect r0, r; NSRect r0, r;
NSSize shift; NSSize shift;
int i; int i;
unsigned int g, g2; unsigned int g, g2, first;
float container_height; float container_height;
/* /*
Ask the layout manager for soft-invalidated layout for the current Ask the layout manager for soft-invalidated layout for the current
@ -424,6 +424,7 @@ Return values 0, 1, 2 are mostly the same as from
tell the layout manager to use the soft-invalidated information. tell the layout manager to use the soft-invalidated information.
*/ */
r0 = [curLayoutManager _softInvalidateLineFragRect: 0 r0 = [curLayoutManager _softInvalidateLineFragRect: 0
firstGlyph: &first
nextGlyph: &g nextGlyph: &g
inTextContainer: curTextContainer]; inTextContainer: curTextContainer];
@ -436,28 +437,27 @@ Return values 0, 1, 2 are mostly the same as from
*/ */
shift.width = 0; shift.width = 0;
shift.height = curPoint.y - r0.origin.y; shift.height = curPoint.y - r0.origin.y;
if (shift.height == 0) i = 1;
{ curPoint.y = NSMaxY(r0) + shift.height;
/*
If we don't need to shift, we know that everything will fit,
so we just need the last rectangle so we can update the
current point and glyph.
*/
i = [curLayoutManager _softInvalidateNumberOfLineFragsInTextContainer: curTextContainer];
i--;
}
else
{
i = 1;
}
for (; 1; i++) for (; 1; i++)
{ {
r = [curLayoutManager _softInvalidateLineFragRect: i r = [curLayoutManager _softInvalidateLineFragRect: i
firstGlyph: &first
nextGlyph: &g2 nextGlyph: &g2
inTextContainer: curTextContainer]; inTextContainer: curTextContainer];
/*
If there's a gap in soft invalidated information, we need to
fill it in before we can continue.
*/
if (first != g)
{
break;
}
if (NSEqualRects(r, NSZeroRect) || NSMaxY(r) + shift.height > container_height) if (NSEqualRects(r, NSZeroRect) || NSMaxY(r) + shift.height > container_height)
break; break;
g = g2; g = g2;
curPoint.y = NSMaxY(r) + shift.height; curPoint.y = NSMaxY(r) + shift.height;
} }

View file

@ -2359,7 +2359,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
layout_glyph = tc->pos + tc->length; layout_glyph = tc->pos + tc->length;
/* /*
We must have layouts beyond all the soft-invalidated line frags, We must have glyphs beyond all the soft-invalidated line frags,
so comparing with glyphs->glyph_length is ok. so comparing with glyphs->glyph_length is ok.
*/ */
if (layout_glyph == glyphs->glyph_length) if (layout_glyph == glyphs->glyph_length)
@ -2369,6 +2369,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
} }
-(NSRect) _softInvalidateLineFragRect: (int)index -(NSRect) _softInvalidateLineFragRect: (int)index
firstGlyph: (unsigned int *)first_glyph
nextGlyph: (unsigned int *)next_glyph nextGlyph: (unsigned int *)next_glyph
inTextContainer: (NSTextContainer *)textContainer inTextContainer: (NSTextContainer *)textContainer
{ {
@ -2388,6 +2389,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
return NSZeroRect; return NSZeroRect;
lf = &tc->linefrags[tc->num_linefrags + index]; lf = &tc->linefrags[tc->num_linefrags + index];
*first_glyph = lf->pos;
*next_glyph = lf->pos + lf->length; *next_glyph = lf->pos + lf->length;
return lf->rect; return lf->rect;
} }