From 78363c3aad5023d2b86a0e5b5d38d3f44c0b9428 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska <67589014+mgrudzinska@users.noreply.github.com> Date: Wed, 6 Oct 2021 01:08:34 +0200 Subject: [PATCH] Revert "sw_engine: border cases for gradients" This reverts commit 284298445b900bbba09beb4673e9d055584e1f81. --- meson.build | 6 ----- src/lib/sw_engine/tvgSwRenderer.cpp | 35 ++--------------------------- 2 files changed, 2 insertions(+), 39 deletions(-) diff --git a/meson.build b/meson.build index 9b8f8a14..2cd27e90 100644 --- a/meson.build +++ b/meson.build @@ -6,15 +6,9 @@ project('thorvg', config_h = configuration_data() -if host_machine.system() != 'windows' add_project_arguments('-DEXAMPLE_DIR="@0@/src/examples/images"'.format(meson.current_source_dir()), '-DTEST_DIR="@0@/test/images"'.format(meson.current_source_dir()), language : 'cpp') -else -add_project_arguments('-DEXAMPLE_DIR="@0@\src\examples\images"'.format(meson.current_source_dir()), - '-DTEST_DIR="@0@\test\images"'.format(meson.current_source_dir()), - language : 'cpp') -endif config_h.set_quoted('THORVG_VERSION_STRING', meson.project_version()) diff --git a/src/lib/sw_engine/tvgSwRenderer.cpp b/src/lib/sw_engine/tvgSwRenderer.cpp index 32f28ee8..8d5caadf 100644 --- a/src/lib/sw_engine/tvgSwRenderer.cpp +++ b/src/lib/sw_engine/tvgSwRenderer.cpp @@ -20,7 +20,6 @@ * SOFTWARE. */ #include -#include #include "tvgSwCommon.h" #include "tvgTaskScheduler.h" #include "tvgSwRenderer.h" @@ -225,18 +224,6 @@ static void _termEngine() } -bool _monochromaticGradient(const Fill* fill) -{ - float x1, x2, y1, y2, r; - - if ((fill->id() == TVG_CLASS_ID_LINEAR && static_cast(fill)->linear(&x1, &y1, &x2, &y2) == Result::Success && - fabsf(x1 - x2) < FLT_EPSILON && fabsf(y1 - y2) < FLT_EPSILON) || - (fill->id() == TVG_CLASS_ID_RADIAL && static_cast(fill)->radial(nullptr, nullptr, &r) == Result::Success && - r < FLT_EPSILON)) return true; - - return false; -} - /************************************************************************/ /* External Class Implementation */ /************************************************************************/ @@ -377,16 +364,7 @@ bool SwRenderer::renderShape(RenderData data) uint8_t r, g, b, a; if (auto fill = task->sdata->fill()) { - if (_monochromaticGradient(fill)) { - const Fill::ColorStop* stop; - auto cnt = fill->colorStops(&stop); - if (cnt > 0 && stop) { - a = static_cast((opacity * static_cast(stop[cnt - 1].a)) / 255); - if (a > 0) rasterSolidShape(surface, &task->shape, stop[cnt - 1].r, stop[cnt - 1].g, stop[cnt - 1].b, a); - } - } else { - rasterGradientShape(surface, &task->shape, fill->id()); - } + rasterGradientShape(surface, &task->shape, fill->id()); } else { task->sdata->fillColor(&r, &g, &b, &a); a = static_cast((opacity * (uint32_t) a) / 255); @@ -394,16 +372,7 @@ bool SwRenderer::renderShape(RenderData data) } if (auto strokeFill = task->sdata->strokeFill()) { - if (_monochromaticGradient(strokeFill)) { - const Fill::ColorStop* stop; - auto cnt = strokeFill->colorStops(&stop); - if (cnt > 0 && stop) { - a = static_cast((opacity * static_cast(stop[cnt - 1].a)) / 255); - if (a > 0) rasterStroke(surface, &task->shape, stop[cnt - 1].r, stop[cnt - 1].g, stop[cnt - 1].b, a); - } - } else { - rasterGradientStroke(surface, &task->shape, strokeFill->id()); - } + rasterGradientStroke(surface, &task->shape, strokeFill->id()); } else { if (task->sdata->strokeColor(&r, &g, &b, &a) == Result::Success) { a = static_cast((opacity * (uint32_t) a) / 255);