Play-/Source/ui_qt/DebugSupport/FrameDebugger/PixelBufferView.h

70 lines
1.4 KiB
C
Raw Permalink Normal View History

#pragma once
2020-02-02 19:46:03 +00:00
#include <QWidget>
#include <QComboBox>
#include <QPaintEvent>
#include <QWheelEvent>
#include "bitmap/Bitmap.h"
#include <memory>
#include <vector>
2020-02-02 19:46:03 +00:00
#include "GSH_OpenGLQt_Framedebugger.h"
class CPixelBufferView : public QWidget
{
2023-05-30 21:00:01 -04:00
Q_OBJECT
public:
typedef std::pair<std::string, Framework::CBitmap> PixelBuffer;
typedef std::vector<PixelBuffer> PixelBufferArray;
2020-02-02 19:46:03 +00:00
CPixelBufferView(QWidget*, QComboBox*);
2018-04-30 21:01:23 +01:00
virtual ~CPixelBufferView() = default;
2018-04-30 21:01:23 +01:00
void SetPixelBuffers(PixelBufferArray);
2018-04-30 21:01:23 +01:00
void FitBitmap();
2020-02-06 15:17:16 +00:00
void OnSaveBitmap();
2020-01-27 20:46:14 +00:00
protected:
2020-02-02 19:46:03 +00:00
void showEvent(QShowEvent*) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
2023-03-01 20:15:27 -05:00
protected slots:
void Refresh();
2020-02-02 19:46:03 +00:00
void OnMousePressEvent(QMouseEvent*);
void OnMouseMoveEvent(QMouseEvent*);
2023-03-01 20:15:27 -05:00
void OnMouseWheelEvent(QWheelEvent*);
private:
struct VERTEX
{
2018-04-30 21:01:23 +01:00
float position[3];
float texCoord[2];
};
2020-02-02 19:46:03 +00:00
QComboBox* m_contextBuffer;
2018-04-30 21:01:23 +01:00
const PixelBuffer* GetSelectedPixelBuffer();
void CreateSelectedPixelBufferTexture();
2018-04-30 21:01:23 +01:00
static Framework::CBitmap ConvertBGRToRGB(Framework::CBitmap);
2018-04-30 21:01:23 +01:00
void DrawCheckerboard();
void DrawPixelBuffer();
2018-04-30 21:01:23 +01:00
PixelBufferArray m_pixelBuffers;
2018-04-30 21:01:23 +01:00
float m_panX;
float m_panY;
float m_zoomFactor;
2018-04-30 21:01:23 +01:00
bool m_dragging;
int m_dragBaseX;
int m_dragBaseY;
2018-04-30 21:01:23 +01:00
float m_panXDragBase;
float m_panYDragBase;
std::unique_ptr<CGSH_OpenGLFramedebugger> m_gs;
2020-02-02 19:46:03 +00:00
QWindow* m_openglpanel = nullptr;
};