diff options
Diffstat (limited to 'include/cru/platform/graphics')
-rw-r--r-- | include/cru/platform/graphics/Base.h | 8 | ||||
-rw-r--r-- | include/cru/platform/graphics/Factory.h | 7 | ||||
-rw-r--r-- | include/cru/platform/graphics/Font.h | 4 | ||||
-rw-r--r-- | include/cru/platform/graphics/Geometry.h | 5 | ||||
-rw-r--r-- | include/cru/platform/graphics/NullPainter.h | 4 | ||||
-rw-r--r-- | include/cru/platform/graphics/Resource.h | 2 | ||||
-rw-r--r-- | include/cru/platform/graphics/SvgGeometryBuilderMixin.h | 15 | ||||
-rw-r--r-- | include/cru/platform/graphics/TextLayout.h | 4 | ||||
-rw-r--r-- | include/cru/platform/graphics/cairo/CairoGraphicsFactory.h | 4 | ||||
-rw-r--r-- | include/cru/platform/graphics/cairo/CairoResource.h | 2 | ||||
-rw-r--r-- | include/cru/platform/graphics/cairo/PangoFont.h | 6 | ||||
-rw-r--r-- | include/cru/platform/graphics/cairo/PangoTextLayout.h | 11 |
12 files changed, 35 insertions, 37 deletions
diff --git a/include/cru/platform/graphics/Base.h b/include/cru/platform/graphics/Base.h index a61eb2a7..c3381394 100644 --- a/include/cru/platform/graphics/Base.h +++ b/include/cru/platform/graphics/Base.h @@ -1,8 +1,8 @@ #pragma once -#include "../Color.h" -#include "../GraphicsBase.h" -#include "../Matrix.h" -#include "../Resource.h" +#include <cru/platform/Base.h> // IWYU pragma: export +#include <cru/platform/Color.h> // IWYU pragma: export +#include <cru/platform/GraphicsBase.h> // IWYU pragma: export +#include <cru/platform/Matrix.h> // IWYU pragma: export #ifdef CRU_IS_DLL #ifdef CRU_PLATFORM_GRAPHICS_EXPORT_API diff --git a/include/cru/platform/graphics/Factory.h b/include/cru/platform/graphics/Factory.h index d197d821..fa9a3a95 100644 --- a/include/cru/platform/graphics/Factory.h +++ b/include/cru/platform/graphics/Factory.h @@ -1,10 +1,9 @@ #pragma once -#include "Resource.h" +#include "Base.h" #include "Brush.h" #include "Font.h" #include "Geometry.h" -#include "Image.h" #include "ImageFactory.h" #include "TextLayout.h" @@ -15,11 +14,11 @@ struct CRU_PLATFORM_GRAPHICS_API IGraphicsFactory : virtual IPlatformResource { virtual std::unique_ptr<IGeometryBuilder> CreateGeometryBuilder() = 0; - virtual std::unique_ptr<IFont> CreateFont(String font_family, + virtual std::unique_ptr<IFont> CreateFont(std::string font_family, float font_size) = 0; virtual std::unique_ptr<ITextLayout> CreateTextLayout( - std::shared_ptr<IFont> font, String text) = 0; + std::shared_ptr<IFont> font, std::string text) = 0; std::unique_ptr<ISolidColorBrush> CreateSolidColorBrush(const Color& color) { std::unique_ptr<ISolidColorBrush> brush = CreateSolidColorBrush(); diff --git a/include/cru/platform/graphics/Font.h b/include/cru/platform/graphics/Font.h index 7144fdc2..de24222c 100644 --- a/include/cru/platform/graphics/Font.h +++ b/include/cru/platform/graphics/Font.h @@ -1,9 +1,11 @@ #pragma once #include "Resource.h" +#include <string> + namespace cru::platform::graphics { struct CRU_PLATFORM_GRAPHICS_API IFont : virtual IGraphicsResource { - virtual String GetFontName() = 0; + virtual std::string GetFontName() = 0; virtual float GetFontSize() = 0; }; } // namespace cru::platform::graphics diff --git a/include/cru/platform/graphics/Geometry.h b/include/cru/platform/graphics/Geometry.h index b4b05194..2b251495 100644 --- a/include/cru/platform/graphics/Geometry.h +++ b/include/cru/platform/graphics/Geometry.h @@ -95,9 +95,10 @@ struct CRU_PLATFORM_GRAPHICS_API IGeometryBuilder : virtual IGraphicsResource { virtual std::unique_ptr<IGeometry> Build() = 0; - virtual void ParseAndApplySvgPathData(StringView path_d); + virtual void ParseAndApplySvgPathData(std::string_view path_d); }; std::unique_ptr<IGeometry> CRU_PLATFORM_GRAPHICS_API -CreateGeometryFromSvgPathData(IGraphicsFactory* factory, StringView path_d); +CreateGeometryFromSvgPathData(IGraphicsFactory* factory, + std::string_view path_d); } // namespace cru::platform::graphics diff --git a/include/cru/platform/graphics/NullPainter.h b/include/cru/platform/graphics/NullPainter.h index 27cb6393..74d71c16 100644 --- a/include/cru/platform/graphics/NullPainter.h +++ b/include/cru/platform/graphics/NullPainter.h @@ -14,9 +14,9 @@ class CRU_PLATFORM_GRAPHICS_API NullPainter : public Object, ~NullPainter() override = default; public: - String GetPlatformId() const override { return u"NULL"; } + std::string GetPlatformId() const override { return "NULL"; } - String GetDebugString() override { return u"NullPainter"; } + std::string GetDebugString() override { return "NullPainter"; } Matrix GetTransform() override { return Matrix(); } void SetTransform(const Matrix& matrix) override { CRU_UNUSED(matrix) } diff --git a/include/cru/platform/graphics/Resource.h b/include/cru/platform/graphics/Resource.h index ab1b8de6..f910ca8a 100644 --- a/include/cru/platform/graphics/Resource.h +++ b/include/cru/platform/graphics/Resource.h @@ -1,6 +1,8 @@ #pragma once #include "Base.h" +#include <cru/platform/Resource.h> + namespace cru::platform::graphics { struct IGraphicsFactory; diff --git a/include/cru/platform/graphics/SvgGeometryBuilderMixin.h b/include/cru/platform/graphics/SvgGeometryBuilderMixin.h index 32b665a5..586872b0 100644 --- a/include/cru/platform/graphics/SvgGeometryBuilderMixin.h +++ b/include/cru/platform/graphics/SvgGeometryBuilderMixin.h @@ -45,25 +45,24 @@ class CRU_PLATFORM_GRAPHICS_API SvgGeometryBuilderMixin void CloseFigure(bool close) override; - void ParseAndApplySvgPathData(StringView path_d) override; + void ParseAndApplySvgPathData(std::string_view path_d) override; protected: - String GetPathData() const { return current_; } + std::string GetPathData() const { return current_; } private: template <typename... Args> - void Append(StringView format, Args&&... args) { - current_ += String::FromUtf8( - std::format(format.ToUtf8(), std::forward<Args>(args)...)); - current_ += u' '; + void Append(std::string_view format, Args&&... args) { + current_ += std::format(format, std::forward<Args>(args)...); + current_ += ' '; } - void AppendCommand(StringView command); + void AppendCommand(std::string_view command); void Append(bool flag); void Append(float number); void Append(const Point& point); private: - String current_; + std::string current_; }; } // namespace cru::platform::graphics diff --git a/include/cru/platform/graphics/TextLayout.h b/include/cru/platform/graphics/TextLayout.h index e060186b..4c5302eb 100644 --- a/include/cru/platform/graphics/TextLayout.h +++ b/include/cru/platform/graphics/TextLayout.h @@ -8,8 +8,8 @@ namespace cru::platform::graphics { // Requirement: // All text must be left-top aligned. struct CRU_PLATFORM_GRAPHICS_API ITextLayout : virtual IGraphicsResource { - virtual String GetText() = 0; - virtual void SetText(String new_text) = 0; + virtual std::string GetText() = 0; + virtual void SetText(std::string new_text) = 0; virtual std::shared_ptr<IFont> GetFont() = 0; virtual void SetFont(std::shared_ptr<IFont> font) = 0; diff --git a/include/cru/platform/graphics/cairo/CairoGraphicsFactory.h b/include/cru/platform/graphics/cairo/CairoGraphicsFactory.h index f0f7ecc5..563c6b40 100644 --- a/include/cru/platform/graphics/cairo/CairoGraphicsFactory.h +++ b/include/cru/platform/graphics/cairo/CairoGraphicsFactory.h @@ -26,11 +26,11 @@ class CRU_PLATFORM_GRAPHICS_CAIRO_API CairoGraphicsFactory std::unique_ptr<IGeometryBuilder> CreateGeometryBuilder() override; - std::unique_ptr<IFont> CreateFont(String font_family, + std::unique_ptr<IFont> CreateFont(std::string font_family, float font_size) override; std::unique_ptr<ITextLayout> CreateTextLayout(std::shared_ptr<IFont> font, - String text) override; + std::string text) override; IImageFactory* GetImageFactory() override; diff --git a/include/cru/platform/graphics/cairo/CairoResource.h b/include/cru/platform/graphics/cairo/CairoResource.h index bf35ab26..14730e8a 100644 --- a/include/cru/platform/graphics/cairo/CairoResource.h +++ b/include/cru/platform/graphics/cairo/CairoResource.h @@ -17,7 +17,7 @@ class CRU_PLATFORM_GRAPHICS_CAIRO_API CairoResource ~CairoResource() override; - String GetPlatformId() const override; + std::string GetPlatformId() const override; IGraphicsFactory* GetGraphicsFactory() override; CairoGraphicsFactory* GetCairoGraphicsFactory() const { return factory_; } diff --git a/include/cru/platform/graphics/cairo/PangoFont.h b/include/cru/platform/graphics/cairo/PangoFont.h index 3014739d..e8dbf3ec 100644 --- a/include/cru/platform/graphics/cairo/PangoFont.h +++ b/include/cru/platform/graphics/cairo/PangoFont.h @@ -9,12 +9,12 @@ namespace cru::platform::graphics::cairo { class CRU_PLATFORM_GRAPHICS_CAIRO_API PangoFont : public CairoResource, public virtual IFont { public: - PangoFont(CairoGraphicsFactory* factory, String font_family, float font_size); + PangoFont(CairoGraphicsFactory* factory, std::string font_family, float font_size); ~PangoFont() override; public: - String GetFontName() override; + std::string GetFontName() override; float GetFontSize() override; PangoFontDescription* GetPangoFontDescription() { @@ -22,7 +22,7 @@ class CRU_PLATFORM_GRAPHICS_CAIRO_API PangoFont : public CairoResource, } private: - String font_family_; + std::string font_family_; float font_size_; PangoFontDescription* pango_font_description_; }; diff --git a/include/cru/platform/graphics/cairo/PangoTextLayout.h b/include/cru/platform/graphics/cairo/PangoTextLayout.h index cdc54e8d..270022ee 100644 --- a/include/cru/platform/graphics/cairo/PangoTextLayout.h +++ b/include/cru/platform/graphics/cairo/PangoTextLayout.h @@ -15,8 +15,8 @@ class CRU_PLATFORM_GRAPHICS_CAIRO_API PangoTextLayout ~PangoTextLayout() override; public: - String GetText() override; - void SetText(String new_text) override; + std::string GetText() override; + void SetText(std::string new_text) override; std::shared_ptr<IFont> GetFont() override; void SetFont(std::shared_ptr<IFont> font) override; @@ -40,12 +40,7 @@ class CRU_PLATFORM_GRAPHICS_CAIRO_API PangoTextLayout PangoLayout* GetPangoLayout() { return pango_layout_; } private: - Index FromUtf8IndexToUtf16Index(Index index); - Index FromUtf16IndexToUtf8Index(Index index); - - private: - String text_; - std::string utf8_text_; + std::string text_; bool edit_mode_ = false; |