Implement LegoMeterPresenter::DrawMeter (#964)

* Implement LegoMeterPresenter::DrawMeter

* New MxRect16 header, offsets and size annotations

* Missing mxtypes include
This commit is contained in:
MS
2024-05-29 10:47:25 -04:00
committed by GitHub
parent da48dfb40d
commit 5f00634b9c
4 changed files with 167 additions and 45 deletions

View File

@@ -113,6 +113,17 @@ public:
// FUNCTION: BETA10 0x100982b0
inline MxLong GetDataSize() const { return AlignToFourByte(m_bmiHeader->biWidth) * GetBmiHeightAbs(); }
// FUNCTION: BETA10 0x1002c4b0
inline MxBool IsTopDown()
{
if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN) {
return TRUE;
}
else {
return m_bmiHeader->biHeight < 0;
}
}
inline MxLong GetAdjustedStride()
{
if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0) {
@@ -123,28 +134,18 @@ public:
}
}
inline MxLong GetLine(MxS32 p_top)
{
MxS32 height;
if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0) {
height = p_top;
}
else {
height = GetBmiHeightAbs() - p_top - 1;
}
return GetBmiStride() * height;
}
// FUNCTION: BETA10 0x1002c320
inline MxU8* GetStart(MxS32 p_left, MxS32 p_top)
{
if (m_bmiHeader->biCompression == BI_RGB) {
return GetLine(p_top) + m_data + p_left;
return m_data + p_left +
AlignToFourByte(GetBmiWidth()) * (IsTopDown() ? p_top : (GetBmiHeightAbs() - 1) - p_top);
}
else if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN) {
return m_data;
}
else {
return GetLine(0) + m_data;
return m_data + AlignToFourByte(GetBmiWidth()) * (IsTopDown() ? 0 : (GetBmiHeightAbs() - 1));
}
}

View File

@@ -0,0 +1,47 @@
#ifndef MXRECT16_H
#define MXRECT16_H
#include "mxtypes.h"
// SIZE 0x08
struct MxRect16 {
// FUNCTION: BETA10 0x10097ee0
MxRect16() {}
// FUNCTION: BETA10 0x100981f0
inline void SetLeft(MxS16 p_left) { m_left = p_left; }
// FUNCTION: BETA10 0x10098220
inline void SetTop(MxS16 p_top) { m_top = p_top; }
// FUNCTION: BETA10 0x10098250
inline void SetRight(MxS16 p_right) { m_right = p_right; }
// FUNCTION: BETA10 0x10098280
inline void SetBottom(MxS16 p_bottom) { m_bottom = p_bottom; }
// FUNCTION: BETA10 0x10098300
inline MxS16 GetLeft() const { return m_left; }
// FUNCTION: BETA10 0x10098330
inline MxS16 GetTop() const { return m_top; }
// There is no GetRight()
// FUNCTION: BETA10 0x10098360
inline MxS16 GetBottom() const { return m_bottom; }
// FUNCTION: BETA10 0x10098390
inline MxS16 GetWidth() const { return m_right - m_left + 1; }
// FUNCTION: BETA10 0x100983c0
inline MxS16 GetHeight() const { return m_bottom - m_top + 1; }
private:
MxS16 m_left; // 0x00
MxS16 m_top; // 0x02
MxS16 m_right; // 0x04
MxS16 m_bottom; // 0x06
};
#endif // MXRECT16_H