]> git.cworth.org Git - apitrace/blobdiff - gui/apitracecall.cpp
Encode format as a member and not part of the label.
[apitrace] / gui / apitracecall.cpp
index de5d02062a919fc8e97f2adb00291cb0f81d5b71..c8c2245effe5e1562d40f3ca64b407944cf7a063 100644 (file)
@@ -16,7 +16,7 @@ const char * const styleSheet =
     "    font-weight:bold;\n"
     // text shadow looks great but doesn't work well in qtwebkit 4.7
     "    /*text-shadow: 0px 2px 3px #555;*/\n"
-    "    font-size: 1.2em;\n"
+    "    font-size: 1.1em;\n"
     "}\n"
     ".arg-name {\n"
     "    border: 1px solid rgb(238,206,0);\n"
@@ -101,6 +101,10 @@ plainTextToHTML(const QString & plain, bool multiLine)
 QString
 apiVariantToString(const QVariant &variant, bool multiLine)
 {
+    if (variant.isNull()) {
+        return QLatin1String("?");
+    }
+
     if (variant.userType() == QVariant::Double) {
         return QString::number(variant.toFloat());
     }
@@ -454,6 +458,10 @@ ApiTraceState::ApiTraceState(const QVariantMap &parsedJson)
             image[QLatin1String("__normalized__")].toBool();
         int numChannels =
             image[QLatin1String("__channels__")].toInt();
+        int depth =
+            image[QLatin1String("__depth__")].toInt();
+        QString formatName =
+            image[QLatin1String("__format__")].toString();
 
         Q_ASSERT(type == QLatin1String("uint8"));
         Q_ASSERT(normalized == true);
@@ -464,6 +472,8 @@ ApiTraceState::ApiTraceState(const QVariantMap &parsedJson)
 
         ApiTexture tex;
         tex.setSize(size);
+        tex.setDepth(depth);
+        tex.setFormatName(formatName);
         tex.setNumChannels(numChannels);
         tex.setLabel(itr.key());
         tex.contentsFromBase64(dataArray);
@@ -481,6 +491,8 @@ ApiTraceState::ApiTraceState(const QVariantMap &parsedJson)
         QString type = buffer[QLatin1String("__type__")].toString();
         bool normalized = buffer[QLatin1String("__normalized__")].toBool();
         int numChannels = buffer[QLatin1String("__channels__")].toInt();
+        int depth = buffer[QLatin1String("__depth__")].toInt();
+        QString formatName = buffer[QLatin1String("__format__")].toString();
 
         Q_ASSERT(type == QLatin1String("uint8"));
         Q_ASSERT(normalized == true);
@@ -491,6 +503,8 @@ ApiTraceState::ApiTraceState(const QVariantMap &parsedJson)
 
         ApiFramebuffer fbo;
         fbo.setSize(size);
+        fbo.setDepth(depth);
+        fbo.setFormatName(formatName);
         fbo.setNumChannels(numChannels);
         fbo.setType(itr.key());
         fbo.contentsFromBase64(dataArray);
@@ -635,12 +649,16 @@ ApiTraceCall::ApiTraceCall(ApiTraceFrame *parentFrame,
     }
     m_argValues.reserve(call->args.size());
     for (int i = 0; i < call->args.size(); ++i) {
-        VariantVisitor argVisitor(loader);
-        call->args[i]->visit(argVisitor);
-        m_argValues.append(argVisitor.variant());
-        if (m_argValues[i].type() == QVariant::ByteArray) {
-            m_hasBinaryData = true;
-            m_binaryDataIndex = i;
+        if (call->args[i]) {
+            VariantVisitor argVisitor(loader);
+            call->args[i]->visit(argVisitor);
+            m_argValues.append(argVisitor.variant());
+            if (m_argValues[i].type() == QVariant::ByteArray) {
+                m_hasBinaryData = true;
+                m_binaryDataIndex = i;
+            }
+        } else {
+            m_argValues.append(QVariant());
         }
     }
     m_argValues.squeeze();
@@ -832,18 +850,28 @@ QString ApiTraceCall::toHtml() const
     if (!m_richText.isEmpty())
         return m_richText;
 
-    m_richText = QLatin1String("<div class=\"call\">");
+    m_richText += QLatin1String("<div class=\"call\">");
+
 
+    m_richText +=
+        QString::fromLatin1("%1) ")
+        .arg(m_index);
+    QString parentTip;
+    if (m_parentFrame) {
+        parentTip =
+            QString::fromLatin1("Frame %1")
+            .arg(m_parentFrame->number);
+    }
     QUrl helpUrl = m_signature->helpUrl();
     if (helpUrl.isEmpty()) {
         m_richText += QString::fromLatin1(
-            "%1) <span class=\"callName\">%2</span>(")
-                      .arg(m_index)
+            "<span class=\"callName\" title=\"%1\">%2</span>(")
+                      .arg(parentTip)
                       .arg(m_signature->name());
     } else {
         m_richText += QString::fromLatin1(
-            "%1) <span class=\"callName\"><a href=\"%2\">%3</a></span>(")
-                      .arg(m_index)
+         "<span class=\"callName\" title=\"%1\"><a href=\"%2\">%3</a></span>(")
+                      .arg(parentTip)
                       .arg(helpUrl.toString())
                       .arg(m_signature->name());
     }