Browse Source

Fix compile issues with the SVG plugin when using a custom `String` type (#820)

Trévis Morvany 3 months ago
parent
commit
e3b3d41341
2 changed files with 3 additions and 3 deletions
  1. 1 1
      Source/SVG/ElementSVG.cpp
  2. 2 2
      Source/SVG/SVGCache.cpp

+ 1 - 1
Source/SVG/ElementSVG.cpp

@@ -117,7 +117,7 @@ void ElementSVG::UpdateCachedData()
 
 	svg_dirty = false;
 
-	const std::string source = GetAttribute<String>("src", "");
+	const String source = GetAttribute<String>("src", "");
 	if (source.empty())
 	{
 		handle.reset();

+ 2 - 2
Source/SVG/SVGCache.cpp

@@ -142,7 +142,7 @@ namespace SVG {
 			[&](const SVGGeometry& data) { return data.colour == colour; });
 	}
 
-	static const std::string& GetSourceOr(const lunasvg::Document* svg_document, const std::string& default_value)
+	static const String& GetSourceOr(const lunasvg::Document* svg_document, const String& default_value)
 	{
 		const auto& documents = svg_cache_data->documents;
 		auto it = std::find_if(documents.begin(), documents.end(),
@@ -188,7 +188,7 @@ namespace SVG {
 			}
 
 			// We use a reset-release approach here in case clients use a non-std unique_ptr (lunasvg uses std::unique_ptr)
-			doc.svg_document.reset(lunasvg::Document::loadFromData(svg_data).release());
+			doc.svg_document.reset(lunasvg::Document::loadFromData(svg_data.data(), svg_data.size()).release());
 
 			if (!doc.svg_document)
 			{