mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-28 20:10:51 +00:00
Add some framework support for caching the last accessed run.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15980 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d48a4c2c3a
commit
901b07f83e
3 changed files with 42 additions and 1 deletions
|
@ -1,4 +1,9 @@
|
||||||
2003-02-16 02:08 Alexander Malmberg <alexander@malmberg.org>
|
2003-02-17 02:16 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
|
* Headers/gnustep/gui/GSLayoutManager.h, Source/GSLayoutManager.m:
|
||||||
|
Add some framework support for caching the last accessed run.
|
||||||
|
|
||||||
|
2003-02-17 02:08 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Source/NSLayoutManager.m (-rectArrayForGlyphRange:
|
* Source/NSLayoutManager.m (-rectArrayForGlyphRange:
|
||||||
withinSelectedGlyphRange:inTextContainer:rectCount:,
|
withinSelectedGlyphRange:inTextContainer:rectCount:,
|
||||||
|
|
|
@ -84,6 +84,15 @@ how it's supposed to work. It's functional and correct, but it isn't fast. */
|
||||||
/* For -rectArrayForGlyphRange:... */
|
/* For -rectArrayForGlyphRange:... */
|
||||||
NSRect *rect_array;
|
NSRect *rect_array;
|
||||||
int rect_array_size;
|
int rect_array_size;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Cached run. GSHorizontalTypesetter (and other typesetters, presumably)
|
||||||
|
often walk linearly through the glyphs. Thus, for many methods, we cache
|
||||||
|
the last run so we can quickly get more information for the next glyph.
|
||||||
|
*/
|
||||||
|
struct GSLayoutManager_glyph_run_s *cached_run;
|
||||||
|
int cached_pos, cached_cpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,21 @@ glyph_run_t *GSLayoutManager_run_for_glyph_index(unsigned int glyphIndex,
|
||||||
if (glyphs->glyph_length <= glyphIndex)
|
if (glyphs->glyph_length <= glyphIndex)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (cached_run)
|
||||||
|
{
|
||||||
|
if (glyphIndex >= cached_pos &&
|
||||||
|
glyphIndex < cached_pos + cached_run->head.glyph_length)
|
||||||
|
{
|
||||||
|
if (glyph_pos)
|
||||||
|
*glyph_pos = cached_pos;
|
||||||
|
if (char_pos)
|
||||||
|
*char_pos = cached_cpos;
|
||||||
|
return cached_run;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
pos = cpos = 0;
|
pos = cpos = 0;
|
||||||
level = SKIP_LIST_DEPTH;
|
level = SKIP_LIST_DEPTH;
|
||||||
h = glyphs;
|
h = glyphs;
|
||||||
|
@ -223,6 +238,13 @@ glyph_run_t *GSLayoutManager_run_for_glyph_index(unsigned int glyphIndex,
|
||||||
*glyph_pos = pos;
|
*glyph_pos = pos;
|
||||||
if (char_pos)
|
if (char_pos)
|
||||||
*char_pos = cpos;
|
*char_pos = cpos;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
cached_run = (glyph_run_t *)h;
|
||||||
|
cached_pos = pos;
|
||||||
|
cached_cpos = cpos;
|
||||||
|
#endif
|
||||||
|
|
||||||
return (glyph_run_t *)h;
|
return (glyph_run_t *)h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -900,6 +922,11 @@ it should still be safe. might lose opportunities to merge runs, though.
|
||||||
NSRange rng;
|
NSRange rng;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
We always clear out the cached run information to be safe.
|
||||||
|
*/
|
||||||
|
cached_run = NULL;
|
||||||
|
|
||||||
/* [self _glyphDumpRuns];
|
/* [self _glyphDumpRuns];
|
||||||
printf("range=(%i+%i) lengthChange=%i\n", range.location, range.length, lengthChange);*/
|
printf("range=(%i+%i) lengthChange=%i\n", range.location, range.length, lengthChange);*/
|
||||||
range.length -= lengthChange;
|
range.length -= lengthChange;
|
||||||
|
|
Loading…
Reference in a new issue