浏览代码

SVG plugin: Update texture when 'src' attribute changes, see #361

Michael Ragazzon 3 年之前
父节点
当前提交
f1c51593df
共有 2 个文件被更改,包括 5 次插入4 次删除
  1. 1 1
      Include/RmlUi/SVG/ElementSVG.h
  2. 4 3
      Source/SVG/ElementSVG.cpp

+ 1 - 1
Include/RmlUi/SVG/ElementSVG.h

@@ -74,7 +74,7 @@ private:
 
 	bool source_dirty = false;
 	bool geometry_dirty = false;
-	bool texture_size_dirty = false;
+	bool texture_dirty = false;
 
 	// The texture this element is rendering from.
 	Texture texture;

+ 4 - 3
Source/SVG/ElementSVG.cpp

@@ -85,7 +85,7 @@ void ElementSVG::OnRender()
 void ElementSVG::OnResize()
 {
 	geometry_dirty = true;
-	texture_size_dirty = true;
+	texture_dirty = true;
 }
 
 void ElementSVG::OnAttributeChange(const ElementAttributes& changed_attributes)
@@ -148,6 +148,7 @@ void ElementSVG::GenerateGeometry()
 bool ElementSVG::LoadSource()
 {
 	source_dirty = false;
+	texture_dirty = true;
 	intrinsic_dimensions = Vector2f{};
 	geometry.SetTexture(nullptr);
 	svg_document.reset();
@@ -192,7 +193,7 @@ bool ElementSVG::LoadSource()
 
 void ElementSVG::UpdateTexture()
 {
-	if (!svg_document || !texture_size_dirty)
+	if (!svg_document || !texture_dirty)
 		return;
 
 	// Callback for generating texture.
@@ -212,7 +213,7 @@ void ElementSVG::UpdateTexture()
 
 	texture.Set("svg", p_callback);
 	geometry.SetTexture(&texture);
-	texture_size_dirty = false;
+	texture_dirty = false;
 }
 
 } // namespace Rml