[PATCH 7/7] Display thumbnails only for calls that draw something

Dan McCabe zen3d.linux at gmail.com
Thu Jun 7 16:41:56 PDT 2012


Rather than accumulate all thumbnails that attempt to be drawn, this patch
filters out all calls that don't draw anything.

The calls that draw selected are a superset of the calls that
SettingsDialog initializes and which is displayed by the dialog box opened
with "Trace | Options". There, the following calls are selected:
     glDraw
     glVertex
     glBegin
     glEnd

To this collection of calls, this patch also selects thumbnails for:
   glClear
   glCallList
since the latter may result in drawing by a display list.

To accomplish this filtering, the method isDrawCall() was added to
the class ApiTraceCall. This code is modelled upon similar code found
in ApiTraceFilter.
---
 gui/apicalldelegate.cpp |    2 +-
 gui/apitracecall.cpp    |   20 ++++++++++++++++++++
 gui/apitracecall.h      |    2 ++
 3 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/gui/apicalldelegate.cpp b/gui/apicalldelegate.cpp
index 82b9721..2dba978 100644
--- a/gui/apicalldelegate.cpp
+++ b/gui/apicalldelegate.cpp
@@ -60,7 +60,7 @@ void ApiCallDelegate::paint(QPainter *painter,
             if (!thumbnail.isNull()) {
                 painter->drawImage(offset, thumbnail);
                 offset += QPoint(textSize.height() + thumbnail.width(), option.rect.height()/2 - textSize.height()/2);
-            } else {
+            } else if (call->isDrawCall()) {
             	call->missingThumbnail();
             }
             if (call->hasError()) {
diff --git a/gui/apitracecall.cpp b/gui/apitracecall.cpp
index 2450747..f458a67 100644
--- a/gui/apitracecall.cpp
+++ b/gui/apitracecall.cpp
@@ -1016,6 +1016,26 @@ void ApiTraceCall::missingThumbnail()
     m_parentFrame->parentTrace()->missingThumbnail(this);
 }
 
+bool ApiTraceCall::isDrawCall() const
+{
+	QString function = m_signature->name();
+
+	if (function.contains(QLatin1String("glDraw"))) {
+		return true;
+	} else if (function.contains(QLatin1String("glVertex"))) {
+		return true;
+	} else if (function.contains(QLatin1String("glBegin"))) {
+		return true;
+	} else if (function.contains(QLatin1String("glEnd"))) {
+		return true;
+	} else if (function.contains(QLatin1String("glCallList"))) {
+		return true;
+	} else if (function.contains(QLatin1String("glClear"))) {
+		return true;
+	}
+
+	return false;
+}
 
 ApiTraceFrame::ApiTraceFrame(ApiTrace *parentTrace)
     : ApiTraceEvent(ApiTraceEvent::Frame),
diff --git a/gui/apitracecall.h b/gui/apitracecall.h
index 345bba5..f222850 100644
--- a/gui/apitracecall.h
+++ b/gui/apitracecall.h
@@ -288,6 +288,8 @@ public:
     int binaryDataIndex() const;
 
     void missingThumbnail();
+
+    bool isDrawCall() const;
 private:
     int m_index;
     ApiTraceCallSignature *m_signature;
-- 
1.7.9.1



More information about the apitrace mailing list