Decompile fn_01845 (CDCBitmap::Create)

Batch #833 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review.

- fn_01845 CDCBitmap::Create: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-26 21:49:25 +00:00
commit e2351a9e3a
2 changed files with 31 additions and 0 deletions

View file

@ -39,6 +39,7 @@ public:
void Brighten(int x, int y, int width, int height, int amount) override;
void Dim(int x, int y, int width, int height, int percent) override;
void UploadTexture(CRenderSystemBase& system, CTexture*& texture);
HGDIOBJ Create(int width, int height);
// INLINED
void SetAlpha(bool alpha) {
this->m_cache.m_alpha = alpha;

View file

@ -1,3 +1,4 @@
#include "Render/DeviceContext/DCBitmap.h"
#include "Render/Textures/BitmapPixels.h"
#include "Render/RenderSystemBase.h"
#include "Render/Textures/SpriteAtlas.h"
@ -67,6 +68,35 @@ void BitmapPixels::Create(int newWidth, int newHeight) {
this->previous = SelectObject(this->dc, this->bitmap);
}
// FUNCTION: fn_01845
HGDIOBJ CDCBitmap::Create(int width, int height) {
this->m_bitmap.width = width;
this->m_bitmap.dirty = true;
this->m_bitmap.height = height;
this->m_cache.Clear();
BITMAPINFO info;
info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info.bmiHeader.biWidth = this->m_bitmap.width;
info.bmiHeader.biHeight = -static_cast<int>(this->m_bitmap.height);
info.bmiHeader.biPlanes = 1;
info.bmiHeader.biBitCount = 32;
info.bmiHeader.biCompression = BI_RGB;
info.bmiHeader.biSizeImage = 0;
info.bmiHeader.biXPelsPerMeter = 100;
info.bmiHeader.biYPelsPerMeter = 100;
info.bmiHeader.biClrUsed = 0;
info.bmiHeader.biClrImportant = 0;
this->m_bitmap.bitmap = CreateDIBSection(nullptr, &info, DIB_RGB_COLORS, reinterpret_cast<void**>(&this->m_bitmap.pixels), nullptr, 0);
if (!this->m_bitmap.bitmap) {
this->m_bitmap.pixels = nullptr;
}
this->m_bitmap.previous = SelectObject(this->m_bitmap.dc, this->m_bitmap.bitmap);
return this->m_bitmap.previous;
}
// OFFSET: 0x00547D40
// FUNCTION: fn_01850
void BitmapPixels::Grow(std::uint32_t newWidth, std::uint32_t newHeight) {