mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12:00
rsx_debugger: handle show buffer per doubleclick through an event filter
This commit is contained in:
parent
ff89f7ca45
commit
b9318f73e6
2 changed files with 46 additions and 51 deletions
|
@ -169,13 +169,13 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
|
||||||
m_list_index_buffer->setFont(mono);
|
m_list_index_buffer->setFont(mono);
|
||||||
|
|
||||||
//Panels for displaying the buffers
|
//Panels for displaying the buffers
|
||||||
m_buffer_colorA = new Buffer(false, 0, tr("Color Buffer A"));
|
m_buffer_colorA = new Buffer(false, 0, tr("Color Buffer A"), this);
|
||||||
m_buffer_colorB = new Buffer(false, 1, tr("Color Buffer B"));
|
m_buffer_colorB = new Buffer(false, 1, tr("Color Buffer B"), this);
|
||||||
m_buffer_colorC = new Buffer(false, 2, tr("Color Buffer C"));
|
m_buffer_colorC = new Buffer(false, 2, tr("Color Buffer C"), this);
|
||||||
m_buffer_colorD = new Buffer(false, 3, tr("Color Buffer D"));
|
m_buffer_colorD = new Buffer(false, 3, tr("Color Buffer D"), this);
|
||||||
m_buffer_depth = new Buffer(false, 4, tr("Depth Buffer"));
|
m_buffer_depth = new Buffer(false, 4, tr("Depth Buffer"), this);
|
||||||
m_buffer_stencil = new Buffer(false, 4, tr("Stencil Buffer"));
|
m_buffer_stencil = new Buffer(false, 4, tr("Stencil Buffer"), this);
|
||||||
m_buffer_tex = new Buffer(true, 4, tr("Texture"));
|
m_buffer_tex = new Buffer(true, 4, tr("Texture"), this);
|
||||||
|
|
||||||
//Merge and display everything
|
//Merge and display everything
|
||||||
QVBoxLayout* vbox_buffers1 = new QVBoxLayout();
|
QVBoxLayout* vbox_buffers1 = new QVBoxLayout();
|
||||||
|
@ -348,26 +348,23 @@ bool rsx_debugger::eventFilter(QObject* object, QEvent* event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Buffer* buffer = qobject_cast<Buffer*>(object))
|
||||||
|
{
|
||||||
|
switch (event->type())
|
||||||
|
{
|
||||||
|
case QEvent::MouseButtonDblClick:
|
||||||
|
{
|
||||||
|
buffer->ShowWindowed();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return QDialog::eventFilter(object, event);
|
return QDialog::eventFilter(object, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
// Opens an image in a new window with original size
|
|
||||||
void display_buffer(const QImage& img)
|
|
||||||
{
|
|
||||||
if (img.isNull()) return;
|
|
||||||
//QString title = qstr(fmt::format("Raw Image @ 0x%x", addr));
|
|
||||||
QLabel* canvas = new QLabel();
|
|
||||||
canvas->setObjectName("rsx_debugger_display_buffer");
|
|
||||||
canvas->setPixmap(QPixmap::fromImage(img));
|
|
||||||
canvas->setFixedSize(img.size());
|
|
||||||
canvas->ensurePolished();
|
|
||||||
canvas->show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Buffer::Buffer(bool isTex, u32 id, const QString& name, QWidget* parent)
|
Buffer::Buffer(bool isTex, u32 id, const QString& name, QWidget* parent)
|
||||||
: QGroupBox(name, parent), m_isTex(isTex), m_id(id)
|
: QGroupBox(name, parent), m_isTex(isTex), m_id(id)
|
||||||
{
|
{
|
||||||
|
@ -380,15 +377,20 @@ Buffer::Buffer(bool isTex, u32 id, const QString& name, QWidget* parent)
|
||||||
layout->setContentsMargins(1, 1, 1, 1);
|
layout->setContentsMargins(1, 1, 1, 1);
|
||||||
layout->addWidget(m_canvas);
|
layout->addWidget(m_canvas);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
|
installEventFilter(parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Draws a formatted and buffered <image> inside the Buffer Widget
|
// Draws a formatted and buffered <image> inside the Buffer Widget
|
||||||
void Buffer::showImage(const QImage& image)
|
void Buffer::showImage(const QImage& image)
|
||||||
{
|
{
|
||||||
if (image.isNull()) return;
|
if (image.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
m_image = image;
|
m_image = image;
|
||||||
QImage scaled = m_image.scaled(m_image_size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
QImage scaled = m_image.scaled(m_image_size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
m_canvas->setPixmap(QPixmap::fromImage(scaled));
|
m_canvas->setPixmap(QPixmap::fromImage(scaled));
|
||||||
|
|
||||||
QHBoxLayout* new_layout = new QHBoxLayout();
|
QHBoxLayout* new_layout = new QHBoxLayout();
|
||||||
new_layout->setContentsMargins(1, 1, 1, 1);
|
new_layout->setContentsMargins(1, 1, 1, 1);
|
||||||
new_layout->addWidget(m_canvas);
|
new_layout->addWidget(m_canvas);
|
||||||
|
@ -396,15 +398,11 @@ void Buffer::showImage(const QImage& image)
|
||||||
setLayout(new_layout);
|
setLayout(new_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::mouseDoubleClickEvent(QMouseEvent* event)
|
void Buffer::ShowWindowed()
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
{
|
{
|
||||||
const auto render = fxm::get<GSRender>();
|
const auto render = fxm::get<GSRender>();
|
||||||
if (!render)
|
if (!render)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
const auto buffers = render->display_buffers;
|
const auto buffers = render->display_buffers;
|
||||||
|
|
||||||
|
@ -419,7 +417,7 @@ void Buffer::mouseDoubleClickEvent(QMouseEvent* event)
|
||||||
|
|
||||||
//if (0 <= m_id && m_id < 4) SHOW_BUFFER(m_id);
|
//if (0 <= m_id && m_id < 4) SHOW_BUFFER(m_id);
|
||||||
|
|
||||||
display_buffer(m_image);
|
gui::utils::show_windowed_image(m_image, title());
|
||||||
|
|
||||||
if (m_isTex)
|
if (m_isTex)
|
||||||
{
|
{
|
||||||
|
@ -431,9 +429,8 @@ void Buffer::mouseDoubleClickEvent(QMouseEvent* event)
|
||||||
render->textures[m_cur_texture].width(),
|
render->textures[m_cur_texture].width(),
|
||||||
render->textures[m_cur_texture].height(), false);*/
|
render->textures[m_cur_texture].height(), false);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SHOW_BUFFER
|
#undef SHOW_BUFFER
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QKeyEvent>
|
#include <QEvent>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
|
@ -42,9 +42,7 @@ class Buffer : public QGroupBox
|
||||||
public:
|
public:
|
||||||
Buffer(bool isTex, u32 id, const QString& name, QWidget* parent = 0);
|
Buffer(bool isTex, u32 id, const QString& name, QWidget* parent = 0);
|
||||||
void showImage(const QImage& image = QImage());
|
void showImage(const QImage& image = QImage());
|
||||||
|
void ShowWindowed();
|
||||||
protected:
|
|
||||||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class rsx_debugger : public QDialog
|
class rsx_debugger : public QDialog
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue