fix unnecessary copy in PackFontRanges
parent
76684eaa33
commit
300ef9f88e
|
@ -29,13 +29,7 @@ namespace MoonWorks.Graphics.Font
|
||||||
fixed (FontRange *pFontRanges = &fontRanges[0])
|
fixed (FontRange *pFontRanges = &fontRanges[0])
|
||||||
{
|
{
|
||||||
var nativeSize = fontRanges.Length * Marshal.SizeOf<Wellspring.FontRange>();
|
var nativeSize = fontRanges.Length * Marshal.SizeOf<Wellspring.FontRange>();
|
||||||
void* fontRangeMemory = NativeMemory.Alloc((nuint) fontRanges.Length, (nuint) Marshal.SizeOf<Wellspring.FontRange>());
|
var result = Wellspring.Wellspring_PackFontRanges(Handle, (IntPtr) pFontRanges, (uint) fontRanges.Length);
|
||||||
System.Buffer.MemoryCopy(pFontRanges, fontRangeMemory, nativeSize, nativeSize);
|
|
||||||
|
|
||||||
var result = Wellspring.Wellspring_PackFontRanges(Handle, (IntPtr) fontRangeMemory, (uint) fontRanges.Length);
|
|
||||||
|
|
||||||
NativeMemory.Free(fontRangeMemory);
|
|
||||||
|
|
||||||
return result > 0;
|
return result > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue