internal void Update(HwndPointerInputProvider provider, PresentationSource inputSource, PointerData pointerData, RawStylusInputReport rsir) { _lastEventTimeTicks = Environment.TickCount; _inputSource = new SecurityCriticalDataClass <PresentationSource>(inputSource); _pointerData = pointerData; // First get the initial stylus points. Raw data from pointer input comes in screen coordinates, keep that here since that is what we expect. _currentStylusPoints = new StylusPointCollection(rsir.StylusPointDescription, rsir.GetRawPacketData(), GetTabletToElementTransform(null), Matrix.Identity); // If a plugin has modified these points, we need to fixup the points with the new input if (rsir?.RawStylusInput?.StylusPointsModified ?? false) { // Note that RawStylusInput.Target (of type StylusPluginCollection) // guarantees that ViewToElement is invertible. GeneralTransform transformToElement = rsir.RawStylusInput.Target.ViewToElement.Inverse; Debug.Assert(transformToElement != null); _currentStylusPoints = rsir.RawStylusInput.GetStylusPoints(transformToElement); } // Store the current hwnd provider so we know for what hwnd we are processing this message CurrentPointerProvider = provider; if (PointerTabletDevice.Type == TabletDeviceType.Touch) { // If we are a touch device, sync the ActiveSource TouchDevice.ChangeActiveSource(_inputSource.Value); } }