소스 검색

Fix crash in usedGlyphs mode. Fix AS binding for Font::SaveXML taking a Serializer. Closes #1746.

Lasse Öörni 9 년 전
부모
커밋
458830d1c7
2개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 1
      Source/Urho3D/AngelScript/UIAPI.cpp
  2. 1 1
      Source/Urho3D/UI/FontFaceBitmap.cpp

+ 6 - 1
Source/Urho3D/AngelScript/UIAPI.cpp

@@ -60,10 +60,15 @@ static bool FontSaveXML(const String& fileName, int pointSize, bool usedGlyphs,
     return ptr->SaveXML(file, pointSize, usedGlyphs, indentation);
 }
 
+static bool FontSaveXMLFile(File* file, int pointSize, bool usedGlyphs, const String& indentation, Font* ptr)
+{
+    return ptr->SaveXML(*file, pointSize, usedGlyphs, indentation);
+}
+
 static void RegisterFont(asIScriptEngine* engine)
 {
     RegisterResource<Font>(engine, "Font");
-    engine->RegisterObjectMethod("Font", "bool SaveXML(File@+, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", asMETHOD(Font, SaveXML), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Font", "bool SaveXML(File@+, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", asFUNCTION(FontSaveXMLFile), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Font", "bool SaveXML(VectorBuffer&, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", asFUNCTION(FontSaveXMLVectorBuffer), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Font", "bool SaveXML(const String&in, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", asFUNCTION(FontSaveXML), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Font", "IntVector2 GetTotalGlyphOffset(int) const", asMETHOD(Font, GetTotalGlyphOffset), asCALL_THISCALL);

+ 1 - 1
Source/Urho3D/UI/FontFaceBitmap.cpp

@@ -236,7 +236,7 @@ bool FontFaceBitmap::Load(FontFace* fontFace, bool usedGlyphs)
         image->SetSize(width, height, components);
         memset(image->GetData(), 0, width * height * components);
 
-        newImages.Push(image);
+        newImages[i] = image;
     }
 
     for (HashMap<unsigned, FontGlyph>::Iterator i = glyphMapping_.Begin(); i != glyphMapping_.End(); ++i)