Skip to content

Commit

Permalink
Refactor and move TGA saver to xrCore.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Oct 2, 2015
1 parent 79cdea1 commit 7cbbd13
Show file tree
Hide file tree
Showing 33 changed files with 205 additions and 1,067 deletions.
24 changes: 10 additions & 14 deletions src/Layers/xrRender/r__screenshot.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#include "stdafx.h"
#include "xr_effgamma.h"
#include "dxRenderDeviceRender.h"
#include "Layers/xrRender/tga.h"
#include "xrCore/Media/Image.hpp"
#include "xrEngine/xrImage_Resampler.h"
#if defined(USE_DX10) || defined(USE_DX11)
#include "d3dx10tex.h"
#endif // USE_DX10

using namespace XRay::Media;

#define GAMESAVE_SIZE 128

IC u32 convert (float c) {
Expand Down Expand Up @@ -395,9 +397,6 @@ void CRender::ScreenshotImpl (ScreenshotMode mode, LPCSTR name, CMemoryWriter* m
VERIFY (name);
strconcat (sizeof(buf), buf, name, ".tga");
IWriter* fs = FS.w_open ("$screenshots$",buf); R_ASSERT(fs);
TGAdesc p;
p.format = IMG_24B;

// TODO: DX10: This is totally incorrect but mimics
// original behavior. Fix later.
hr = pFB->LockRect(&D,0,D3DLOCK_NOSYSLOCK);
Expand All @@ -406,16 +405,13 @@ void CRender::ScreenshotImpl (ScreenshotMode mode, LPCSTR name, CMemoryWriter* m
if(hr!=D3D_OK) goto _end_;

// save
u32* data = (u32*)xr_malloc(Device.dwHeight*Device.dwHeight*4);
imf_Process (data,Device.dwHeight,Device.dwHeight,(u32*)D.pBits,Device.dwWidth,Device.dwHeight,imf_lanczos3);
p.scanlenght = Device.dwHeight*4;
p.width = Device.dwHeight;
p.height = Device.dwHeight;
p.data = data;
p.maketga (*fs);
xr_free (data);

FS.w_close (fs);
u32* data = (u32*)xr_malloc(Device.dwHeight*Device.dwHeight*4);
imf_Process(data,Device.dwHeight,Device.dwHeight,(u32*)D.pBits,Device.dwWidth,Device.dwHeight,imf_lanczos3);
Image img;
img.Create(u16(Device.dwHeight), u16(Device.dwHeight), data, ImageFormat::RGBA8);
img.SaveTGA(*fs, true);
xr_free(data);
FS.w_close(fs);
}
break;
}
Expand Down
118 changes: 0 additions & 118 deletions src/Layers/xrRender/tga.cpp

This file was deleted.

46 changes: 0 additions & 46 deletions src/Layers/xrRender/tga.h

This file was deleted.

1 change: 0 additions & 1 deletion src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@
<ClCompile Include="..\xrRender\stats_manager.cpp" />
<ClCompile Include="..\xrRender\Texture.cpp" />
<ClCompile Include="..\xrRender\TextureDescrManager.cpp" />
<ClCompile Include="..\xrRender\tga.cpp" />
<ClCompile Include="..\xrRender\tss_def.cpp" />
<ClCompile Include="..\xrRender\VertexCache.cpp" />
<ClCompile Include="..\xrRender\WallmarksEngine.cpp" />
Expand Down
3 changes: 0 additions & 3 deletions src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,6 @@
<ClCompile Include="..\xrRender\Texture.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\tga.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\ColorMapManager.cpp">
<Filter>Core\ColorMap</Filter>
</ClCompile>
Expand Down
1 change: 0 additions & 1 deletion src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@
<ClCompile Include="..\xrRender\stats_manager.cpp" />
<ClCompile Include="..\xrRender\Texture.cpp" />
<ClCompile Include="..\xrRender\TextureDescrManager.cpp" />
<ClCompile Include="..\xrRender\tga.cpp" />
<ClCompile Include="..\xrRender\tss_def.cpp" />
<ClCompile Include="..\xrRender\uber_deffer.cpp" />
<ClCompile Include="..\xrRender\VertexCache.cpp" />
Expand Down
3 changes: 0 additions & 3 deletions src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,6 @@
<ClCompile Include="..\xrRender\Texture.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\tga.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\DetailManager.cpp">
<Filter>Details</Filter>
</ClCompile>
Expand Down
1 change: 0 additions & 1 deletion src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@
<ClCompile Include="..\xrRender\SkeletonX.cpp" />
<ClCompile Include="..\xrRender\stats_manager.cpp" />
<ClCompile Include="..\xrRender\TextureDescrManager.cpp" />
<ClCompile Include="..\xrRender\tga.cpp" />
<ClCompile Include="..\xrRender\tss_def.cpp" />
<ClCompile Include="..\xrRender\uber_deffer.cpp" />
<ClCompile Include="..\xrRender\Utils\dxHashHelper.cpp" />
Expand Down
3 changes: 0 additions & 3 deletions src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,6 @@
<ClCompile Include="..\xrRender\r__screenshot.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\tga.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\DetailManager.cpp">
<Filter>Details</Filter>
</ClCompile>
Expand Down
1 change: 0 additions & 1 deletion src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@
<ClCompile Include="..\xrRender\SkeletonX.cpp" />
<ClCompile Include="..\xrRender\stats_manager.cpp" />
<ClCompile Include="..\xrRender\TextureDescrManager.cpp" />
<ClCompile Include="..\xrRender\tga.cpp" />
<ClCompile Include="..\xrRender\tss_def.cpp" />
<ClCompile Include="..\xrRender\uber_deffer.cpp" />
<ClCompile Include="..\xrRender\Utils\dxHashHelper.cpp" />
Expand Down
3 changes: 0 additions & 3 deletions src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,6 @@
<ClCompile Include="..\xrRender\r__screenshot.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\tga.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\DetailManager.cpp">
<Filter>Details</Filter>
</ClCompile>
Expand Down
Loading

0 comments on commit 7cbbd13

Please sign in to comment.