2015-05-06 01:27:59 -04:00
|
|
|
#pragma once
|
|
|
|
|
2020-01-02 20:33:11 +00:00
|
|
|
#include "win32/Window.h"
|
2015-05-06 01:27:59 -04:00
|
|
|
#include "bitmap/Bitmap.h"
|
|
|
|
#include "PixelBufferViewOverlay.h"
|
|
|
|
#include <memory>
|
2016-10-28 18:39:46 -04:00
|
|
|
#include <vector>
|
2020-01-02 20:33:11 +00:00
|
|
|
#include "GSH_OpenGL_Framedebugger.h"
|
|
|
|
#include "../OutputWnd.h"
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2020-01-02 20:33:11 +00:00
|
|
|
class CPixelBufferView : public Framework::Win32::CWindow
|
2015-05-06 01:27:59 -04:00
|
|
|
{
|
|
|
|
public:
|
2016-10-28 18:39:46 -04:00
|
|
|
typedef std::pair<std::string, Framework::CBitmap> PixelBuffer;
|
|
|
|
typedef std::vector<PixelBuffer> PixelBufferArray;
|
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
CPixelBufferView(HWND, const RECT&);
|
|
|
|
virtual ~CPixelBufferView() = default;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
void SetPixelBuffers(PixelBufferArray);
|
2016-10-28 18:39:46 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
void FitBitmap();
|
2020-01-02 20:33:11 +00:00
|
|
|
bool m_init = false;
|
2020-01-27 20:46:14 +00:00
|
|
|
|
2015-05-06 01:27:59 -04:00
|
|
|
protected:
|
2020-01-02 20:33:11 +00:00
|
|
|
void Refresh();
|
|
|
|
long OnPaint() override;
|
|
|
|
long OnEraseBkgnd() override;
|
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
long OnCommand(unsigned short, unsigned short, HWND) override;
|
|
|
|
long OnSize(unsigned int, unsigned int, unsigned int) override;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
long OnLeftButtonDown(int, int) override;
|
|
|
|
long OnLeftButtonUp(int, int) override;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
long OnMouseMove(WPARAM, int, int) override;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
long OnMouseWheel(int, int, short) override;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
struct VERTEX
|
|
|
|
{
|
2018-04-30 21:01:23 +01:00
|
|
|
float position[3];
|
|
|
|
float texCoord[2];
|
2015-05-06 01:27:59 -04:00
|
|
|
};
|
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
const PixelBuffer* GetSelectedPixelBuffer();
|
|
|
|
void CreateSelectedPixelBufferTexture();
|
2016-10-28 18:39:46 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
void OnSaveBitmap();
|
|
|
|
static Framework::CBitmap ConvertBGRToRGB(Framework::CBitmap);
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
void DrawCheckerboard();
|
|
|
|
void DrawPixelBuffer();
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
PixelBufferArray m_pixelBuffers;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
std::unique_ptr<CPixelBufferViewOverlay> m_overlay;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
float m_panX;
|
|
|
|
float m_panY;
|
|
|
|
float m_zoomFactor;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
bool m_dragging;
|
|
|
|
int m_dragBaseX;
|
|
|
|
int m_dragBaseY;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
float m_panXDragBase;
|
|
|
|
float m_panYDragBase;
|
2020-01-02 20:33:11 +00:00
|
|
|
|
|
|
|
std::unique_ptr<CGSH_OpenGLFramedebugger> m_gs;
|
|
|
|
std::unique_ptr<COutputWnd> m_handlerOutputWindow;
|
2015-05-06 01:27:59 -04:00
|
|
|
};
|