rodecomp/Source/Render/DX9/TextureDX9.h
ragnarok-clanker 15fd41fd65 Decompile 3 functions in Source/Render/DX9/TextureDX9.cpp, Source/Render/DX9/TextureDX9.h, ...
Batch #15609 by Yommy: 1 byte-identical, 2 confirmed by peer review.

- fn_02480 CTextureDX9::Create: logic confirmed by peer review
- fn_02484 CTextureDX9::ClearSurface: logic confirmed by peer review
- fn_02441 PackColorA1R5G5B5: byte-identical

Peer-reviewed-by: secret, KWDev, codeplay
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-10 07:36:13 +00:00

57 lines
2.1 KiB
C++

#ifndef RAGNAROK_SOURCE_RENDER_DX9_TEXTUREDX9_H
#define RAGNAROK_SOURCE_RENDER_DX9_TEXTUREDX9_H
#include "Render/Textures/Texture.h"
#include <d3d9.h>
struct RenderQueues;
class RenderPrimitivePool;
class DeviceOwnerDX9;
class CTextureDX9 : public CTexture {
public:
explicit CTextureDX9(DeviceOwnerDX9& owner);
CTextureDX9(DeviceOwnerDX9& owner, int width, int height, int format, bool dynamic, bool renderTarget);
CTextureDX9(DeviceOwnerDX9& owner, IDirect3DTexture9* texture);
~CTextureDX9() override;
bool Resize(int width, int height) override;
SurfaceLock Lock() override;
void Unlock() override;
bool GetDC(HDC* output) override;
void ReleaseDC(HDC dc) override;
void Upload(int x, int y, int width, int height, const std::uint32_t* pixels, int option, int sourceWidth) override;
void Fill(const RECT* rectangle, std::uint32_t color) override;
void Draw(int x, int y, int width, int height, std::uint32_t color) override;
void Stretch(int x, int y, int width, int height) override;
void Update(const RECT* rectangle) override;
void UploadSprite(int x, int y, int width, int height, const SpriteRleImage* image, const std::uint32_t* palette) override;
bool CopyTexture(CTexture* source, int sourceX, int sourceY, int sourceWidth, int sourceHeight, int x, int y, int width, int height) override;
bool Create(int width, int height, int format) override;
// INLINED
IDirect3DTexture9* NativeTexture() const {
return this->m_texture;
}
protected:
/* 0124 */ DeviceOwnerDX9* m_owner;
/* 0128 */ bool m_renderTargetUsage;
/* 0129 */ bool m_dynamic;
/* 012A */ bool m_allowDynamic;
/* 012B */ bool m_renderTarget;
/* 012C */ IDirect3DTexture9* m_texture;
/* 0130 */ IDirect3DSurface9* m_surface;
/* 0134 */ D3DSURFACE_DESC m_description;
private:
void Filter();
void ClearSurface(IDirect3DSurface9* surface, std::uint32_t color);
bool UploadSurface(IDirect3DSurface9* surface, int x, int y, int width, int height, const std::uint32_t* pixels, std::uint8_t blackTransparent, int sourceWidth);
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CTextureDX9) == 340);
#endif
#endif