private SurfaceImageSourceInterop CreateSurfaceImageSource(BrushType type, Rect r1, float[] args1, Rect r2, float[] args2) { SurfaceImageSourceInterop sis = null; if (type == BrushType.SIS) { sis = new SurfaceImageSourceInterop(400, 400); } else { sis = new VirtualSurfaceImageSourceInterop(400, 400); } sis.SetDevice(dxgiDevice); SurfaceImageSourceWrapper surfaceImageSourceWrapper = new SurfaceImageSourceWrapper(sis, r1, args1, r2, args2, dxgiDevice); // Add a call back to redraw VSIS if (type == BrushType.VSIS) { ((VirtualSurfaceImageSourceInterop)sis).RegisterForUpdatesNeeded(new DXInteropVirtualSurfaceUpdatesCallback(surfaceImageSourceWrapper)); } else { // Update SIS only,since the call back will update VSIS. sis.UpdateSurface(r1, args1); sis.UpdateSurface(r2, args2); } SurfaceImageSourceList.Add(surfaceImageSourceWrapper); return(sis); }
public DXInteropVirtualSurfaceUpdatesCallback(SurfaceImageSourceWrapper surfaceImageSourceWrapperArg) { this.surfaceImageSourceWrapper = surfaceImageSourceWrapperArg; }