internal unsafe void __MarshalFrom(ref __Native @ref) { FontFace = (@ref.FontFace == IntPtr.Zero) ? null : new IDWriteFontFace(@ref.FontFace); FontFace?.AddRef(); FontEmSize = @ref.FontEmSize; GlyphCount = @ref.GlyphCount; GlyphIndices = null; GlyphAdvances = null; GlyphOffsets = null; IsSideways = @ref.IsSideways; BidiLevel = @ref.BidiLevel; if (@ref.GlyphIndices != IntPtr.Zero) { GlyphIndices = new short[@ref.GlyphCount]; if (@ref.GlyphCount > 0) fixed(void *indicesPtr = &GlyphIndices[0]) { Unsafe.CopyBlock( indicesPtr, @ref.GlyphIndices.ToPointer(), (uint)(sizeof(short) * @ref.GlyphCount)); } } if (@ref.GlyphAdvances != IntPtr.Zero) { GlyphAdvances = new float[@ref.GlyphCount]; if (@ref.GlyphCount > 0) fixed(void *advancesPtr = &GlyphAdvances[0]) { Unsafe.CopyBlock( advancesPtr, @ref.GlyphAdvances.ToPointer(), (uint)(sizeof(float) * @ref.GlyphCount)); } } if (@ref.GlyphOffsets != IntPtr.Zero) { GlyphOffsets = new GlyphOffset[@ref.GlyphCount]; if (@ref.GlyphCount > 0) fixed(void *offsetsPtr = &GlyphOffsets[0]) { Unsafe.CopyBlock( offsetsPtr, @ref.GlyphOffsets.ToPointer(), (uint)(sizeof(GlyphOffset) * @ref.GlyphCount)); } } }
internal unsafe void __MarshalFrom(ref __Native @ref) { FontFace = (@ref.FontFace == IntPtr.Zero) ? null : new IDWriteFontFace(@ref.FontFace); if (FontFace != null) { FontFace.AddRef(); } FontSize = @ref.FontEmSize; GlyphCount = @ref.GlyphCount; GlyphCount = @ref.GlyphCount; if (@ref.GlyphIndices != IntPtr.Zero) { Indices = new ushort[GlyphCount]; if (GlyphCount > 0) { UnsafeUtilities.Read(@ref.GlyphIndices, Indices, GlyphCount); } } if (@ref.GlyphAdvances != IntPtr.Zero) { Advances = new float[GlyphCount]; if (GlyphCount > 0) { UnsafeUtilities.Read(@ref.GlyphAdvances, Advances, GlyphCount); } } if (@ref.GlyphOffsets != IntPtr.Zero) { Offsets = new GlyphOffset[GlyphCount]; if (GlyphCount > 0) { UnsafeUtilities.Read(@ref.GlyphOffsets, Offsets, GlyphCount); } } IsSideways = @ref.IsSideways; BidiLevel = @ref.BidiLevel; }