private Result Clear(IntPtr devicePointer, int count, IntPtr rects, ClearFlags flags, ColorBGRA color, float z, int stencil) { try { var structSize = Marshal.SizeOf(typeof(Rectangle)); var structs = new SharpDX.Rectangle[count]; for (int i = 0; i < count; i++) { structs[i] = (SharpDX.Rectangle)Marshal.PtrToStructure(rects, typeof(SharpDX.Rectangle)); } var rectangles = structs; this.Log.LogMethodSignatureTypesAndValues(devicePointer, count, rectangles.PrintTypesNamesValues(), flags, color, z, stencil); this.GetOrCreateDevice(devicePointer); if (rectangles.Length == 0) { this.Device.Clear(flags, color, z, stencil); } else { this.Device.Clear(flags, color, z, stencil, rectangles); } } catch (SharpDXException ex) { Log.Warn(ex); } catch (Exception ex) { this.Log.Fatal(ex); } return(Result.Ok); }
private Result Clear(IntPtr devicePointer, int count, IntPtr rects, ClearFlags flags, ColorBGRA color, float z, int stencil) { try { var structSize = Marshal.SizeOf(typeof(Rectangle)); var structs = new SharpDX.Rectangle[count]; for (int i = 0; i < count; i++) { structs[i] = (SharpDX.Rectangle)Marshal.PtrToStructure(rects, typeof(SharpDX.Rectangle)); } var rectangles = structs; this.Log.LogMethodSignatureTypesAndValues(devicePointer, count, rectangles.PrintTypesNamesValues(), flags, color, z, stencil); this.GetOrCreateDevice(devicePointer); if (rectangles.Length == 0) this.Device.Clear(flags, color, z, stencil); else this.Device.Clear(flags, color, z, stencil, rectangles); } catch (SharpDXException ex) { Log.Warn(ex); } catch (Exception ex) { this.Log.Fatal(ex); } return Result.Ok; }