qskinny/src/nodes/QskVertex.cpp
Uwe Rathmann 6479937294 All box subcontrols are displayd with vertex lists instead of textures
now. Implementation is almost complete beside of the not yet done Qt
antialiasing mode. Not all sort of linear gradients ( see
QLinearGradients ) are implemented - needs 1-2 days more.
The aspect flags for box primitives have been substantially changed from
too atomic to more strutured units.
The skins are currently incomplete - will be fixed later.
2017-10-17 17:29:02 +02:00

67 lines
1.8 KiB
C++

/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#include "QskVertex.h"
using namespace QskVertex;
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<( QDebug debug, Color color )
{
QDebugStateSaver saver( debug );
debug.nospace();
debug << "C" << '(';
debug << color.r << "," << color.g << "," << color.b << "," << color.a;
debug << ')';
return debug;
}
QDebug operator<<( QDebug debug, ColoredLine line )
{
QDebugStateSaver saver( debug );
qDebug() << qRound( line.p1.x ) << qRound( line.p1.y )
<< "->" << qRound( line.p2.x ) << qRound( line.p2.y );
return debug;
}
QDebug operator<<( QDebug debug, Line line )
{
QDebugStateSaver saver( debug );
qDebug() << qRound( line.p1.x ) << qRound( line.p1.y )
<< "->" << qRound( line.p2.x ) << qRound( line.p2.y );
return debug;
}
#endif
template< class Line >
static inline void qskDebugGeometry( Line* lines, int count )
{
#ifndef QT_NO_DEBUG_STREAM
for ( int i = 0; i < count; i++ )
{
qDebug() << i << ":" << lines[ i ];
}
#endif
}
void QskVertex::debugGeometry( const QSGGeometry& geometry )
{
const auto lineCount = geometry.vertexCount() / 2;
if ( geometry.attributeCount() == 1 )
{
const auto lines = reinterpret_cast< const Line* >( geometry.vertexData() );
qskDebugGeometry( lines, lineCount );
}
else if ( geometry.attributeCount() == 2 )
{
const auto lines = reinterpret_cast< const ColoredLine* >( geometry.vertexData() );
qskDebugGeometry( lines, lineCount );
}
}