forked from 0ad/0ad
Adds std namespace to shared_ptr usages in graphics.
This was SVN commit r25525.
This commit is contained in:
parent
0728c58a4d
commit
b03b560e71
@ -29,13 +29,13 @@
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
shared_ptr<CFont> CFontManager::LoadFont(CStrIntern fontName)
|
||||
std::shared_ptr<CFont> CFontManager::LoadFont(CStrIntern fontName)
|
||||
{
|
||||
FontsMap::iterator it = m_Fonts.find(fontName);
|
||||
if (it != m_Fonts.end())
|
||||
return it->second;
|
||||
|
||||
shared_ptr<CFont> font(new CFont());
|
||||
std::shared_ptr<CFont> font(new CFont());
|
||||
|
||||
if (!ReadFont(font.get(), fontName))
|
||||
{
|
||||
@ -55,7 +55,7 @@ bool CFontManager::ReadFont(CFont* font, CStrIntern fontName)
|
||||
const VfsPath path(L"fonts/");
|
||||
|
||||
// Read font definition file into a stringstream
|
||||
shared_ptr<u8> buf;
|
||||
std::shared_ptr<u8> buf;
|
||||
size_t size;
|
||||
const VfsPath fntName(fontName.string() + ".fnt");
|
||||
if (g_VFS->LoadFile(path / fntName, buf, size) < 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -30,12 +30,12 @@ class CFont;
|
||||
class CFontManager
|
||||
{
|
||||
public:
|
||||
shared_ptr<CFont> LoadFont(CStrIntern fontName);
|
||||
std::shared_ptr<CFont> LoadFont(CStrIntern fontName);
|
||||
|
||||
private:
|
||||
bool ReadFont(CFont* font, CStrIntern fontName);
|
||||
|
||||
using FontsMap = std::unordered_map<CStrIntern, shared_ptr<CFont> >;
|
||||
using FontsMap = std::unordered_map<CStrIntern, std::shared_ptr<CFont>>;
|
||||
FontsMap m_Fonts;
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -37,7 +37,7 @@ public:
|
||||
void CalculateStringSize(const wchar_t* string, int& w, int& h) const;
|
||||
|
||||
private:
|
||||
shared_ptr<CFont> m_Font;
|
||||
std::shared_ptr<CFont> m_Font;
|
||||
};
|
||||
|
||||
#endif // INCLUDED_FONTMETRICS
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -228,7 +228,7 @@ void CHeightMipmap::DumpToDisk(const VfsPath& filename) const
|
||||
|
||||
const size_t img_size = w * h * bpp/8;
|
||||
const size_t hdr_size = tex_hdr_size(filename);
|
||||
shared_ptr<u8> buf;
|
||||
std::shared_ptr<u8> buf;
|
||||
AllocateAligned(buf, hdr_size+img_size, maxSectorSize);
|
||||
void* img = buf.get() + hdr_size;
|
||||
Tex t;
|
||||
|
@ -92,7 +92,7 @@ void CMapGeneratorWorker::RunThread(CMapGeneratorWorker* self)
|
||||
debug_SetThreadName("MapGenerator");
|
||||
g_Profiler2.RegisterCurrentThread("MapGenerator");
|
||||
|
||||
shared_ptr<ScriptContext> mapgenContext = ScriptContext::CreateContext(RMS_CONTEXT_SIZE);
|
||||
std::shared_ptr<ScriptContext> mapgenContext = ScriptContext::CreateContext(RMS_CONTEXT_SIZE);
|
||||
|
||||
// Enable the script to be aborted
|
||||
JS_AddInterruptCallback(mapgenContext->GetGeneralJSContext(), MapGeneratorInterruptCallback);
|
||||
|
@ -32,11 +32,11 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
Status ParseHeightmapImage(const shared_ptr<u8>& fileData, size_t fileSize, std::vector<u16>& heightmap);
|
||||
Status ParseHeightmapImage(const std::shared_ptr<u8>& fileData, size_t fileSize, std::vector<u16>& heightmap);
|
||||
|
||||
Status LoadHeightmapImageVfs(const VfsPath& filepath, std::vector<u16>& heightmap)
|
||||
{
|
||||
shared_ptr<u8> fileData;
|
||||
std::shared_ptr<u8> fileData;
|
||||
size_t fileSize;
|
||||
|
||||
RETURN_STATUS_IF_ERR(g_VFS->LoadFile(filepath, fileData, fileSize));
|
||||
@ -52,7 +52,7 @@ Status LoadHeightmapImageOs(const OsPath& filepath, std::vector<u16>& heightmap)
|
||||
size_t fileSize = lseek(file.Descriptor(), 0, SEEK_END);
|
||||
lseek(file.Descriptor(), 0, SEEK_SET);
|
||||
|
||||
shared_ptr<u8> fileData;
|
||||
std::shared_ptr<u8> fileData;
|
||||
RETURN_STATUS_IF_ERR(AllocateAligned(fileData, fileSize, maxSectorSize));
|
||||
|
||||
Status readvalue = read(file.Descriptor(), fileData.get(), fileSize);
|
||||
@ -63,7 +63,7 @@ Status LoadHeightmapImageOs(const OsPath& filepath, std::vector<u16>& heightmap)
|
||||
return ParseHeightmapImage(fileData, fileSize, heightmap);
|
||||
}
|
||||
|
||||
Status ParseHeightmapImage(const shared_ptr<u8>& fileData, size_t fileSize, std::vector<u16>& heightmap)
|
||||
Status ParseHeightmapImage(const std::shared_ptr<u8>& fileData, size_t fileSize, std::vector<u16>& heightmap)
|
||||
{
|
||||
// Decode to a raw pixel format
|
||||
Tex tex;
|
||||
|
@ -116,7 +116,7 @@ struct SOverlayTexturedLine
|
||||
* recompute it, while at the same time maintaining copyability of this object (see also docs on
|
||||
* CTexturedLineRData).
|
||||
*/
|
||||
shared_ptr<CTexturedLineRData> m_RenderData;
|
||||
std::shared_ptr<CTexturedLineRData> m_RenderData;
|
||||
|
||||
/**
|
||||
* Converts a string line cap type into its corresponding LineCap enum value, and returns
|
||||
|
@ -41,7 +41,7 @@ struct SParticle
|
||||
float maxAge;
|
||||
};
|
||||
|
||||
typedef shared_ptr<CParticleEmitter> CParticleEmitterPtr;
|
||||
typedef std::shared_ptr<CParticleEmitter> CParticleEmitterPtr;
|
||||
|
||||
/**
|
||||
* Particle emitter.
|
||||
@ -129,10 +129,10 @@ public:
|
||||
|
||||
/**
|
||||
* Stop this emitter emitting new particles, and pass responsibility for rendering
|
||||
* to the CParticleManager. This should be called before dropping the last shared_ptr
|
||||
* to the CParticleManager. This should be called before dropping the last std::shared_ptr
|
||||
* to this object so that it will carry on rendering (until all particles have dissipated)
|
||||
* even when it's no longer attached to a model.
|
||||
* @param self the shared_ptr you're about to drop
|
||||
* @param self the std::shared_ptr you're about to drop
|
||||
*/
|
||||
void Unattach(const CParticleEmitterPtr& self);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -103,15 +103,15 @@ private:
|
||||
u16 m_MaxParticles;
|
||||
CBoundingBoxAligned m_MaxBounds;
|
||||
|
||||
typedef shared_ptr<IParticleVar> IParticleVarPtr;
|
||||
typedef std::shared_ptr<IParticleVar> IParticleVarPtr;
|
||||
std::vector<IParticleVarPtr> m_Variables;
|
||||
|
||||
typedef shared_ptr<IParticleEffector> IParticleEffectorPtr;
|
||||
typedef std::shared_ptr<IParticleEffector> IParticleEffectorPtr;
|
||||
std::vector<IParticleEffectorPtr> m_Effectors;
|
||||
|
||||
CParticleManager& m_Manager;
|
||||
};
|
||||
|
||||
typedef shared_ptr<CParticleEmitterType> CParticleEmitterTypePtr;
|
||||
typedef std::shared_ptr<CParticleEmitterType> CParticleEmitterTypePtr;
|
||||
|
||||
#endif // INCLUDED_PARTICLEEMITTERTYPE
|
||||
|
@ -91,7 +91,7 @@ typename CShaderParams<value_t>::SItems* CShaderParams<value_t>::GetInterned(con
|
||||
typedef ItemNameCmp<value_t> Cmp;
|
||||
ENSURE(std::adjacent_find(items.items.begin(), items.items.end(), std::binary_negate<Cmp>(Cmp())) == items.items.end());
|
||||
|
||||
shared_ptr<SItems> ptr = std::make_shared<SItems>(items);
|
||||
std::shared_ptr<SItems> ptr = std::make_shared<SItems>(items);
|
||||
s_InternedItems.insert(std::make_pair(items, ptr));
|
||||
return ptr.get();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -119,7 +119,7 @@ protected:
|
||||
SItems* m_Items; // interned value
|
||||
|
||||
private:
|
||||
using InternedItems_t = std::unordered_map<SItems, shared_ptr<SItems>, SItemsHash >;
|
||||
using InternedItems_t = std::unordered_map<SItems, std::shared_ptr<SItems>, SItemsHash>;
|
||||
static InternedItems_t s_InternedItems;
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -37,7 +37,7 @@ class XMBElement;
|
||||
class CXeromyces;
|
||||
class CTerrainProperties;
|
||||
|
||||
typedef shared_ptr<CTerrainProperties> CTerrainPropertiesPtr;
|
||||
typedef std::shared_ptr<CTerrainProperties> CTerrainPropertiesPtr;
|
||||
|
||||
class CTerrainProperties
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ void CTerrainTextureEntry::LoadAlphaMaps(VfsPath &amtype)
|
||||
size_t tile_w = 2+base+2; // 2 pixel border (avoids bilinear filtering artifacts)
|
||||
size_t total_w = round_up_to_pow2(tile_w * NUM_ALPHA_MAPS);
|
||||
size_t total_h = base; ENSURE(is_pow2(total_h));
|
||||
shared_ptr<u8> data;
|
||||
std::shared_ptr<u8> data;
|
||||
AllocateAligned(data, total_w*total_h, maxSectorSize);
|
||||
// for each tile on row
|
||||
for (size_t i = 0; i < NUM_ALPHA_MAPS; i++)
|
||||
@ -346,7 +346,7 @@ void CTerrainTextureEntry::LoadAlphaMaps(VfsPath &amtype)
|
||||
// write to disk
|
||||
//Status ret = INFO::OK;
|
||||
{
|
||||
shared_ptr<u8> file = DummySharedPtr(da.base);
|
||||
std::shared_ptr<u8> file = DummySharedPtr(da.base);
|
||||
const ssize_t bytes_written = g_VFS->CreateFile(filename, file, da.pos);
|
||||
if(bytes_written > 0)
|
||||
ENSURE(bytes_written == (ssize_t)da.pos);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -38,7 +38,7 @@ class CXeromyces;
|
||||
class CTerrainTextureEntry;
|
||||
class CTerrainProperties;
|
||||
|
||||
typedef shared_ptr<CTerrainProperties> CTerrainPropertiesPtr;
|
||||
typedef std::shared_ptr<CTerrainProperties> CTerrainPropertiesPtr;
|
||||
|
||||
class CTerrainGroup
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ private:
|
||||
size_t chars; // sum of runs[i].text->size()
|
||||
CMatrix3D transform;
|
||||
CColor color;
|
||||
shared_ptr<CFont> font;
|
||||
std::shared_ptr<CFont> font;
|
||||
std::list<SBatchRun> runs;
|
||||
};
|
||||
|
||||
@ -171,7 +171,7 @@ private:
|
||||
|
||||
CColor m_Color;
|
||||
CStrIntern m_FontName;
|
||||
shared_ptr<CFont> m_Font;
|
||||
std::shared_ptr<CFont> m_Font;
|
||||
|
||||
bool m_Dirty;
|
||||
|
||||
|
@ -330,7 +330,7 @@ CTextureConverter::~CTextureConverter()
|
||||
|
||||
bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath& src, const VfsPath& dest, const Settings& settings)
|
||||
{
|
||||
shared_ptr<u8> file;
|
||||
std::shared_ptr<u8> file;
|
||||
size_t fileSize;
|
||||
if (m_VFS->LoadFile(src, file, fileSize) < 0)
|
||||
{
|
||||
@ -385,7 +385,7 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath
|
||||
|
||||
#if CONFIG2_NVTT
|
||||
|
||||
shared_ptr<ConversionRequest> request = std::make_shared<ConversionRequest>();
|
||||
std::shared_ptr<ConversionRequest> request = std::make_shared<ConversionRequest>();
|
||||
request->dest = dest;
|
||||
request->texture = texture;
|
||||
|
||||
@ -485,7 +485,7 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath
|
||||
bool CTextureConverter::Poll(CTexturePtr& texture, VfsPath& dest, bool& ok)
|
||||
{
|
||||
#if CONFIG2_NVTT
|
||||
shared_ptr<ConversionResult> result;
|
||||
std::shared_ptr<ConversionResult> result;
|
||||
|
||||
// Grab the first result (if any)
|
||||
{
|
||||
@ -512,7 +512,7 @@ bool CTextureConverter::Poll(CTexturePtr& texture, VfsPath& dest, bool& ok)
|
||||
|
||||
// Move output into a correctly-aligned buffer
|
||||
size_t size = result->output.buffer.size();
|
||||
shared_ptr<u8> file;
|
||||
std::shared_ptr<u8> file;
|
||||
AllocateAligned(file, size, maxSectorSize);
|
||||
memcpy(file.get(), &result->output.buffer[0], size);
|
||||
if (m_VFS->CreateFile(result->dest, file, size) < 0)
|
||||
@ -559,7 +559,7 @@ void CTextureConverter::RunThread(CTextureConverter* textureConverter)
|
||||
g_Profiler2.RecordSyncMarker();
|
||||
PROFILE2_EVENT("wakeup");
|
||||
|
||||
shared_ptr<ConversionRequest> request;
|
||||
std::shared_ptr<ConversionRequest> request;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> wait_lock(textureConverter->m_WorkerMutex);
|
||||
@ -572,7 +572,7 @@ void CTextureConverter::RunThread(CTextureConverter* textureConverter)
|
||||
}
|
||||
|
||||
// Set up the result object
|
||||
shared_ptr<ConversionResult> result = std::make_shared<ConversionResult>();
|
||||
std::shared_ptr<ConversionResult> result = std::make_shared<ConversionResult>();
|
||||
result->dest = request->dest;
|
||||
result->texture = request->texture;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -214,8 +214,8 @@ private:
|
||||
struct ConversionRequest;
|
||||
struct ConversionResult;
|
||||
|
||||
std::deque<shared_ptr<ConversionRequest> > m_RequestQueue; // protected by m_WorkerMutex
|
||||
std::deque<shared_ptr<ConversionResult> > m_ResultQueue; // protected by m_WorkerMutex
|
||||
std::deque<std::shared_ptr<ConversionRequest>> m_RequestQueue; // protected by m_WorkerMutex
|
||||
std::deque<std::shared_ptr<ConversionResult>> m_ResultQueue; // protected by m_WorkerMutex
|
||||
bool m_Shutdown; // protected by m_WorkerMutex
|
||||
};
|
||||
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
if (!m_DisableGL)
|
||||
{
|
||||
// Construct 1x1 24-bit texture
|
||||
shared_ptr<u8> data(new u8[3], ArrayDeleter());
|
||||
std::shared_ptr<u8> data(new u8[3], ArrayDeleter());
|
||||
data.get()[0] = 64;
|
||||
data.get()[1] = 64;
|
||||
data.get()[2] = 64;
|
||||
@ -107,7 +107,7 @@ public:
|
||||
if (!m_DisableGL)
|
||||
{
|
||||
// Construct 1x1 24-bit texture
|
||||
shared_ptr<u8> data(new u8[3], ArrayDeleter());
|
||||
std::shared_ptr<u8> data(new u8[3], ArrayDeleter());
|
||||
data.get()[0] = 255;
|
||||
data.get()[1] = 0;
|
||||
data.get()[2] = 255;
|
||||
@ -449,13 +449,13 @@ public:
|
||||
|
||||
if (m_VFS->GetFileInfo(path, NULL) >= 0)
|
||||
{
|
||||
shared_ptr<CTextureConverter::SettingsFile> settings(m_TextureConverter.LoadSettings(path));
|
||||
std::shared_ptr<CTextureConverter::SettingsFile> settings(m_TextureConverter.LoadSettings(path));
|
||||
m_SettingsFiles.insert(std::make_pair(path, settings));
|
||||
return settings.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsFiles.insert(std::make_pair(path, shared_ptr<CTextureConverter::SettingsFile>()));
|
||||
m_SettingsFiles.insert(std::make_pair(path, std::shared_ptr<CTextureConverter::SettingsFile>()));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -520,7 +520,7 @@ private:
|
||||
|
||||
// Cache for the conversion settings files
|
||||
using SettingsFilesMap =
|
||||
std::unordered_map<VfsPath, shared_ptr<CTextureConverter::SettingsFile> >;
|
||||
std::unordered_map<VfsPath, std::shared_ptr<CTextureConverter::SettingsFile>>;
|
||||
SettingsFilesMap m_SettingsFiles;
|
||||
};
|
||||
|
||||
|
@ -75,7 +75,7 @@ class TestMeshManager : public CxxTest::TestSuite
|
||||
void copyFile(const VfsPath& src, const VfsPath& dst)
|
||||
{
|
||||
// Copy a file into the mod directory, so we can work on it:
|
||||
shared_ptr<u8> data; size_t size = 0;
|
||||
std::shared_ptr<u8> data; size_t size = 0;
|
||||
TS_ASSERT_OK(g_VFS->LoadFile(src, data, size));
|
||||
TS_ASSERT_OK(g_VFS->CreateFile(dst, data, size));
|
||||
}
|
||||
@ -113,7 +113,7 @@ public:
|
||||
{
|
||||
copyFile(srcDAE, testDAE);
|
||||
//buildArchive();
|
||||
shared_ptr<u8> buf;
|
||||
std::shared_ptr<u8> buf;
|
||||
AllocateAligned(buf, 100, maxSectorSize);
|
||||
strcpy_s((char*)buf.get(), 5, "Test");
|
||||
g_VFS->CreateFile(testDAE, buf, 4);
|
||||
@ -179,7 +179,7 @@ public:
|
||||
TestLogger logger;
|
||||
|
||||
copyFile(srcDAE, testDAE);
|
||||
shared_ptr<u8> buf;
|
||||
std::shared_ptr<u8> buf;
|
||||
AllocateAligned(buf, 100, maxSectorSize);
|
||||
strcpy_s((char*)buf.get(), 100, "Not valid XML");
|
||||
g_VFS->CreateFile(testSkeletonDefs, buf, 13);
|
||||
@ -194,7 +194,7 @@ public:
|
||||
TestLogger logger;
|
||||
|
||||
copyFile(srcSkeletonDefs, testSkeletonDefs);
|
||||
shared_ptr<u8> buf;
|
||||
std::shared_ptr<u8> buf;
|
||||
AllocateAligned(buf, 100, maxSectorSize);
|
||||
strcpy_s((char*)buf.get(), 100, "Not valid XML");
|
||||
g_VFS->CreateFile(testDAE, buf, 13);
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
SDL_Delay(10);
|
||||
}
|
||||
|
||||
shared_ptr<u8> file;
|
||||
std::shared_ptr<u8> file;
|
||||
size_t fileSize = 0;
|
||||
TS_ASSERT_OK(m_VFS->LoadFile(dest, file, fileSize));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user