}
}
}
+
+ QVariantMap fbos =
+ parsedJson[QLatin1String("framebuffer")].toMap();
+ QVariantMap::const_iterator itr;
+ for (itr = fbos.constBegin(); itr != fbos.constEnd(); ++itr) {
+ QVariantMap buffer = itr.value().toMap();
+ QSize size(buffer[QLatin1String("__width__")].toInt(),
+ buffer[QLatin1String("__height__")].toInt());
+ QString cls = buffer[QLatin1String("__class__")].toString();
+ QString type = buffer[QLatin1String("__type__")].toString();
+ bool normalized = buffer[QLatin1String("__normalized__")].toBool();
+ int numChannels = buffer[QLatin1String("__channels__")].toInt();
+
+ Q_ASSERT(numChannels == 4);
+ Q_ASSERT(type == QLatin1String("uint8"));
+ Q_ASSERT(normalized == true);
+
+ QByteArray dataArray =
+ buffer[QLatin1String("__data__")].toByteArray();
+
+ ApiFramebuffer fbo;
+ fbo.setSize(size);
+ fbo.setType(itr.key());
+ fbo.contentsFromBase64(dataArray);
+ m_framebuffers.append(fbo);
+ }
}
QVariantMap ApiTraceState::parameters() const
return m_textures;
}
+QList<ApiFramebuffer> ApiTraceState::framebuffers() const
+{
+ return m_framebuffers;
+}
+
const QList<ApiTexture> &textures =
state.textures();
+ const QList<ApiFramebuffer> &fbos =
+ state.framebuffers();
m_ui.surfacesTreeWidget->clear();
- if (textures.isEmpty()) {
+ if (textures.isEmpty() && fbos.isEmpty()) {
m_ui.surfacesTab->setDisabled(false);
} else {
- QTreeWidgetItem *textureItem =
- new QTreeWidgetItem(m_ui.surfacesTreeWidget);
m_ui.surfacesTreeWidget->setIconSize(QSize(64, 64));
- textureItem->setText(0, tr("Textures"));
- for (int i = 0; i < textures.count(); ++i) {
- const ApiTexture &texture =
- textures[i];
- QIcon icon(QPixmap::fromImage(texture.thumb()));
- QTreeWidgetItem *item = new QTreeWidgetItem(textureItem);
- item->setIcon(0, icon);
- int width = texture.size().width();
- int height = texture.size().height();
- QString descr =
- QString::fromLatin1("%1, %2 x %3")
- .arg(texture.target())
- .arg(width)
- .arg(height);
- item->setText(1, descr);
-
- item->setData(0, Qt::UserRole,
- texture.image());
+ if (!textures.isEmpty()) {
+ QTreeWidgetItem *textureItem =
+ new QTreeWidgetItem(m_ui.surfacesTreeWidget);
+ textureItem->setText(0, tr("Textures"));
+ for (int i = 0; i < textures.count(); ++i) {
+ const ApiTexture &texture =
+ textures[i];
+ QIcon icon(QPixmap::fromImage(texture.thumb()));
+ QTreeWidgetItem *item = new QTreeWidgetItem(textureItem);
+ item->setIcon(0, icon);
+ int width = texture.size().width();
+ int height = texture.size().height();
+ QString descr =
+ QString::fromLatin1("%1, %2 x %3")
+ .arg(texture.target())
+ .arg(width)
+ .arg(height);
+ item->setText(1, descr);
+
+ item->setData(0, Qt::UserRole,
+ texture.image());
+ }
+ }
+ if (!fbos.isEmpty()) {
+ QTreeWidgetItem *fboItem =
+ new QTreeWidgetItem(m_ui.surfacesTreeWidget);
+ fboItem->setText(0, tr("Framebuffers"));
+ for (int i = 0; i < fbos.count(); ++i) {
+ const ApiFramebuffer &fbo =
+ fbos[i];
+ QIcon icon(QPixmap::fromImage(fbo.thumb()));
+ QTreeWidgetItem *item = new QTreeWidgetItem(fboItem);
+ item->setIcon(0, icon);
+ int width = fbo.size().width();
+ int height = fbo.size().height();
+ QString descr =
+ QString::fromLatin1("%1, %2 x %3")
+ .arg(fbo.type())
+ .arg(width)
+ .arg(height);
+ item->setText(1, descr);
+
+ item->setData(0, Qt::UserRole,
+ fbo.image());
+ }
}
m_ui.surfacesTab->setEnabled(true);
}