- separated DFrameBuffer from DCanvas.

This was a bad idea from the start and really only made sense with DirectDraw.
These days a FrameBuffer represents an abstract hardware canvas that shares nothing with a software canvas so having these classes linked together makes things needlessly complicated.
The software render buffer is now a canvas object owned by the FrameBuffer.

Note that this commit deactivates a few things in the software renderer, but from the looks of it none of those will be needed anymore if we set OpenGL 2 as minimum target.
This commit is contained in:
Christoph Oelckers 2018-03-27 14:14:46 +02:00
commit c06ad5c59c
14 changed files with 43 additions and 51 deletions

View file

@ -262,7 +262,6 @@ D3DFB::D3DFB (UINT adapter, int width, int height, bool bgra, bool fullscreen)
NeedPalUpdate = false;
RenderBuffer = new DSimpleCanvas(width, height, bgra);
Pitch = RenderBuffer->GetPitch(); // should be removed, but still needed as long as DFrameBuffer inherits from DCanvas
memcpy(SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256);
@ -1210,9 +1209,12 @@ void D3DFB::Draw3DPart(bool copy3d)
SUCCEEDED(FBTexture->LockRect (0, &lockrect, NULL, D3DLOCK_DISCARD))) ||
SUCCEEDED(FBTexture->LockRect (0, &lockrect, &texrect, 0)))
{
auto MemBuffer = RenderBuffer->GetPixels();
auto Pitch = RenderBuffer->GetPitch();
if (IsBgra() && FBFormat == D3DFMT_A8R8G8B8)
{
auto MemBuffer = RenderBuffer->GetPixels();
if (lockrect.Pitch == Pitch * sizeof(uint32_t) && Pitch == Width)
{
memcpy(lockrect.pBits, MemBuffer, Width * Height * sizeof(uint32_t));
@ -1233,7 +1235,7 @@ void D3DFB::Draw3DPart(bool copy3d)
{
if (lockrect.Pitch == Pitch && Pitch == Width)
{
memcpy(lockrect.pBits, RenderBuffer->GetPixels(), Width * Height);
memcpy(lockrect.pBits, MemBuffer, Width * Height);
}
else
{