From 3e8911dd3a033a44196dd3e19db8c3bcdb1b36da Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 12 Nov 2026 03:58:29 +0000 Subject: [PATCH] Decompile 2 functions in Source/Render/Textures/BitmapTextureCache.cpp Batch #17816 by eAthena: 0 byte-identical, 2 confirmed by peer review. - fn_01854 BitmapTextureCache::Update: logic confirmed by peer review - fn_01846 CDCBitmap::Draw: logic confirmed by peer review Peer-reviewed-by: alisonrag, cremane, bibinir Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Render/Textures/BitmapTextureCache.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/Render/Textures/BitmapTextureCache.cpp b/Source/Render/Textures/BitmapTextureCache.cpp index 217ba54da..cf5536d80 100644 --- a/Source/Render/Textures/BitmapTextureCache.cpp +++ b/Source/Render/Textures/BitmapTextureCache.cpp @@ -23,7 +23,7 @@ void BitmapTextureCache::Update(BitmapPixels& bitmap) { return; } - if (this->m_alpha) { + if (this->m_alpha == true) { if (this->m_textures.empty()) { CTexture* texture = g_texMgr.CreateTexture(bitmap.width, bitmap.height, TextureFormat::A8R8G8B8, false, false); if (texture) { @@ -55,7 +55,8 @@ void BitmapTextureCache::Update(BitmapPixels& bitmap) { for (unsigned y = 0; y < bitmap.height; y += 256) { for (unsigned x = 0; x < bitmap.width; x += 256) { - (*texture++)->Upload(0, 0, std::min(256u, bitmap.width - x), std::min(256u, bitmap.height - y), bitmap.pixels + x + y * bitmap.width, 0, bitmap.width); + (*texture)->Upload(0, 0, std::min(256u, bitmap.width - x), std::min(256u, bitmap.height - y), bitmap.pixels + x + y * bitmap.width, 0, bitmap.width); + ++texture; } } } @@ -75,7 +76,7 @@ void CDCBitmap::Draw(int x, int y, int width, int height, std::uint32_t color) { return; } - if (this->m_cache.m_alpha) { + if (this->m_cache.m_alpha == true) { for (CTexture* texture : this->m_cache.m_textures) { texture->Draw(x, y, width, height, color); } @@ -87,7 +88,8 @@ void CDCBitmap::Draw(int x, int y, int width, int height, std::uint32_t color) { int remainingWidth = width; for (int column = 0; column < width; column += 256, remainingWidth -= 256) { - (*texture++)->Draw(x + column, y + row, std::min(256, remainingWidth), std::min(256, remainingHeight), color); + (*texture)->Draw(x + column, y + row, remainingWidth > 256 ? 256 : remainingWidth, remainingHeight > 256 ? 256 : remainingHeight, color); + ++texture; } } }