From 9329af37f136edb5571cc67885a8b8224d57c533 Mon Sep 17 00:00:00 2001 From: Pepe Rivera Date: Wed, 8 Jan 2020 15:06:26 -0800 Subject: [PATCH] Fix crash when setting graph options to very large numbers (#904) * fix crash * Fixes * Update build/pipelines/templates/build-app-internal.yaml Co-Authored-By: Stephanie Anderl <46726333+sanderl@users.noreply.github.com> Co-authored-by: Stephanie Anderl <46726333+sanderl@users.noreply.github.com> --- build/pipelines/templates/build-app-internal.yaml | 2 +- src/GraphControl/DirectX/RenderMain.cpp | 13 +++++++++++-- src/GraphingImpl/Mocks/GraphRenderer.h | 14 ++++++++++---- src/GraphingInterfaces/IGraphRenderer.h | 12 +++++++++++- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/build/pipelines/templates/build-app-internal.yaml b/build/pipelines/templates/build-app-internal.yaml index 51eb1d2..96958fb 100644 --- a/build/pipelines/templates/build-app-internal.yaml +++ b/build/pipelines/templates/build-app-internal.yaml @@ -29,7 +29,7 @@ jobs: downloadDirectory: $(Build.SourcesDirectory) vstsFeed: WindowsApps vstsFeedPackage: calculator-internals - vstsPackageVersion: 0.0.31 + vstsPackageVersion: 0.0.33 - template: ./build-single-architecture.yaml parameters: diff --git a/src/GraphControl/DirectX/RenderMain.cpp b/src/GraphControl/DirectX/RenderMain.cpp index 4e54aaa..c70970b 100644 --- a/src/GraphControl/DirectX/RenderMain.cpp +++ b/src/GraphControl/DirectX/RenderMain.cpp @@ -179,10 +179,19 @@ namespace GraphControl::DX int formulaId = -1; float nearestPointLocationX, nearestPointLocationY; - float nearestPointValueX, nearestPointValueY; + double nearestPointValueX, nearestPointValueY, rhoValueOut, thetaValueOut, tValueOut; if (renderer->GetClosePointData( - trackPoint.X, trackPoint.Y, formulaId, nearestPointLocationX, nearestPointLocationY, nearestPointValueX, nearestPointValueY) + trackPoint.X, + trackPoint.Y, + formulaId, + nearestPointLocationX, + nearestPointLocationY, + nearestPointValueX, + nearestPointValueY, + rhoValueOut, + thetaValueOut, + tValueOut) == S_OK) { if (!isnan(nearestPointLocationX) && !isnan(nearestPointLocationY)) diff --git a/src/GraphingImpl/Mocks/GraphRenderer.h b/src/GraphingImpl/Mocks/GraphRenderer.h index 964105d..b4abcaf 100644 --- a/src/GraphingImpl/Mocks/GraphRenderer.h +++ b/src/GraphingImpl/Mocks/GraphRenderer.h @@ -38,19 +38,25 @@ namespace MockGraphingImpl } virtual HRESULT GetClosePointData( - float inScreenPointX, - float inScreenPointY, + double inScreenPointX, + double inScreenPointY, int& formulaIdOut, float& xScreenPointOut, float& yScreenPointOut, - float& xValueOut, - float& yValueOut) + double& xValueOut, + double& yValueOut, + double& rhoValueOut, + double& thetaValueOut, + double& tValueOut) { formulaIdOut = 0; xScreenPointOut = 0; yScreenPointOut = 0; xValueOut = 0; yValueOut = 0; + rhoValueOut = 0; + thetaValueOut = 0; + tValueOut = 0; return S_OK; } diff --git a/src/GraphingInterfaces/IGraphRenderer.h b/src/GraphingInterfaces/IGraphRenderer.h index 388b80c..9772f23 100644 --- a/src/GraphingInterfaces/IGraphRenderer.h +++ b/src/GraphingInterfaces/IGraphRenderer.h @@ -23,7 +23,17 @@ namespace Graphing::Renderer virtual HRESULT SetDpi(float dpiX, float dpiY) = 0; virtual HRESULT DrawD2D1(ID2D1Factory* pDirect2dFactory, ID2D1RenderTarget* pRenderTarget, bool& hasSomeMissingDataOut) = 0; - virtual HRESULT GetClosePointData(float inScreenPointX, float inScreenPointY, int& formulaIdOut, float& xScreenPointOut, float& yScreenPointOut, float& xValueOut, float& yValueOut) = 0; + virtual HRESULT GetClosePointData( + double inScreenPointX, + double inScreenPointY, + int& formulaIdOut, + float& xScreenPointOut, + float& yScreenPointOut, + double& xValueOut, + double& yValueOut, + double& rhoValueOut, + double& thetaValueOut, + double& tValueOut) = 0; virtual HRESULT ScaleRange(double centerX, double centerY, double scale) = 0; virtual HRESULT ChangeRange(ChangeRangeAction action) = 0;