fix glyph cache

This commit is contained in:
Vadim Lopatin 2014-04-04 10:58:17 +04:00
parent dd13b36bc3
commit b13be29407
2 changed files with 8 additions and 3 deletions

View File

@ -52,7 +52,10 @@ struct GlyphCache
ushort p = glyphIndex >> 8;
if (_glyphs[p] is null)
return null;
return &_glyphs[p][glyphIndex & 0xFF];
ushort i = glyphIndex & 0xFF;
if (_glyphs[p][i].glyphIndex == 0)
return null;
return &_glyphs[p][i];
//if (_array[glyphIndex].glyphIndex)
// return &_array[glyphIndex];
//return null;

View File

@ -159,10 +159,12 @@ class LayoutItems {
// resize all if need to shrink or only resizable are too small to correct delta
needForceResize = delta < 0 || resizableWeight == 0; // || resizableSize * 2 / 3 < delta; // do we need resize non-FILL_PARENT items?
// calculate scale factor: weight / delta * 10000
if (needForceResize)
if (needForceResize && nonresizableSize + resizableSize > 0)
scaleFactor = 10000 * delta / (nonresizableSize + resizableSize);
else
else if (resizableSize > 0)
scaleFactor = 10000 * delta / resizableSize;
else
scaleFactor = 0;
}
//Log.d("VerticalLayout delta=", delta, ", nonres=", nonresizableWeight, ", res=", resizableWeight, ", scale=", scaleFactor);
// find last resized - to allow fill space 1 pixel accurate