Remove unused IsRenderTarget and MaxTextureSize C4Surface options

They were always false and 0.
objectmenu
Günther Brammer 2016-01-10 01:18:28 +01:00 committed by Armin Burgmeier
parent b459cb35f1
commit fd61ac7ebe
8 changed files with 18 additions and 25 deletions

View File

@ -55,7 +55,7 @@ bool C4FacetSurface::Create(int iWdt, int iHgt, int iWdt2, int iHgt2)
Clear();
// Create surface
Face.Default();
if (!Face.Create(iWdt,iHgt,false,0,0)) return false;
if (!Face.Create(iWdt,iHgt)) return false;
// Set facet
if (iWdt2==C4FCT_Full) iWdt2=Face.Wdt; if (iWdt2==C4FCT_Height) iWdt2=Face.Hgt; if (iWdt2==C4FCT_Width) iWdt2=Face.Wdt;
if (iHgt2==C4FCT_Full) iHgt2=Face.Hgt; if (iHgt2==C4FCT_Height) iHgt2=Face.Hgt; if (iHgt2==C4FCT_Width) iHgt2=Face.Wdt;

View File

@ -311,7 +311,7 @@ bool CStdFont::AddSurface()
psfcFontData = pNewSfcs;
C4Surface *sfcNew = psfcFontData[iNumFontSfcs] = new C4Surface();
++iNumFontSfcs;
if (iSfcSizes) if (!sfcNew->Create(iSfcSizes, iSfcSizes,false,0,0)) return false;
if (iSfcSizes) if (!sfcNew->Create(iSfcSizes, iSfcSizes)) return false;
// If old surface was locked, unlock it and lock the new one in its stead
if (sfcCurrent && sfcCurrent->IsLocked())
{

View File

@ -51,7 +51,7 @@ C4Surface::C4Surface(int iWdt, int iHgt, int iFlags) : fIsBackground(false)
{
Default();
// create
Create(iWdt, iHgt, false, 0, iFlags);
Create(iWdt, iHgt, iFlags);
}
C4Surface::C4Surface(C4AbstractApp * pApp, C4Window * pWindow):
@ -94,7 +94,6 @@ void C4Surface::Default()
pWindow=NULL;
ClrByOwnerClr=0;
iTexSize=iTexX=iTexY=0;
fIsRenderTarget=false;
fIsBackground=false;
#ifdef _DEBUG
dbg_idx = NULL;
@ -172,7 +171,7 @@ void C4Surface::Clip(int iX, int iY, int iX2, int iY2)
ClipX2=Clamp(iX2,0,Wdt-1); ClipY2=Clamp(iY2,0,Hgt-1);
}
bool C4Surface::Create(int iWdt, int iHgt, bool fIsRenderTarget, int MaxTextureSize, int iFlags)
bool C4Surface::Create(int iWdt, int iHgt, int iFlags)
{
Clear(); Default();
// check size
@ -187,9 +186,8 @@ bool C4Surface::Create(int iWdt, int iHgt, bool fIsRenderTarget, int MaxTextureS
Format=pGL->sfcFmt;
#endif
byBytesPP=pDraw->byByteCnt;
this->fIsRenderTarget = fIsRenderTarget;
// create textures
if (!CreateTextures(MaxTextureSize, iFlags)) { Clear(); return false; }
if (!CreateTextures(iFlags)) { Clear(); return false; }
// update clipping
NoClip();
// success
@ -203,7 +201,7 @@ bool C4Surface::Copy(C4Surface &fromSfc)
// Default to other surface's color depth
Default();
// Create surface (TODO: copy flags)
if (!Create(fromSfc.Wdt, fromSfc.Hgt, false, 0, 0)) return false;
if (!Create(fromSfc.Wdt, fromSfc.Hgt)) return false;
// Blit copy
if (!pDraw->BlitSurface(&fromSfc, this, 0, 0, false))
{ Clear(); return false; }
@ -211,20 +209,16 @@ bool C4Surface::Copy(C4Surface &fromSfc)
return true;
}
bool C4Surface::CreateTextures(int MaxTextureSize, int Flags)
bool C4Surface::CreateTextures(int Flags)
{
// free previous
FreeTextures();
iTexSize=std::min(std::max(Wdt, Hgt), pDraw->MaxTexSize);
if (MaxTextureSize)
iTexSize=std::min(iTexSize, MaxTextureSize);
// get the number of textures needed for this size
iTexX=(Wdt-1)/iTexSize +1;
iTexY=(Hgt-1)/iTexSize +1;
// get mem for texture array
textures.reserve(iTexX * iTexY);
// cvan't be render target if it's not a single surface
if (!IsSingleSurface()) fIsRenderTarget = false;
// create textures
for (int y = 0; y < iTexY; ++y)
{
@ -318,7 +312,7 @@ bool C4Surface::CreateColorByOwner(C4Surface *pBySurface)
if (!pBySurface) return false;
if (pBySurface->textures.empty()) return false;
// create in same size
if (!Create(pBySurface->Wdt, pBySurface->Hgt, false, 0, 0)) return false;
if (!Create(pBySurface->Wdt, pBySurface->Hgt)) return false;
// copy scale
Scale = pBySurface->Scale;
// set main surface
@ -402,7 +396,7 @@ bool C4Surface::ReadBMP(CStdStream &hGroup, int iFlags)
}
// Create and lock surface
if (!Create(BitmapInfo.Info.biWidth,BitmapInfo.Info.biHeight, false, 0, iFlags)) return false;
if (!Create(BitmapInfo.Info.biWidth,BitmapInfo.Info.biHeight, iFlags)) return false;
if (!Lock()) { Clear(); return false; }
// create line buffer

View File

@ -78,7 +78,6 @@ public:
int iTexSize; // size of textures
int iTexX, iTexY; // number of textures in x/y-direction
int ClipX,ClipY,ClipX2,ClipY2;
bool fIsRenderTarget; // set for surfaces to be used as offscreen render targets
bool fIsBackground; // background surfaces fill unused pixels with black, rather than transparency - must be set prior to loading
#ifdef _DEBUG
int *dbg_idx;
@ -127,7 +126,7 @@ public:
bool SetPixDw(int iX, int iY, DWORD dwCol); // set pix in surface only
bool SetPixAlpha(int iX, int iY, BYTE byAlpha); // adjust alpha value of pixel
bool BltPix(int iX, int iY, C4Surface *sfcSource, int iSrcX, int iSrcY, bool fTransparency); // blit pixel from source to this surface (assumes clipped coordinates!)
bool Create(int iWdt, int iHgt, bool fIsRenderTarget, int MaxTextureSize, int iFlags);
bool Create(int iWdt, int iHgt, int iFlags = 0);
bool Copy(C4Surface &fromSfc);
bool CreateColorByOwner(C4Surface *pBySurface); // create ColorByOwner-surface
bool SetAsClrByOwnerOf(C4Surface *pOfSurface); // assume that ColorByOwner-surface has been created, and just assign it; fails if the size doesn't match
@ -163,7 +162,7 @@ public:
private:
void MapBytes(BYTE *bpMap);
bool ReadBytes(BYTE **lpbpData, void *bpTarget, int iSize);
bool CreateTextures(int MaxTextureSize, int iFlags); // create ppTex-array
bool CreateTextures(int iFlags); // create ppTex-array
void FreeTextures(); // free ppTex-array if existant
bool GetTexAtImpl(C4TexRef **ppTexRef, int &rX, int &rY);

View File

@ -162,7 +162,7 @@ bool C4Surface::ReadPNG(CStdStream &hGroup, int iFlags)
// abort if loading wasn't successful
if (!fSuccess) return false;
// create surface(s) - do not create an 8bit-buffer!
if (!Create(png.iWdt, png.iHgt, false, 0, iFlags)) return false;
if (!Create(png.iWdt, png.iHgt, iFlags)) return false;
// lock for writing data
if (!Lock()) return false;
if (textures.empty())
@ -342,7 +342,7 @@ bool C4Surface::ReadJPEG(CStdStream &hGroup, int iFlags)
jpeg_start_decompress(&cinfo);
// create surface(s) - do not create an 8bit-buffer!
if (!Create(cinfo.output_width, cinfo.output_height, false, 0, iFlags)) return false;
if (!Create(cinfo.output_width, cinfo.output_height, iFlags)) return false;
// JSAMPLEs per row in output buffer
row_stride = cinfo.output_width * cinfo.output_components;
// Make a one-row-high sample array that will go away at jpeg_destroy_decompress
@ -377,7 +377,7 @@ bool C4Surface::ReadJPEG(CStdStream &hGroup, int iFlags)
bool C4Surface::ReadJPEG(CStdStream &, int) {
// Dummy surface
if (!Create(1, 1, false, 1, 0)) return false;
if (!Create(1, 1)) return false;
return true;
}

View File

@ -182,7 +182,7 @@ bool C4LandscapeRenderGL::InitLandscapeTexture()
for(int i = 0; i < C4LR_SurfaceCount; i++)
{
Surfaces[i] = new C4Surface();
if(!Surfaces[i]->Create(iSfcWdt, iSfcHgt, false, 0, 0))
if(!Surfaces[i]->Create(iSfcWdt, iSfcHgt))
return false;
}

View File

@ -38,7 +38,7 @@ bool C4LandscapeRenderClassic::ReInit(int32_t iWidth, int32_t iHeight)
delete Surface32; Surface32 = NULL;
Surface32 = new C4Surface();
// without shaders, the FoW is only as detailed as the landscape has tiles.
if (!Surface32->Create(iWidth, iHeight, false, 0, 0))
if (!Surface32->Create(iWidth, iHeight))
return false;
// Safe back info
this->iWidth = iWidth;

View File

@ -71,9 +71,9 @@ bool C4FoWRegion::BindFramebuf()
// Create the new surfaces
std::unique_ptr<C4Surface> pNewSurface(new C4Surface);
std::unique_ptr<C4Surface> pNewBackSurface(new C4Surface);
if (!pNewSurface->Create(iWdt, iHgt, false, 0, 0))
if (!pNewSurface->Create(iWdt, iHgt))
return false;
if (!pNewBackSurface->Create(iWdt, iHgt, false, 0, 0))
if (!pNewBackSurface->Create(iWdt, iHgt))
return false;
// Copy over old content. This avoids flicker in already