private void LoadSurfaces(ref List <DrawSurfaceTask> tasks, IntPtr group, uint cnt) { Util.CheckInterop(); if (tasks == null) { tasks = new List <DrawSurfaceTask>((int)cnt); } else { tasks.Clear(); } for (uint i = 0; i < cnt; i++) { DrawSurfaceTask t; IntPtr pm = IntPtr.Zero, ptc = IntPtr.Zero, ptm = IntPtr.Zero, pbs = IntPtr.Zero; BrowserInterop.vtsDrawsSurfaceTask(group, i, ref pm, ref ptc, ref ptm, ref pbs); Util.CheckInterop(); if (pm == IntPtr.Zero) { continue; } t.data = (DrawSurfaceBase)Marshal.PtrToStructure(pbs, typeof(DrawSurfaceBase)); t.mesh = Load(pm); t.texColor = Load(ptc); t.texMask = Load(ptm); tasks.Add(t); } }