Clang-format most of the sources (#1467)

This commit is contained in:
Michał Janiszewski
2021-05-10 19:18:39 +02:00
committed by GitHub
parent f7d0118064
commit f30e9494ce
54 changed files with 826 additions and 896 deletions

View File

@@ -123,8 +123,8 @@ namespace GraphControl
HRESULT hr;
// Reset the Grid using the m_initialDisplayRange properties when the user was last in Manual Adjustment mode and an equation was added.
// Reset the Grid using the TryPlotGraph method when the range is updated via Graph Settings. Return out of this block so we don't render 2 times.
// Reset the Grid using the ResetRange() in all other cases.
// Reset the Grid using the TryPlotGraph method when the range is updated via Graph Settings. Return out of this block so we don't render 2
// times. Reset the Grid using the ResetRange() in all other cases.
if (m_resetUsingInitialDisplayRange)
{
hr = renderer->SetDisplayRanges(m_initialDisplayRangeXMin, m_initialDisplayRangeXMax, m_initialDisplayRangeYMin, m_initialDisplayRangeYMax);
@@ -1123,7 +1123,8 @@ optional<vector<shared_ptr<Graphing::IEquation>>> Grapher::TryInitializeGraph(bo
{
if (IsKeepCurrentView)
{
// PrepareGraph() populates the values of the graph after TryInitialize but before rendering. This allows us to get the range of the graph to be rendered.
// PrepareGraph() populates the values of the graph after TryInitialize but before rendering. This allows us to get the range of the graph to be
// rendered.
if (SUCCEEDED(renderer->PrepareGraph()))
{
// Get the initial display ranges from the graph that was just initialized to be used in ResetGrid if they user clicks the GraphView button.

View File

@@ -82,7 +82,6 @@ public enum class GraphViewChangedReason
void ZoomFromCenter(double scale);
void ResetGrid();
property Windows::Foundation::Point TraceLocation
{
Windows::Foundation::Point get()

View File

@@ -254,15 +254,14 @@ namespace GraphControl::DX
lround(m_d3dRenderTargetSize.Width),
lround(m_d3dRenderTargetSize.Height),
DXGI_FORMAT_B8G8R8A8_UNORM,
0
);
0);
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
{
// If the device was removed for any reason, a new device and swap chain will need to be created.
HandleDeviceLost();
// Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method
// Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method
// and correctly set up the new device.
return;
}
@@ -533,8 +532,7 @@ namespace GraphControl::DX
// This method is called in the event handler for the CompositionScaleChanged event.
void DeviceResources::SetCompositionScale(float compositionScaleX, float compositionScaleY)
{
if (m_compositionScaleX != compositionScaleX ||
m_compositionScaleY != compositionScaleY)
if (m_compositionScaleX != compositionScaleX || m_compositionScaleY != compositionScaleY)
{
m_compositionScaleX = compositionScaleX;
m_compositionScaleY = compositionScaleY;
@@ -620,7 +618,7 @@ namespace GraphControl::DX
m_deviceNotify = deviceNotify;
}
// Call this method when the app suspends. It provides a hint to the driver that the app
// Call this method when the app suspends. It provides a hint to the driver that the app
// is entering an idle state and that temporary buffers can be reclaimed for use by other apps.
void DeviceResources::Trim()
{
@@ -647,7 +645,7 @@ namespace GraphControl::DX
// Discard the contents of the depth stencil.
m_d3dContext->DiscardView1(m_d3dDepthStencilView.Get(), nullptr, 0);
// If the device was removed either by a disconnection or a driver upgrade, we
// If the device was removed either by a disconnection or a driver upgrade, we
// must recreate all device resources.
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
{

View File

@@ -15,19 +15,19 @@ namespace GraphControl::DX
void CreateDeviceDependentResources();
void ReleaseDeviceDependentResources();
void Render(const Windows::Foundation::Point& location);
void SetColor(const D2D1::ColorF& color);
void SetRadius(float radius);
private:
void CreateBrush();
private:
DeviceResources* const m_deviceResources;
D2D1::ColorF m_color;
D2D1_ELLIPSE m_ellipse;
// Resources related to rendering.
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_brush;
};

View File

@@ -33,7 +33,7 @@ namespace GraphControl::DX
: m_deviceResources{ panel }
, m_nearestPointRenderer{ &m_deviceResources }
, m_backgroundColor{ {} }
, m_swapChainPanel{ panel }
, m_swapChainPanel{ panel }
, m_TraceLocation(Point(0, 0))
, m_Tracing(false)
{
@@ -159,10 +159,10 @@ namespace GraphControl::DX
double outNearestPointValueX, outNearestPointValueY;
float outNearestPointLocationX, outNearestPointLocationY;
double rhoValueOut, thetaValueOut, tValueOut;
double xAxisMin, xAxisMax, yAxisMin, yAxisMax;
m_graph->GetRenderer()->GetDisplayRanges(xAxisMin, xAxisMax, yAxisMin, yAxisMax);
double precision = this->GetPrecision(xAxisMax, xAxisMin);
double precision = this->GetPrecision(xAxisMax, xAxisMin);
m_Tracing = m_graph->GetRenderer()->GetClosePointData(
trackPoint.X,
@@ -201,7 +201,7 @@ namespace GraphControl::DX
double exponent = static_cast<double>(floor(log10(maxAxis - minAxis)) - 3);
double precision = pow(10, exponent);
return precision;
}
}
void RenderMain::SetPointRadius(float radius)
{
@@ -319,12 +319,12 @@ namespace GraphControl::DX
}
int formulaId = -1;
double outNearestPointValueX, outNearestPointValueY;
double outNearestPointValueX, outNearestPointValueY;
double rhoValueOut, thetaValueOut, tValueOut;
float outNearestPointLocationX, outNearestPointLocationY;
double xAxisMin, xAxisMax, yAxisMin, yAxisMax;
renderer->GetDisplayRanges(xAxisMin, xAxisMax, yAxisMin, yAxisMax);
double precision = this->GetPrecision(xAxisMax, xAxisMin);
double precision = this->GetPrecision(xAxisMax, xAxisMin);
if (renderer->GetClosePointData(
trackPoint.X,
trackPoint.Y,
@@ -352,7 +352,7 @@ namespace GraphControl::DX
m_TraceLocation = Point(outNearestPointLocationX, outNearestPointLocationY);
m_nearestPointRenderer.Render(m_TraceLocation);
m_Tracing = true;
m_TraceLocation = Point(outNearestPointLocationX, outNearestPointLocationY);
m_TraceLocation = Point(outNearestPointLocationX, outNearestPointLocationY);
m_XTraceValue = outNearestPointValueX;
m_YTraceValue = outNearestPointValueY;
}

View File

@@ -150,8 +150,9 @@ namespace GraphControl::DX
// Other event handlers.
void OnCompositionScaleChanged(Windows::UI::Xaml::Controls::SwapChainPanel ^ sender, Object ^ args);
void OnSizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
double GetPrecision(const double maxAxis, const double minAxis);
private:
DX::DeviceResources m_deviceResources;
NearestPointRenderer m_nearestPointRenderer;
@@ -186,12 +187,11 @@ namespace GraphControl::DX
// Track our independent input on a background worker thread.
Windows::Foundation::IAsyncAction ^ m_inputLoopWorker = nullptr;
Windows::UI::Core::CoreIndependentInputSource ^ m_coreInput = nullptr;
Windows::UI::Core::CoreIndependentInputSource ^ m_coreInput = nullptr;
double m_XTraceValue;
double m_YTraceValue;
// And where is it located on screen
Windows::Foundation::Point m_TraceLocation;
@@ -200,10 +200,10 @@ namespace GraphControl::DX
Concurrency::critical_section m_criticalSection;
Windows::Foundation::IAsyncAction ^ m_renderPass = nullptr;
Windows::Foundation::IAsyncAction ^ m_renderPass = nullptr;
bool m_isRenderPassSuccesful;
bool m_isRenderPassSuccesful;
HRESULT m_HResult;
HRESULT m_HResult;
};
}

View File

@@ -154,11 +154,12 @@ public
event EquationChangedEventHandler ^ EquationLineEnabledChanged;
private:
void OnEquationPropertyChanged(Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ args)
void OnEquationPropertyChanged(Object ^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ args)
{
auto equation = static_cast<Equation ^>(sender);
auto propertyName = args->PropertyName;
if (propertyName == GraphControl::Equation::LineColorPropertyName || propertyName == GraphControl::Equation::IsSelectedPropertyName || propertyName == GraphControl::Equation::EquationStylePropertyName)
if (propertyName == GraphControl::Equation::LineColorPropertyName || propertyName == GraphControl::Equation::IsSelectedPropertyName
|| propertyName == GraphControl::Equation::EquationStylePropertyName)
{
EquationStyleChanged(equation);
}

View File

@@ -4,7 +4,6 @@
#pragma once
#include "Utils.h"
namespace Graphing
{
struct IGraphFunctionAnalysisData;
@@ -17,7 +16,6 @@ namespace CalculatorApp
namespace GraphControl
{
public
ref class KeyGraphFeaturesInfo sealed
{

View File

@@ -168,7 +168,7 @@ public:
Windows::UI::Xaml::Input::ICommand^ get() {\
if (!donotuse_##p) {\
donotuse_##p = CalculatorApp::Common::MakeDelegate(this, &m);\
} return donotuse_##p; }} private: Windows::UI::Xaml::Input::ICommand^ donotuse_##p; \
} return donotuse_##p; }} private: Windows::UI::Xaml::Input::ICommand^ donotuse_##p; \
\
public:

View File

@@ -25,7 +25,6 @@
#include <map>
#include <type_traits>
// DirectX headers
#include <d2d1_3.h>
#include <d3d11_4.h>