summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp
diff options
context:
space:
mode:
author Miodrag Milanović <mmicko@gmail.com>2023-01-05 15:32:40 +0100
committer GitHub <noreply@github.com>2023-01-05 09:32:40 -0500
commit812e6094f47bb8d1da5a6b421aa4c724cf2035c0 (patch)
tree0f5bab2fe9393d1f629e9bf63e76cecca74ec0c9 /3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp
parent4a1b41854bba8fc2567906b88bab8ca81e75d187 (diff)
Update BGFX, BX and BIMG (#10789)
* Update to bgfx a93a714632b79b5ddbf5c86ac323fa9b76ed3433 Co-authored-by: Бранимир Караџић <branimirkaradzic@gmail.com>
Diffstat (limited to '3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp')
-rw-r--r--3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp49
1 files changed, 26 insertions, 23 deletions
diff --git a/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp b/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp
index 131fecf3ae7..77498cbf9c6 100644
--- a/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp
+++ b/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp
@@ -1,6 +1,6 @@
/*
* Copyright 2013 Jeremie Roy. All rights reserved.
- * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
+ * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#include "../common.h"
@@ -363,7 +363,7 @@ void TextBuffer::appendText(FontHandle _fontHandle, const char* _string, const c
{
_end = _string + bx::strLen(_string);
}
- BX_ASSERT(_end >= _string);
+ BX_ASSERT(_end >= _string, "");
const FontInfo& font = m_fontManager->getFontInfo(_fontHandle);
if (font.fontType & FONT_TYPE_MASK_DISTANCE_DROP_SHADOW)
@@ -416,7 +416,7 @@ void TextBuffer::appendText(FontHandle _fontHandle, const wchar_t* _string, cons
{
_end = _string + wcslen(_string);
}
- BX_ASSERT(_end >= _string);
+ BX_ASSERT(_end >= _string, "");
const FontInfo& font = m_fontManager->getFontInfo(_fontHandle);
if (font.fontType & FONT_TYPE_MASK_DISTANCE_DROP_SHADOW)
@@ -892,7 +892,10 @@ TextBufferManager::TextBufferManager(FontManager* _fontManager)
TextBufferManager::~TextBufferManager()
{
- BX_ASSERT(m_textBufferHandles.getNumHandles() == 0, "All the text buffers must be destroyed before destroying the manager");
+ BX_ASSERT(
+ m_textBufferHandles.getNumHandles() == 0
+ , "All the text buffers must be destroyed before destroying the manager"
+ );
delete [] m_textBuffers;
bgfx::destroy(u_params);
@@ -927,7 +930,7 @@ TextBufferHandle TextBufferManager::createTextBuffer(uint32_t _type, BufferType:
void TextBufferManager::destroyTextBuffer(TextBufferHandle _handle)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
m_textBufferHandles.free(_handle.idx);
@@ -970,7 +973,7 @@ void TextBufferManager::destroyTextBuffer(TextBufferHandle _handle)
void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId _id, int32_t _depth)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
@@ -1189,119 +1192,119 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId
void TextBufferManager::setStyle(TextBufferHandle _handle, uint32_t _flags)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setStyle(_flags);
}
void TextBufferManager::setTextColor(TextBufferHandle _handle, uint32_t _rgba)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setTextColor(_rgba);
}
void TextBufferManager::setBackgroundColor(TextBufferHandle _handle, uint32_t _rgba)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setBackgroundColor(_rgba);
}
void TextBufferManager::setOverlineColor(TextBufferHandle _handle, uint32_t _rgba)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setOverlineColor(_rgba);
}
void TextBufferManager::setUnderlineColor(TextBufferHandle _handle, uint32_t _rgba)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setUnderlineColor(_rgba);
}
void TextBufferManager::setStrikeThroughColor(TextBufferHandle _handle, uint32_t _rgba)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setStrikeThroughColor(_rgba);
}
void TextBufferManager::setOutlineColor(TextBufferHandle _handle, uint32_t _rgba)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setOutlineColor(_rgba);
}
void TextBufferManager::setOutlineWidth(TextBufferHandle _handle, float _outlineWidth)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setOutlineWidth(_outlineWidth);
}
void TextBufferManager::setDropShadowColor(TextBufferHandle _handle, uint32_t _rgba)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setDropShadowColor(_rgba);
}
void TextBufferManager::setDropShadowOffset(TextBufferHandle _handle, float _u, float _v)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setDropShadowOffset(_u, _v);
}
void TextBufferManager::setDropShadowSoftener(TextBufferHandle _handle, float smoother)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setDropShadowSoftener(smoother);
}
void TextBufferManager::setPenPosition(TextBufferHandle _handle, float _x, float _y)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setPenPosition(_x, _y);
}
void TextBufferManager::appendText(TextBufferHandle _handle, FontHandle _fontHandle, const char* _string, const char* _end)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->appendText(_fontHandle, _string, _end);
}
void TextBufferManager::appendText(TextBufferHandle _handle, FontHandle _fontHandle, const wchar_t* _string, const wchar_t* _end)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->appendText(_fontHandle, _string, _end);
}
void TextBufferManager::appendAtlasFace(TextBufferHandle _handle, uint16_t _faceIndex)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->appendAtlasFace(_faceIndex);
}
void TextBufferManager::clearTextBuffer(TextBufferHandle _handle)
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->clearTextBuffer();
}
TextRectangle TextBufferManager::getRectangle(TextBufferHandle _handle) const
{
- BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
+ BX_ASSERT(isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
return bc.textBuffer->getRectangle();
}