summaryrefslogtreecommitdiff
path: root/Runtime/GUI
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-11-04 14:48:07 +0800
committerchai <chaifix@163.com>2021-11-04 14:48:07 +0800
commitae2c6b26c2453cfb84153c39861a1bcd02479a85 (patch)
tree259457dcd09db3c256ff613c4483e67495d29fec /Runtime/GUI
parentd7c051cecf0db9056e94d5e80146aa0b066e606b (diff)
-textureUnitBucket
Diffstat (limited to 'Runtime/GUI')
-rw-r--r--Runtime/GUI/Font.cpp2
-rw-r--r--Runtime/GUI/UITextMesh.cpp9
2 files changed, 7 insertions, 4 deletions
diff --git a/Runtime/GUI/Font.cpp b/Runtime/GUI/Font.cpp
index a2d3078..207e658 100644
--- a/Runtime/GUI/Font.cpp
+++ b/Runtime/GUI/Font.cpp
@@ -186,7 +186,7 @@ bool Font::RenderCharacter(character::Unicode codepoint, int pixelSize)
memcpy(&s_PixelBuffer[0], pixels, s_SizePerPixel * w * h);
}
- TextHelper::print_glyph(&s_PixelBuffer[0], w, h);
+ //TextHelper::print_glyph(&s_PixelBuffer[0], w, h);
GlyphAtals* atlas = RequestAtlas(pixelSize, Vector2(w, h));
Assert(atlas);
diff --git a/Runtime/GUI/UITextMesh.cpp b/Runtime/GUI/UITextMesh.cpp
index 7fc2614..a800dcd 100644
--- a/Runtime/GUI/UITextMesh.cpp
+++ b/Runtime/GUI/UITextMesh.cpp
@@ -8,6 +8,7 @@
#include <vector>
#include <unordered_map>
#include "Runtime/Graphics/GfxDevice.h"
+#include "Runtime/Utilities/AutoInvoke.h"
using namespace std;
@@ -75,6 +76,11 @@ UITextMesh::UITextMesh(const UnicodeString& str, Font* font, int pixelSize, int
static unordered_map<int, int> s_LineOffsets;
s_LineOffsets.clear();
+ InvokeWhenLeave([]() {
+ s_LineWidths.clear();
+ s_LineOffsets.clear();
+ });
+
m_Font = font;
const Vector2 atlasSize = font->GetAtlasSize();
@@ -256,8 +262,5 @@ void UITextMesh::Draw()
WipeGLError();
vbo->Draw(s_TextMeshVBOLayout);
-
- WipeGLError();
- g_GfxDevice.ResetUniformsState();
}
}