Skip to content

Commit

Permalink
v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
inanevin committed Oct 10, 2024
1 parent c27cd18 commit c26319f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Example/include/Backends/GL/GLBackend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct Texture

void StartFrame();
void DrawDefault(DrawBuffer* buf);
void DrawSimpleText(SimpleTextDrawBuffer* buf);
void DrawSimpleText(DrawBufferText* buf);
void EndFrame();
void SaveAPIState();
void RestoreAPIState();
Expand Down
2 changes: 1 addition & 1 deletion Example/src/Backends/GL/GLBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ namespace LinaVG::Examples
Config.debugCurrentVertexCount += buf->vertexBuffer.m_size;
}

void GLBackend::DrawSimpleText(SimpleTextDrawBuffer* buf)
void GLBackend::DrawSimpleText(DrawBufferText* buf)
{
if (m_backendData.m_skipDraw)
return;
Expand Down
6 changes: 3 additions & 3 deletions include/LinaVG/Core/BufferStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace LinaVG
struct BufferStoreData
{
Array<DrawBuffer> m_defaultBuffers;
Array<SimpleTextDrawBuffer> m_simpleTextBuffers;
Array<DrawBufferText> m_simpleTextBuffers;
Array<int> m_drawOrders;
LINAVG_MAP<uint32_t, TextCache> m_textCache;
int m_gcFrameCounter = 0;
Expand All @@ -84,15 +84,15 @@ namespace LinaVG
int GetBufferIndexInDefaultArray(DrawBuffer* buf);
int GetBufferIndexInCharArray(DrawBuffer* buf);
DrawBuffer& GetDefaultBuffer(void* userData, int drawOrder, DrawBufferShapeType shapeType, TextureHandle txtHandle, const Vec4& textureUV);
SimpleTextDrawBuffer& GetSimpleTextBuffer(void* userData, Font* font, int drawOrder, bool isDropShadow, bool isSDF);
DrawBufferText& GetSimpleTextBuffer(void* userData, Font* font, int drawOrder, bool isDropShadow, bool isSDF);
void AddTextCache(uint32_t sid, const TextOptions& opts, DrawBuffer* buf, int vtxStart, int indexStart);
TextCache* CheckTextCache(uint32_t sid, const TextOptions& opts, DrawBuffer* buf);
};

struct BufferStoreCallbacks
{
std::function<void(DrawBuffer* buf)> drawDefault;
std::function<void(SimpleTextDrawBuffer* buf)> drawSimpleText;
std::function<void(DrawBufferText* buf)> drawSimpleText;
};

class BufferStore
Expand Down
6 changes: 3 additions & 3 deletions include/LinaVG/Core/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,10 @@ namespace LinaVG
}
};

struct SimpleTextDrawBuffer : public DrawBuffer
struct DrawBufferText : public DrawBuffer
{
SimpleTextDrawBuffer(){};
SimpleTextDrawBuffer(void* userData, Font* font, int drawOrder, bool isDropShadow, bool sdf, BackendHandle clipPosX, BackendHandle clipPosY, BackendHandle clipSizeX, BackendHandle clipSizeY)
DrawBufferText(){};
DrawBufferText(void* userData, Font* font, int drawOrder, bool isDropShadow, bool sdf, BackendHandle clipPosX, BackendHandle clipPosY, BackendHandle clipSizeX, BackendHandle clipSizeY)
: DrawBuffer(userData, drawOrder, DrawBufferType::SimpleText, isDropShadow ? DrawBufferShapeType::DropShadow : DrawBufferShapeType::Shape, 0, Vec4(), clipPosX, clipPosY, clipSizeX, clipSizeY), font(font), isDropShadow(isDropShadow), isSDF(sdf){};

Font* font = nullptr;
Expand Down
6 changes: 3 additions & 3 deletions src/Core/BufferStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace LinaVG

for (int i = 0; i < m_data.m_simpleTextBuffers.m_size; i++)
{
SimpleTextDrawBuffer& buf = m_data.m_simpleTextBuffers[i];
DrawBufferText& buf = m_data.m_simpleTextBuffers[i];

if (buf.drawOrder == drawOrder && buf.shapeType == shapeType && buf.vertexBuffer.m_size != 0 && buf.indexBuffer.m_size != 0)
{
Expand Down Expand Up @@ -186,7 +186,7 @@ namespace LinaVG
return m_defaultBuffers.last_ref();
}

SimpleTextDrawBuffer& BufferStoreData::GetSimpleTextBuffer(void* userData, Font* font, int drawOrder, bool isDropShadow, bool isSDF)
DrawBufferText& BufferStoreData::GetSimpleTextBuffer(void* userData, Font* font, int drawOrder, bool isDropShadow, bool isSDF)
{
for (int i = 0; i < m_simpleTextBuffers.m_size; i++)
{
Expand All @@ -197,7 +197,7 @@ namespace LinaVG

SetDrawOrderLimits(drawOrder);

m_simpleTextBuffers.push_back(SimpleTextDrawBuffer(userData, font, drawOrder, isDropShadow, isSDF, m_clipPosX, m_clipPosY, m_clipSizeX, m_clipSizeY));
m_simpleTextBuffers.push_back(DrawBufferText(userData, font, drawOrder, isDropShadow, isSDF, m_clipPosX, m_clipPosY, m_clipSizeX, m_clipSizeY));
return m_simpleTextBuffers.last_ref();
}

Expand Down

0 comments on commit c26319f

Please sign in to comment.