- Moved renderer dependent part of savegame pic creation into DFrameBuffer

as a virtual function so that it can be overridden.


SVN r700 (trunk)
This commit is contained in:
Christoph Oelckers 2008-01-12 12:49:05 +00:00
commit 2e613c3557
4 changed files with 28 additions and 10 deletions

View file

@ -61,6 +61,7 @@
#include "hardware.h"
#include "r_translate.h"
#include "f_wipe.h"
#include "m_png.h"
IMPLEMENT_ABSTRACT_CLASS (DCanvas)
IMPLEMENT_ABSTRACT_CLASS (DFrameBuffer)
@ -1310,6 +1311,7 @@ void DFrameBuffer::CopyPixelData(BYTE * buffer, int texpitch, int texheight, int
// Render the view
//
//===========================================================================
void DFrameBuffer::RenderView(player_t *player)
{
R_RenderActorView (player->mo);
@ -1318,6 +1320,26 @@ void DFrameBuffer::RenderView(player_t *player)
FCanvasTextureInfo::UpdateAll ();
}
//===========================================================================
//
// Render the view to a savegame picture
//
//===========================================================================
void DFrameBuffer::WriteSavePic (player_t *player, FILE *file, int width, int height)
{
DCanvas *pic = new DSimpleCanvas (width, height);
PalEntry palette[256];
// Take a snapshot of the player's view
pic->Lock ();
R_RenderViewToCanvas (player->mo, pic, 0, 0, width, height);
GetFlashedPalette (palette);
M_CreatePNG (file, pic->GetBuffer(), palette, SS_PAL, width, height, pic->GetPitch());
pic->Unlock ();
delete pic;
}
FNativePalette::~FNativePalette()