From 3ec4d1ed9039945768f3c673495e6e562aad0bfa Mon Sep 17 00:00:00 2001 From: lisyarus Date: Thu, 14 Oct 2021 21:48:03 +0300 Subject: [PATCH] Move ui::painter_impl internals to anonymous namespace --- libs/ui/source/painter_impl.cpp | 118 +++++++++++++++++--------------- 1 file changed, 61 insertions(+), 57 deletions(-) diff --git a/libs/ui/source/painter_impl.cpp b/libs/ui/source/painter_impl.cpp index 148035bd..0a16f0f9 100644 --- a/libs/ui/source/painter_impl.cpp +++ b/libs/ui/source/painter_impl.cpp @@ -10,7 +10,10 @@ namespace psemek::ui { - static char const colored_vs[] = + namespace + { + + char const colored_vs[] = R"(#version 330 uniform mat4 u_transform; @@ -28,7 +31,7 @@ void main() } )"; - static char const colored_fs[] = + char const colored_fs[] = R"(#version 330 in vec4 color; @@ -41,7 +44,7 @@ void main() } )"; - static char const bitmap_text_vs[] = + char const bitmap_text_vs[] = R"(#version 330 uniform mat4 u_transform; @@ -64,7 +67,7 @@ void main() } )"; - static char const bitmap_text_fs[] = + char const bitmap_text_fs[] = R"(#version 330 uniform sampler2D u_atlas; @@ -80,7 +83,7 @@ void main() } )"; - static char const textured_vs[] = + char const textured_vs[] = R"(#version 330 uniform mat4 u_transform; @@ -103,7 +106,7 @@ void main() } )"; - static char const textured_fs[] = + char const textured_fs[] = R"(#version 330 uniform sampler2D u_texture; @@ -119,66 +122,67 @@ void main() } )"; + struct colored_vertex + { + geom::point position; + std::uint32_t depth; + gfx::color_rgba color; + }; + static_assert(sizeof(colored_vertex) == 16); - struct colored_vertex - { - geom::point position; - std::uint32_t depth; - gfx::color_rgba color; - }; - static_assert(sizeof(colored_vertex) == 16); + struct colored_batch + { + std::vector vertices; + std::vector indices; + }; - struct colored_batch - { - std::vector vertices; - std::vector indices; - }; + bool operator == (colored_batch const &, colored_batch const &) + { + return true; + } - bool operator == (colored_batch const &, colored_batch const &) - { - return true; - } + struct bitmap_text_vertex + { + geom::point position; + std::uint32_t depth; + gfx::color_rgba color; + geom::vector texcoords; + }; + static_assert(sizeof(bitmap_text_vertex) == 20); - struct bitmap_text_vertex - { - geom::point position; - std::uint32_t depth; - gfx::color_rgba color; - geom::vector texcoords; - }; - static_assert(sizeof(bitmap_text_vertex) == 20); + struct bitmap_text_batch + { + gfx::texture_2d const * atlas = nullptr; + std::vector vertices{}; + std::vector indices{}; + }; - struct bitmap_text_batch - { - gfx::texture_2d const * atlas = nullptr; - std::vector vertices{}; - std::vector indices{}; - }; + bool operator == (bitmap_text_batch const & b1, bitmap_text_batch const & b2) + { + return b1.atlas == b2.atlas; + } - bool operator == (bitmap_text_batch const & b1, bitmap_text_batch const & b2) - { - return b1.atlas == b2.atlas; - } + struct textured_vertex + { + geom::point position; + std::uint32_t depth; + gfx::color_rgba color; + geom::point texcoords; + }; + static_assert(sizeof(textured_vertex) == 24); - struct textured_vertex - { - geom::point position; - std::uint32_t depth; - gfx::color_rgba color; - geom::point texcoords; - }; - static_assert(sizeof(textured_vertex) == 24); + struct textured_batch + { + gfx::texture_2d const * texture = nullptr; + std::vector vertices{}; + std::vector indices{}; + }; - struct textured_batch - { - gfx::texture_2d const * texture = nullptr; - std::vector vertices{}; - std::vector indices{}; - }; + bool operator == (textured_batch const & b1, textured_batch const & b2) + { + return b1.texture == b2.texture; + } - bool operator == (textured_batch const & b1, textured_batch const & b2) - { - return b1.texture == b2.texture; } struct painter_impl::impl