Skip to content

Commit

Permalink
format; M_ -> CFG_ macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Gagis committed Feb 9, 2024
1 parent ecd73c3 commit 1eddbdb
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 39 deletions.
24 changes: 12 additions & 12 deletions msvs_solution/render_test/render_test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -460,7 +460,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand All @@ -475,7 +475,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand All @@ -490,7 +490,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand All @@ -505,7 +505,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
Expand All @@ -521,7 +521,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
Expand All @@ -537,7 +537,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -549,7 +549,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand All @@ -562,7 +562,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand All @@ -575,7 +575,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand All @@ -588,7 +588,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
Expand All @@ -602,7 +602,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);M_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);CFG_SVGREN_WHITE_BACKGROUND</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
Expand Down
2 changes: 1 addition & 1 deletion src/svgren/canvas.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SOFTWARE.
#include "surface.hxx"

#if SVGREN_BACKEND == SVGREN_BACKEND_CAIRO
# if M_OS == M_OS_WINDOWS || M_OS_NAME == M_OS_NAME_IOS
# if CFG_OS == CFG_OS_WINDOWS || CFG_OS_NAME == CFG_OS_NAME_IOS
# include <cairo.h>
# else
# include <cairo/cairo.h>
Expand Down
16 changes: 8 additions & 8 deletions src/svgren/filter_applier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ void filter_applier::visit(const svgdom::filter_element& e)
r4::vector2<real> fe_dims{percent_to_fraction(e.width), percent_to_fraction(e.height)};

return {
this->r.device_space_bounding_box.p1
+ fe_pos.comp_mul(this->r.device_space_bounding_box.dims()),
this->r.device_space_bounding_box.p1 +
fe_pos.comp_mul(this->r.device_space_bounding_box.dims()),
fe_dims.comp_mul(this->r.device_space_bounding_box.dims())
};
}
Expand Down Expand Up @@ -512,21 +512,21 @@ void filter_applier::visit(const svgdom::fe_color_matrix_element& e)
auto s = real(e.values[0]);

m = {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
{real(0.213) + real(0.787) * s,
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.715) - real(0.715) * s,
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.072) - real(0.072) * s,
real(0) },
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
{real(0.213) - real(0.213) * s,
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.715) + real(0.285) * s,
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.072) - real(0.072) * s,
real(0) },
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
{real(0.213) - real(0.213) * s,
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.715) - real(0.715) * s,
Expand Down Expand Up @@ -567,21 +567,21 @@ void filter_applier::visit(const svgdom::fe_color_matrix_element& e)
auto cosa = cos(a);

m = {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
{real(0.213) + cosa * real(0.787) - sina * real(0.213),
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.715) - cosa * real(0.715) - sina * real(0.715),
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.072) - cosa * real(0.072) + sina * real(0.928),
real(0) },
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
{real(0.213) - cosa * real(0.213) + sina * real(0.143),
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.715) + cosa * real(0.285) + sina * real(0.140),
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.072) - cosa * real(0.072) - sina * real(0.283),
real(0) },
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
{real(0.213) - cosa * real(0.213) - sina * real(0.787),
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
real(0.715) - cosa * real(0.715) + sina * real(0.715),
Expand Down
8 changes: 4 additions & 4 deletions src/svgren/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ void renderer::apply_viewbox(const svgdom::view_boxed& e, const svgdom::aspect_r
real viewbox_aspect = e.view_box[2] / e.view_box[3];
real viewport_aspect = this->viewport[0] / this->viewport[1];

if ((viewbox_aspect >= viewport_aspect && ar.preserve_aspect_ratio.slice)
|| (viewbox_aspect < viewport_aspect && !ar.preserve_aspect_ratio.slice))
if ((viewbox_aspect >= viewport_aspect && ar.preserve_aspect_ratio.slice) ||
(viewbox_aspect < viewport_aspect && !ar.preserve_aspect_ratio.slice))
{
// fit by Y
scale_factor = this->viewport[1] / e.view_box[3];
Expand Down Expand Up @@ -628,8 +628,8 @@ renderer::renderer(svgren::canvas& canvas, unsigned dpi, r4::vector2<real> viewp
unsigned((SVGREN_BACKGROUND >> 8) & 0xff),
unsigned((SVGREN_BACKGROUND >> 16) & 0xff),
unsigned((SVGREN_BACKGROUND >> 24) & 0xff)
}
/ 0xff
} /
0xff
);
this->canvas.rectangle({0, viewport});
this->canvas.fill();
Expand Down
6 changes: 3 additions & 3 deletions src/svgren/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ void surface::append_luminance_to_alpha()
image_type::value(1),
image_type::value(1),
// we use premultiplied alpha format, so no need to multiply alpha by liminance
rasterimage::multiply(px.r(), image_type::value(red_coeff))
+ rasterimage::multiply(px.g(), image_type::value(green_coeff))
+ rasterimage::multiply(px.b(), image_type::value(blue_coeff))
rasterimage::multiply(px.r(), image_type::value(red_coeff)) +
rasterimage::multiply(px.g(), image_type::value(green_coeff)) +
rasterimage::multiply(px.b(), image_type::value(blue_coeff))
);
}
}
12 changes: 6 additions & 6 deletions src/svgren/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ common_element_push::common_element_push(svgren::renderer& renderer, bool is_con

auto background_prop = this->renderer.style_stack.get_style_property(svgdom::style_property::enable_background);

if (background_prop && std::holds_alternative<svgdom::enable_background_property>(*background_prop)
&& std::get_if<svgdom::enable_background_property>(background_prop)->value
== svgdom::enable_background::new_background)
if (background_prop && std::holds_alternative<svgdom::enable_background_property>(*background_prop) &&
std::get_if<svgdom::enable_background_property>(background_prop)->value ==
svgdom::enable_background::new_background)
{
this->old_background = this->renderer.background;
}
Expand Down Expand Up @@ -114,9 +114,9 @@ common_element_push::common_element_push(svgren::renderer& renderer, bool is_con
// or both fill and stroke are non-none.
// If element is non-container and one of stroke or fill is solid color and other one is none,
// then opacity will be applied later without pushing cairo group.
if (this->group_pushed || is_container || (stroke_prop && std::holds_alternative<std::string>(*stroke_prop))
|| (fill_prop && std::holds_alternative<std::string>(*fill_prop))
|| (fill_prop && stroke_prop && !svgdom::is_none(*fill_prop) && !svgdom::is_none(*stroke_prop)))
if (this->group_pushed || is_container || (stroke_prop && std::holds_alternative<std::string>(*stroke_prop)) ||
(fill_prop && std::holds_alternative<std::string>(*fill_prop)) ||
(fill_prop && stroke_prop && !svgdom::is_none(*fill_prop) && !svgdom::is_none(*stroke_prop)))
{
auto p = this->renderer.style_stack.get_style_property(svgdom::style_property::opacity);
if (p && std::holds_alternative<svgdom::real>(*p)) {
Expand Down
4 changes: 2 additions & 2 deletions tests/render/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <png.h>

#if M_OS == M_OS_LINUX
#if CFG_OS == CFG_OS_LINUX
# include <X11/Xlib.h>
# include <X11/Xutil.h>
#endif
Expand Down Expand Up @@ -80,7 +80,7 @@ int main(int argc, char **argv){

image.write_png(papki::fs_file(out_filename));

#if M_OS == M_OS_LINUX
#if CFG_OS == CFG_OS_LINUX
auto width = int(img.dims().x() + 2);
auto height = int(img.dims().y() + 2);

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/samples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const tst::set set("samples", [](tst::suite& suite){
suite.add<std::string>(
"sample__deprecated_render",
{
#if M_CPU_BITS != 64
#if CFG_CPU_BITS != 64
tst::flag::disabled
#endif
},
Expand Down Expand Up @@ -120,7 +120,7 @@ const tst::set set("samples", [](tst::suite& suite){
suite.add<std::string>(
"sample",
{
#if M_CPU_BITS != 64
#if CFG_CPU_BITS != 64
tst::flag::disabled
#endif
},
Expand Down
2 changes: 1 addition & 1 deletion tool-configs

0 comments on commit 1eddbdb

Please sign in to comment.