From f5b0ef3698a84c8b146c9fb4ddafff18d21ed2dc Mon Sep 17 00:00:00 2001 From: elasota Date: Mon, 20 Jan 2020 23:59:45 -0500 Subject: [PATCH] Revert "Fix some problematic ellipse plotter cases (like 4x36)" This reverts commit 1d7a75c8a9282a66bf86e4269a2beb500e577c55. --- PortabilityLayer/EllipsePlotter.cpp | 16 ++++++++-------- PortabilityLayer/PLQDraw.cpp | 8 +------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/PortabilityLayer/EllipsePlotter.cpp b/PortabilityLayer/EllipsePlotter.cpp index c4c7c52..d6c9e4e 100644 --- a/PortabilityLayer/EllipsePlotter.cpp +++ b/PortabilityLayer/EllipsePlotter.cpp @@ -73,9 +73,9 @@ namespace PortabilityLayer const int32_t xStepCost = -m_xChangeCostDynamicFactor + m_xChangeCostStaticFactor; const int32_t yStepCost = m_yChangeCostDynamicFactor + m_yChangeCostStaticFactor; - const int32_t tangentCalc = (-m_xChangeCostDynamicFactor) + m_yChangeCostDynamicFactor; + const int32_t diagonalCostDelta = xStepCost + yStepCost; - if (tangentCalc < 0) + if (diagonalCostDelta < 0) { // Diagonal movement will move closer to the edge (first octant) IncrementY(); @@ -115,9 +115,9 @@ namespace PortabilityLayer const int32_t xStepCost = -m_xChangeCostDynamicFactor + m_xChangeCostStaticFactor; const int32_t yStepCost = -m_yChangeCostDynamicFactor + m_yChangeCostStaticFactor; - const int32_t tangentCalc = (-m_xChangeCostDynamicFactor) + (-m_yChangeCostDynamicFactor); + const int32_t diagonalCostDelta = xStepCost + yStepCost; - if (tangentCalc < 0) + if (diagonalCostDelta < 0) { // Diagonal movement will move closer to the edge (first octant) DecrementX(); @@ -157,9 +157,9 @@ namespace PortabilityLayer const int32_t xStepCost = m_xChangeCostDynamicFactor + m_xChangeCostStaticFactor; const int32_t yStepCost = -m_yChangeCostDynamicFactor + m_yChangeCostStaticFactor; - const int32_t tangentCalc = (m_xChangeCostDynamicFactor) + (-m_yChangeCostDynamicFactor); + const int32_t diagonalCostDelta = xStepCost + yStepCost; - if (tangentCalc < 0) + if (diagonalCostDelta < 0) { // Diagonal movement will move closer to the edge (first octant) DecrementY(); @@ -199,9 +199,9 @@ namespace PortabilityLayer const int32_t xStepCost = m_xChangeCostDynamicFactor + m_xChangeCostStaticFactor; const int32_t yStepCost = m_yChangeCostDynamicFactor + m_yChangeCostStaticFactor; - const int32_t tangentCalc = m_xChangeCostDynamicFactor + m_yChangeCostDynamicFactor; + const int32_t diagonalCostDelta = xStepCost + yStepCost; - if (tangentCalc < 0) + if (diagonalCostDelta < 0) { // Diagonal movement will move closer to the edge (first octant) IncrementX(); diff --git a/PortabilityLayer/PLQDraw.cpp b/PortabilityLayer/PLQDraw.cpp index 4f93f5d..88e8c1c 100644 --- a/PortabilityLayer/PLQDraw.cpp +++ b/PortabilityLayer/PLQDraw.cpp @@ -1014,15 +1014,9 @@ void DrawSurface::SetSystemFont(int size, int variationFlags) void DrawSurface::FillEllipse(const Rect &rect) { - if (!rect.IsValid() || rect.Width() < 1 || rect.Height() < 1) + if (!rect.IsValid()) return; - if (rect.Width() <= 2 || rect.Height() <= 2) - { - FillRect(rect); - return; - } - PortabilityLayer::ScanlineMask *mask = PortabilityLayer::ScanlineMaskConverter::CompileEllipse(PortabilityLayer::Rect2i(rect.top, rect.left, rect.bottom, rect.right)); if (mask) {