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:
Alexander Malmberg 2003-05-05 20:52:24 +00:00
parent 4748f21adb
commit 8a2e943bbd
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>
* Documentation/Gui/GNUmakefile: Remove GNUSTEP_MAKEFILES.

View file

@ -330,6 +330,7 @@ layout information.
withShift: (NSSize)shift
inTextContainer: (NSTextContainer *)textContainer;
-(NSRect) _softInvalidateLineFragRect: (int)index
firstGlyph: (unsigned int *)first_glyph
nextGlyph: (unsigned int *)next_glyph
inTextContainer: (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;
NSSize shift;
int i;
unsigned int g, g2;
unsigned int g, g2, first;
float container_height;
/*
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.
*/
r0 = [curLayoutManager _softInvalidateLineFragRect: 0
firstGlyph: &first
nextGlyph: &g
inTextContainer: curTextContainer];
@ -436,28 +437,27 @@ Return values 0, 1, 2 are mostly the same as from
*/
shift.width = 0;
shift.height = curPoint.y - r0.origin.y;
if (shift.height == 0)
{
/*
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;
}
i = 1;
curPoint.y = NSMaxY(r0) + shift.height;
for (; 1; i++)
{
r = [curLayoutManager _softInvalidateLineFragRect: i
firstGlyph: &first
nextGlyph: &g2
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)
break;
g = g2;
curPoint.y = NSMaxY(r) + shift.height;
}

View file

@ -2359,7 +2359,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
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.
*/
if (layout_glyph == glyphs->glyph_length)
@ -2369,6 +2369,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
}
-(NSRect) _softInvalidateLineFragRect: (int)index
firstGlyph: (unsigned int *)first_glyph
nextGlyph: (unsigned int *)next_glyph
inTextContainer: (NSTextContainer *)textContainer
{
@ -2388,6 +2389,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
return NSZeroRect;
lf = &tc->linefrags[tc->num_linefrags + index];
*first_glyph = lf->pos;
*next_glyph = lf->pos + lf->length;
return lf->rect;
}