rodecomp/Source/Render/DX7/BackBufferDX7.cpp
ragnarok-clanker 1cd1a4fb45 Maintenance: Forced (approved by the maintainer: small score loss accepted for correct behaviour). Resubmission of 13473, returned on
Batch #13474 by ragnarok-clanker: forced by an admin (3 lower score(s), 9 changed function(s)); checked with 65 compiled unit(s), including every includer of Source/Contents/Effects/RagEffect.h, Source/Render/DX7/DeviceOwnerDX7.h, Source/Render/DX7/RenderSystemDX7.h, Source/Render/RendererDX7.h, Source/Contents/Effects/RagEffectInitialization.h.
Deletes: Source/Contents/Effects/RagEffectInitialization.h
2026-11-06 18:29:50 +00:00

67 lines
1.9 KiB
C++

#include "Render/DX7/DeviceOwnerDX7.h"
#include "Render/RendererDX7.h"
// OFFSET: 0x00549570
// FUNCTION: fn_45504
void DeviceOwnerDX7::CaptureBackBufferImpl() {
if (this->captureSurface && this->renderTarget) {
if (FAILED(this->captureSurface->Blt(nullptr, this->renderTarget, nullptr, DDBLT_ASYNC, nullptr))) {
this->captureSurface->Blt(nullptr, this->renderTarget, nullptr, DDBLT_WAIT, nullptr);
}
}
}
// OFFSET: 0x0055A080
// FUNCTION: fn_02075
bool CRendererDX7::CaptureBackBuffer() {
DeviceOwnerDX7* owner = g_deviceOwnerDX7;
if (owner) {
owner->CaptureBackBufferImpl();
}
return true;
}
// OFFSET: 0x0054AEB0
// FUNCTION: fn_45505
void DeviceOwnerDX7::RestoreBackBufferImpl() {
if (this->renderTarget && this->captureSurface) {
if (FAILED(this->renderTarget->Blt(nullptr, this->captureSurface, nullptr, DDBLT_ASYNC, nullptr))) {
this->renderTarget->Blt(nullptr, this->captureSurface, nullptr, DDBLT_WAIT, nullptr);
}
}
}
// OFFSET: 0x0055D850
// FUNCTION: fn_02108
bool CRendererDX7::RestoreBackBuffer() {
DeviceOwnerDX7* owner = g_deviceOwnerDX7;
if (owner) {
owner->RestoreBackBufferImpl();
}
return true;
}
// OFFSET: 0x0055D3E0
// FUNCTION: fn_02103
bool CRendererDX7::LockBackBuffer() {
DDSURFACEDESC2 description{};
description.dwSize = sizeof(description);
IDirectDrawSurface7* renderTarget = g_deviceOwnerDX7 ? g_deviceOwnerDX7->renderTarget : nullptr;
if (FAILED(renderTarget->Lock(nullptr, &description, DDLOCK_WAIT, nullptr))) {
return false;
}
this->backBuffer.pixels = description.lpSurface;
this->backBuffer.bitsPerPixel = description.ddpfPixelFormat.dwRGBBitCount;
this->backBuffer.pitch = description.lPitch;
return true;
}
// OFFSET: 0x0055FBB0
// FUNCTION: fn_02122
HRESULT CRendererDX7::UnlockBackBuffer() {
IDirectDrawSurface7* renderTarget = g_deviceOwnerDX7 ? g_deviceOwnerDX7->renderTarget : nullptr;
return renderTarget->Unlock(nullptr);
}