Enable decorations in renderer for local save items, disable for server save previews.
This commit is contained in:
parent
ebc4116675
commit
0ca680f4c8
@ -54,11 +54,12 @@ class ThumbnailBroker::ThumbRenderRequest
|
||||
{
|
||||
public:
|
||||
int Width, Height;
|
||||
bool Decorations;
|
||||
GameSave * Save;
|
||||
ThumbnailListener * CompletedListener;
|
||||
ThumbRenderRequest(GameSave * save, int width, int height, ThumbnailListener * completedListener) :
|
||||
Save(save), Width(width), Height(height), CompletedListener(completedListener) {}
|
||||
ThumbRenderRequest() : Save(0), Width(0), Height(0), CompletedListener(NULL) {}
|
||||
ThumbRenderRequest(GameSave * save, bool decorations, int width, int height, ThumbnailListener * completedListener) :
|
||||
Save(save), Width(width), Height(height), CompletedListener(completedListener), Decorations(decorations) {}
|
||||
ThumbRenderRequest() : Save(0), Decorations(true), Width(0), Height(0), CompletedListener(NULL) {}
|
||||
};
|
||||
|
||||
ThumbnailBroker::ThumbnailBroker()
|
||||
@ -77,12 +78,17 @@ ThumbnailBroker::~ThumbnailBroker()
|
||||
}
|
||||
|
||||
void ThumbnailBroker::RenderThumbnail(GameSave * gameSave, int width, int height, ThumbnailListener * tListener)
|
||||
{
|
||||
RenderThumbnail(gameSave, true, width, height, tListener);
|
||||
}
|
||||
|
||||
void ThumbnailBroker::RenderThumbnail(GameSave * gameSave, bool decorations, int width, int height, ThumbnailListener * tListener)
|
||||
{
|
||||
AttachThumbnailListener(tListener);
|
||||
pthread_mutex_lock(&thumbnailQueueMutex);
|
||||
bool running = thumbnailQueueRunning;
|
||||
thumbnailQueueRunning = true;
|
||||
renderRequests.push_back(ThumbRenderRequest(new GameSave(*gameSave), width, height, tListener));
|
||||
renderRequests.push_back(ThumbRenderRequest(new GameSave(*gameSave), decorations, width, height, tListener));
|
||||
pthread_mutex_unlock(&thumbnailQueueMutex);
|
||||
|
||||
if(!running)
|
||||
@ -167,7 +173,7 @@ void ThumbnailBroker::thumbnailQueueProcessTH()
|
||||
std::cout << typeid(*this).name() << " Processing render request" << std::endl;
|
||||
#endif
|
||||
|
||||
Thumbnail * thumbnail = SaveRenderer::Ref().Render(req.Save);
|
||||
Thumbnail * thumbnail = SaveRenderer::Ref().Render(req.Save, req.Decorations);
|
||||
delete req.Save;
|
||||
|
||||
if(thumbnail)
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
virtual ~ThumbnailBroker();
|
||||
|
||||
void FlushThumbQueue();
|
||||
void RenderThumbnail(GameSave * gameSave, bool decorations, int width, int height, ThumbnailListener * tListener);
|
||||
void RenderThumbnail(GameSave * gameSave, int width, int height, ThumbnailListener * tListener);
|
||||
void RetrieveThumbnail(int saveID, int saveDate, int width, int height, ThumbnailListener * tListener);
|
||||
void RetrieveThumbnail(int saveID, int width, int height, ThumbnailListener * tListener);
|
||||
|
@ -356,7 +356,7 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender)
|
||||
|
||||
if(save->GetGameSave())
|
||||
{
|
||||
savePreview = SaveRenderer::Ref().Render(save->GetGameSave());
|
||||
savePreview = SaveRenderer::Ref().Render(save->GetGameSave(), false);
|
||||
|
||||
if(savePreview && savePreview->Data && !(savePreview->Size.X == XRES/2 && savePreview->Size.Y == YRES/2))
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
|
||||
SetOkayButton(okayButton);
|
||||
|
||||
if(save.GetGameSave())
|
||||
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), (Size.X/2)-16, -1, this);
|
||||
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), false, (Size.X/2)-16, -1, this);
|
||||
}
|
||||
|
||||
ServerSaveActivity::ServerSaveActivity(SaveInfo save, bool saveNow, ServerSaveActivity::SaveUploadedCallback * callback) :
|
||||
|
@ -38,7 +38,7 @@ SaveRenderer::SaveRenderer(){
|
||||
#endif
|
||||
}
|
||||
|
||||
Thumbnail * SaveRenderer::Render(GameSave * save)
|
||||
Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations)
|
||||
{
|
||||
int width, height;
|
||||
Thumbnail * tempThumb;
|
||||
@ -52,7 +52,7 @@ Thumbnail * SaveRenderer::Render(GameSave * save)
|
||||
|
||||
if(!sim->Load(save))
|
||||
{
|
||||
ren->decorations_enable = false;
|
||||
ren->decorations_enable = decorations;
|
||||
#if defined(OGLR) || defined(OGLI)
|
||||
pixel * pData = NULL;
|
||||
unsigned char * texData = NULL;
|
||||
@ -123,7 +123,7 @@ Thumbnail * SaveRenderer::Render(GameSave * save)
|
||||
return tempThumb;
|
||||
}
|
||||
|
||||
Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize)
|
||||
Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize, bool decorations)
|
||||
{
|
||||
GameSave * tempSave;
|
||||
try {
|
||||
@ -138,7 +138,7 @@ Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize)
|
||||
|
||||
return thumb;
|
||||
}
|
||||
Thumbnail * thumb = Render(tempSave);
|
||||
Thumbnail * thumb = Render(tempSave, decorations);
|
||||
delete tempSave;
|
||||
return thumb;
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ class SaveRenderer: public Singleton<SaveRenderer> {
|
||||
Renderer * ren;
|
||||
public:
|
||||
SaveRenderer();
|
||||
Thumbnail * Render(GameSave * save);
|
||||
Thumbnail * Render(unsigned char * saveData, int saveDataSize);
|
||||
Thumbnail * Render(GameSave * save, bool decorations = true);
|
||||
Thumbnail * Render(unsigned char * saveData, int saveDataSize, bool decorations = true);
|
||||
virtual ~SaveRenderer();
|
||||
|
||||
private:
|
||||
|
@ -238,6 +238,7 @@ Snapshot * Simulation::CreateSnapshot()
|
||||
|
||||
void Simulation::Restore(const Snapshot & snap)
|
||||
{
|
||||
parts_lastActiveIndex = NPART-1;
|
||||
std::copy(snap.AirPressure.begin(), snap.AirPressure.end(), &pv[0][0]);
|
||||
std::copy(snap.AirVelocityX.begin(), snap.AirVelocityX.end(), &vx[0][0]);
|
||||
std::copy(snap.AirVelocityY.begin(), snap.AirVelocityY.end(), &vy[0][0]);
|
||||
|
Loading…
Reference in New Issue
Block a user