Remove unneeded assert

Asserts should really only be used if the condition would trigger a
program error.  These just need a warning
This commit is contained in:
Seth Hillbrand 2022-11-04 11:45:34 -07:00
parent 4f634d7df7
commit 685185bd68
2 changed files with 15 additions and 2 deletions

View File

@ -1228,6 +1228,9 @@ void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet,
m_currentManager->Shader( SHADER_NONE );
m_currentManager->Color( m_fillColor.r, m_fillColor.g, m_fillColor.b, m_fillColor.a );
unsigned int polycount = aPolySet.TriangulatedPolyCount();
std::vector<size_t> tricounts;
if( m_isFillEnabled )
{
int totalTriangleCount = 0;
@ -1235,6 +1238,7 @@ void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet,
for( unsigned int j = 0; j < aPolySet.TriangulatedPolyCount(); ++j )
{
auto triPoly = aPolySet.TriangulatedPolygon( j );
tricounts.push_back( triPoly->GetTriangleCount() );
totalTriangleCount += triPoly->GetTriangleCount();
}
@ -1245,6 +1249,12 @@ void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet,
{
auto triPoly = aPolySet.TriangulatedPolygon( j );
if( polycount != aPolySet.TriangulatedPolyCount() )
printf("Incorrect polycount!\n");
if( tricounts[j] != triPoly->GetTriangleCount() )
printf("Incorrect triangle count!\n");
for( size_t i = 0; i < triPoly->GetTriangleCount(); i++ )
{
VECTOR2I a, b, c;

View File

@ -36,6 +36,7 @@
#include <gal/opengl/gpu_manager.h>
#include <gal/opengl/vertex_item.h>
#include <confirm.h>
#include <wx/log.h>
using namespace KIGFX;
@ -71,7 +72,8 @@ bool VERTEX_MANAGER::Reserve( unsigned int aSize )
if( !aSize )
return true;
assert( m_reservedSpace == 0 && m_reserved == nullptr );
if( m_reservedSpace != 0 || m_reserved )
wxLogDebug( wxT( "Did not use all previous vertices allocated" ) );
// flag to avoid hanging by calling DisplayError too many times:
static bool show_err = true;
@ -170,7 +172,8 @@ void VERTEX_MANAGER::SetItem( VERTEX_ITEM& aItem ) const
void VERTEX_MANAGER::FinishItem() const
{
assert( m_reservedSpace == 0 && m_reserved == nullptr );
if( m_reservedSpace != 0 || m_reserved )
wxLogDebug( wxT( "Did not use all previous vertices allocated" ) );
m_container->FinishItem();
}