public unsafe void UpdateFromCoreOutput(CanvasDevice device, IntPtr data, uint width, uint height, ulong pitch) { if (data == IntPtr.Zero || RenderTarget == null || CurrentCorePixelSize == 0) { return; } lock (RenderTargetLock) { RenderTargetViewport.Width = width; RenderTargetViewport.Height = height; var renderTargetMap = D3DSurfaceManager.Map(device, RenderTargetSurface); var targetDataPtr = (IntPtr)renderTargetMap.Data; switch (CurrentCorePixelFormat) { case PixelFormats.XRGB8888: FramebufferConverter.ConvertFrameBufferXRGB8888(width, height, data, (int)pitch, targetDataPtr, (int)renderTargetMap.Pitch); break; case PixelFormats.RGB565: FramebufferConverter.ConvertFrameBufferRGB565ToXRGB8888(width, height, data, (int)pitch, targetDataPtr, (int)renderTargetMap.Pitch); break; } D3DSurfaceManager.Unmap(device, RenderTargetSurface); } }
public unsafe void UpdateFromCoreOutputXRGB8888(CanvasDevice device, IReadOnlyList <uint> data, uint width, uint height, ulong pitch) { if (data == null || RenderTarget == null || CurrentCorePixelSize == 0) { return; } lock (RenderTargetLock) { RenderTargetViewport.Width = width; RenderTargetViewport.Height = height; using (var renderTargetMap = new D3DSurfaceMap(device, RenderTargetSurface)) { var dataPtr = (byte *)new IntPtr(renderTargetMap.Data).ToPointer(); FramebufferConverter.ConvertFrameBufferXRGB8888(width, height, data, (int)pitch, dataPtr, (int)renderTargetMap.PitchBytes); } } }