mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 17:40:36 +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
|
@ -191,6 +191,21 @@ glyph_run_t *GSLayoutManager_run_for_glyph_index(unsigned int glyphIndex,
|
|||
if (glyphs->glyph_length <= glyphIndex)
|
||||
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;
|
||||
level = SKIP_LIST_DEPTH;
|
||||
h = glyphs;
|
||||
|
@ -223,6 +238,13 @@ glyph_run_t *GSLayoutManager_run_for_glyph_index(unsigned int glyphIndex,
|
|||
*glyph_pos = pos;
|
||||
if (char_pos)
|
||||
*char_pos = cpos;
|
||||
|
||||
#if 0
|
||||
cached_run = (glyph_run_t *)h;
|
||||
cached_pos = pos;
|
||||
cached_cpos = cpos;
|
||||
#endif
|
||||
|
||||
return (glyph_run_t *)h;
|
||||
}
|
||||
}
|
||||
|
@ -900,6 +922,11 @@ it should still be safe. might lose opportunities to merge runs, though.
|
|||
NSRange rng;
|
||||
|
||||
|
||||
/*
|
||||
We always clear out the cached run information to be safe.
|
||||
*/
|
||||
cached_run = NULL;
|
||||
|
||||
/* [self _glyphDumpRuns];
|
||||
printf("range=(%i+%i) lengthChange=%i\n", range.location, range.length, lengthChange);*/
|
||||
range.length -= lengthChange;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue