tracegen: Add support for QSizeF and QRectF types

Change-Id: Ie19523b84026312c3d5a597914abc2622dba3f68
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit 0510307ea1bfe2a1788738acb61890587e75dd5e)
This commit is contained in:
Antti Määttä 2023-01-31 11:05:03 +02:00
parent b3f77d25aa
commit c3af4a2180
5 changed files with 29 additions and 1 deletions

View File

@ -257,6 +257,18 @@ static void writeTracepoint(QTextStream &stream,
stream << " + QStringLiteral(\"int32_t QSize_" << arg.name << "_height;\\n\\\n \")";
eventSize += QStringLiteral("8");
} break;
case Tracepoint::Field::QtRectF: {
stream << "QStringLiteral(\"float QRectF_" << arg.name << "_x;\\n\\\n \")";
stream << " + QStringLiteral(\"float QRectF_" << arg.name << "_y;\\n\\\n \")";
stream << " + QStringLiteral(\"float QRectF_" << arg.name << "_width;\\n\\\n \")";
stream << " + QStringLiteral(\"float QRectF_" << arg.name << "_height;\\n\\\n \")";
eventSize += QStringLiteral("16");
} break;
case Tracepoint::Field::QtSizeF: {
stream << "QStringLiteral(\"float QSizeF_" << arg.name << "_width;\\n\\\n \")";
stream << " + QStringLiteral(\"float QSizeF_" << arg.name << "_height;\\n\\\n \")";
eventSize += QStringLiteral("8");
} break;
case Tracepoint::Field::Unknown:
break;
case Tracepoint::Field::EnumeratedType: {

View File

@ -45,12 +45,14 @@ static void writeEtwMacro(QTextStream &stream, const Tracepoint::Field &field)
stream << "TraceLoggingValue(" << name << ".toEncoded().constData(), \"" << name << "\")";
return;
case Tracepoint::Field::QtRect:
case Tracepoint::Field::QtRectF:
stream << "TraceLoggingValue(" << name << ".x(), \"x\"), "
<< "TraceLoggingValue(" << name << ".y(), \"y\"), "
<< "TraceLoggingValue(" << name << ".width(), \"width\"), "
<< "TraceLoggingValue(" << name << ".height(), \"height\")";
return;
case Tracepoint::Field::QtSize:
case Tracepoint::Field::QtSizeF:
stream << "TraceLoggingValue(" << name << ".width(), \"width\"), "
<< "TraceLoggingValue(" << name << ".height(), \"height\")";
return;

View File

@ -61,6 +61,16 @@ static void writeCtfMacro(QTextStream &stream, const Provider &provider, const T
<< "ctf_integer(int, width, " << name << ".width()) "
<< "ctf_integer(int, height, " << name << ".height()) ";
return;
case Tracepoint::Field::QtSizeF:
stream << "ctf_float(int, width, " << name << ".width()) "
<< "ctf_float(int, height, " << name << ".height()) ";
return;
case Tracepoint::Field::QtRectF:
stream << "ctf_float(int, x, " << name << ".x()) "
<< "ctf_float(int, y, " << name << ".y()) "
<< "ctf_float(int, width, " << name << ".width()) "
<< "ctf_float(int, height, " << name << ".height()) ";
return;
case Tracepoint::Field::QtSize:
stream << "ctf_integer(int, width, " << name << ".width()) "
<< "ctf_integer(int, height, " << name << ".height()) ";

View File

@ -140,7 +140,9 @@ static Tracepoint::Field::Type backendType(QString rawType)
TYPEDATA_ENTRY(QByteArray, Tracepoint::Field::QtByteArray),
TYPEDATA_ENTRY(QUrl, Tracepoint::Field::QtUrl),
TYPEDATA_ENTRY(QRect, Tracepoint::Field::QtRect),
TYPEDATA_ENTRY(QSize, Tracepoint::Field::QtSize)
TYPEDATA_ENTRY(QSize, Tracepoint::Field::QtSize),
TYPEDATA_ENTRY(QRectF, Tracepoint::Field::QtRectF),
TYPEDATA_ENTRY(QSizeF, Tracepoint::Field::QtSizeF)
};
auto backendType = [](const QString &rawType) {

View File

@ -33,6 +33,8 @@ struct Tracepoint
QtUrl,
QtRect,
QtSize,
QtRectF,
QtSizeF,
EnumeratedType,
FlagType,
Unknown