public void Update(Texture2D DesktopTexture, OutputDuplicateFrameInformation FrameInfo, OutputDuplication DeskDupl) { // No update if (FrameInfo.LastMouseUpdateTime == 0) { _pointerShape?.Update(DesktopTexture, _pointerPosition); return; } _pointerPosition = FrameInfo.PointerPosition; if (FrameInfo.PointerShapeBufferSize != 0) { if (FrameInfo.PointerShapeBufferSize > _ptrShapeBufferSize) { _ptrShapeBufferSize = FrameInfo.PointerShapeBufferSize; _ptrShapeBuffer = _ptrShapeBuffer != IntPtr.Zero ? Marshal.ReAllocCoTaskMem(_ptrShapeBuffer, _ptrShapeBufferSize) : Marshal.AllocCoTaskMem(_ptrShapeBufferSize); } DeskDupl.GetFramePointerShape(_ptrShapeBufferSize, _ptrShapeBuffer, out _, out _ptrShapeInfo); _pointerShape?.Dispose(); switch (_ptrShapeInfo.Type) { case PtrShapeMonochrome: _pointerShape = new MonochromePointerShape(_ptrShapeBuffer, _ptrShapeInfo, _editorSession); break; case PtrShapeMaskedColor: _pointerShape = new MaskedColorPointerShape(_ptrShapeBuffer, _ptrShapeInfo, _editorSession); break; case PtrShapeColor: _pointerShape = new ColorPointerShape(_ptrShapeBuffer, _ptrShapeInfo, _editorSession.RenderTarget); break; } } _pointerShape?.Update(DesktopTexture, _pointerPosition); }