#pragma once #include #include #include #include #include "bitmap/Bitmap.h" #include #include #include "GSH_OpenGLQt_Framedebugger.h" class CPixelBufferView : public QWidget { Q_OBJECT public: typedef std::pair PixelBuffer; typedef std::vector PixelBufferArray; CPixelBufferView(QWidget*, QComboBox*); virtual ~CPixelBufferView() = default; void SetPixelBuffers(PixelBufferArray); void FitBitmap(); void OnSaveBitmap(); protected: void showEvent(QShowEvent*) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE; protected slots: void Refresh(); void OnMousePressEvent(QMouseEvent*); void OnMouseMoveEvent(QMouseEvent*); void OnMouseWheelEvent(QWheelEvent*); private: struct VERTEX { float position[3]; float texCoord[2]; }; QComboBox* m_contextBuffer; const PixelBuffer* GetSelectedPixelBuffer(); void CreateSelectedPixelBufferTexture(); static Framework::CBitmap ConvertBGRToRGB(Framework::CBitmap); void DrawCheckerboard(); void DrawPixelBuffer(); PixelBufferArray m_pixelBuffers; float m_panX; float m_panY; float m_zoomFactor; bool m_dragging; int m_dragBaseX; int m_dragBaseY; float m_panXDragBase; float m_panYDragBase; std::unique_ptr m_gs; QWindow* m_openglpanel = nullptr; };