Memory Optimisation
This commit is contained in:
parent
33f8ef9ee0
commit
771f360a66
@ -10,7 +10,7 @@
|
||||
<IncludeSymbols>False</IncludeSymbols>
|
||||
<RepositoryUrl>https://git.jacobtech.com/JacobTech.com/GraphicsManager</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<Version>1.0.9-alpha01</Version>
|
||||
<Version>1.0.9-alpha07</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
|
@ -43,7 +43,8 @@ public class FontFamily
|
||||
void tryadd(FontSize s, bool i = false)
|
||||
{
|
||||
var memoryStream = new MemoryStream();
|
||||
font.Open().CopyTo(memoryStream);
|
||||
var ss = font.Open();
|
||||
ss.CopyTo(memoryStream);
|
||||
if (i)
|
||||
{
|
||||
if (!f.SInternalFontsi.ContainsKey(s))
|
||||
@ -54,6 +55,7 @@ public class FontFamily
|
||||
if (!f.SInternalFonts.ContainsKey(s))
|
||||
f.SInternalFonts.Add(s, new(memoryStream, null));
|
||||
}
|
||||
ss.Dispose();
|
||||
}
|
||||
|
||||
if (fd.EndsWith("italic"))
|
||||
@ -82,7 +84,7 @@ public class FontFamily
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FamilyZip.Dispose();
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -111,10 +111,12 @@ public class FontInteraction
|
||||
case true:
|
||||
Families_[j].SInternalFontsi[fs] = new(f.Item1,
|
||||
Font.MakeFontFromStream(Families_[j].SInternalFontsi[fs].Item1));
|
||||
Families_[j].SInternalFontsi[fs].Item1.Dispose();
|
||||
break;
|
||||
case false:
|
||||
Families_[j].SInternalFonts[fs] = new(f.Item1,
|
||||
Font.MakeFontFromStream(Families_[j].SInternalFonts[fs].Item1));
|
||||
Families_[j].SInternalFonts[fs].Item1.Dispose();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -221,9 +223,11 @@ public class FontInteraction
|
||||
{
|
||||
case true:
|
||||
Families_[j].SInternalFontsi[fs] = new(f.Item1, Font.MakeFontFromStream(Families_[j].SInternalFontsi[fs].Item1));
|
||||
Families_[j].SInternalFontsi[fs].Item1.Dispose();
|
||||
break;
|
||||
case false:
|
||||
Families_[j].SInternalFonts[fs] = new(f.Item1, Font.MakeFontFromStream(Families_[j].SInternalFonts[fs].Item1));
|
||||
Families_[j].SInternalFonts[fs].Item1.Dispose();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -202,6 +202,42 @@ public class Label : ILabel
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2i GetCharLocation(int index)
|
||||
{
|
||||
int line = 0;
|
||||
double nl = 0;
|
||||
double addy = 0f, addy2 =0f, addx = 0F, char_x = 0F;
|
||||
for (int i = 0; i < index; i++)
|
||||
{
|
||||
char character;
|
||||
if (PasswordChar is null)
|
||||
character = Text[i];
|
||||
else
|
||||
character = PasswordChar.Value;
|
||||
|
||||
if (character == '\n')
|
||||
{
|
||||
char_x = 0f;
|
||||
nl = addy;
|
||||
line++;
|
||||
continue;
|
||||
}
|
||||
Character cha = Texture.GetChar(Font, character);
|
||||
double w = cha.Size.X * Scale;
|
||||
double xrel = char_x + cha.Bearing.X * Scale;
|
||||
double yrel = ((cha.Size.Y - cha.Bearing.Y) * Scale) + (Font.PixelHeight * Scale);
|
||||
yrel += nl;
|
||||
char_x += (cha.Advance >> 6) * Scale;
|
||||
if ((xrel + w) >= addx) addx = (xrel + w);
|
||||
if (yrel > addy) addy = yrel;
|
||||
if (line == 0)
|
||||
{
|
||||
if (addy2 < cha.Bearing.Y) addy2 = cha.Bearing.Y;
|
||||
}
|
||||
}
|
||||
return new((int)addx, (int)(line * Font.ExtraLinePixels) + (int)(Font.PixelHeight * line));
|
||||
}
|
||||
|
||||
public void Clean()
|
||||
{
|
||||
Tuple<int, int, int> tup = GlobalBuffers[Window!.Context];
|
||||
|
Loading…
Reference in New Issue
Block a user