mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 11:12:29 +00:00
chore(style): normalize memory allocations
This commit is contained in:
parent
90403bfd29
commit
97a6a8dd91
27 changed files with 147 additions and 279 deletions
|
|
@ -82,25 +82,15 @@ CGxDevice* CGxDevice::NewD3d9Ex() {
|
|||
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
CGxDevice* CGxDevice::NewGLL() {
|
||||
void* m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0);
|
||||
|
||||
if (m) {
|
||||
return new (m) CGxDeviceGLL();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
auto m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0x0);
|
||||
return new (m) CGxDeviceGLL();
|
||||
}
|
||||
#endif
|
||||
|
||||
CGxDevice* CGxDevice::NewOpenGl() {
|
||||
// TODO
|
||||
// void* m = SMemAlloc(sizeof(CGxDeviceOpenGl), __FILE__, __LINE__, 0);
|
||||
|
||||
// if (m) {
|
||||
// return new (m) CGxDeviceOpenGl();
|
||||
// } else {
|
||||
// return nullptr;
|
||||
// }
|
||||
// auto m = SMemAlloc(sizeof(CGxDeviceOpenGl), __FILE__, __LINE__, 0x0);
|
||||
// return new (m) CGxDeviceOpenGl();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -124,8 +114,8 @@ CGxDevice::CGxDevice() {
|
|||
}
|
||||
|
||||
CGxBuf* CGxDevice::BufCreate(CGxPool* pool, uint32_t itemSize, uint32_t itemCount, uint32_t index) {
|
||||
void* m = SMemAlloc(sizeof(CGxBuf), __FILE__, __LINE__, 0);
|
||||
CGxBuf* buf = new (m) CGxBuf(pool, itemSize, itemCount, index);
|
||||
auto m = SMemAlloc(sizeof(CGxBuf), __FILE__, __LINE__, 0x0);
|
||||
auto buf = new (m) CGxBuf(pool, itemSize, itemCount, index);
|
||||
|
||||
pool->m_bufList.LinkToTail(buf);
|
||||
|
||||
|
|
@ -636,8 +626,8 @@ void CGxDevice::PrimVertexPtr(CGxBuf* buf, EGxVertexBufferFormat format) {
|
|||
}
|
||||
|
||||
CGxPool* CGxDevice::PoolCreate(EGxPoolTarget target, EGxPoolUsage usage, uint32_t size, EGxPoolHintBits hint, const char* name) {
|
||||
void* m = SMemAlloc(sizeof(CGxPool), __FILE__, __LINE__, 0);
|
||||
CGxPool* pool = new (m) CGxPool(target, usage, size, hint, name);
|
||||
auto m = SMemAlloc(sizeof(CGxPool), __FILE__, __LINE__, 0x0);
|
||||
auto pool = new (m) CGxPool(target, usage, size, hint, name);
|
||||
|
||||
this->m_poolList.LinkToTail(pool);
|
||||
|
||||
|
|
@ -889,24 +879,19 @@ void CGxDevice::ShaderCreate(CGxShader* shaders[], EGxShTarget target, const cha
|
|||
}
|
||||
|
||||
int32_t CGxDevice::TexCreate(EGxTexTarget target, uint32_t width, uint32_t height, uint32_t depth, EGxTexFormat format, EGxTexFormat dataFormat, CGxTexFlags flags, void* userArg, void (*userFunc)(EGxTexCommand, uint32_t, uint32_t, uint32_t, uint32_t, void*, uint32_t&, const void*&), const char* name, CGxTex*& texId) {
|
||||
void* m = SMemAlloc(sizeof(CGxTex), __FILE__, __LINE__, 0);
|
||||
|
||||
CGxTex* tex = nullptr;
|
||||
|
||||
if (m) {
|
||||
tex = new (m) CGxTex(
|
||||
target,
|
||||
width,
|
||||
height,
|
||||
depth,
|
||||
format,
|
||||
dataFormat,
|
||||
flags,
|
||||
userArg,
|
||||
userFunc,
|
||||
name
|
||||
);
|
||||
}
|
||||
auto m = SMemAlloc(sizeof(CGxTex), __FILE__, __LINE__, 0);
|
||||
auto tex = new (m) CGxTex(
|
||||
target,
|
||||
width,
|
||||
height,
|
||||
depth,
|
||||
format,
|
||||
dataFormat,
|
||||
flags,
|
||||
userArg,
|
||||
userFunc,
|
||||
name
|
||||
);
|
||||
|
||||
texId = tex;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <storm/Error.hpp>
|
||||
|
||||
HCAMERA CameraCreate() {
|
||||
void* m = SMemAlloc(sizeof(CCamera), __FILE__, __LINE__, 0x0);
|
||||
auto m = SMemAlloc(sizeof(CCamera), __FILE__, __LINE__, 0x0);
|
||||
auto camera = new (m) CCamera();
|
||||
return HandleCreate(camera);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ CGxStringBatch* GxuFontCreateBatch(bool a1, bool a2) {
|
|||
batch = s_unusedBatches.Head();
|
||||
s_unusedBatches.UnlinkNode(batch);
|
||||
} else {
|
||||
void* m = SMemAlloc(sizeof(CGxStringBatch), __FILE__, __LINE__, 0x8);
|
||||
auto m = SMemAlloc(sizeof(CGxStringBatch), __FILE__, __LINE__, 0x8);
|
||||
batch = new (m) CGxStringBatch();
|
||||
}
|
||||
|
||||
|
|
@ -764,7 +764,7 @@ HTEXTBLOCK TextBlockCreate(HTEXTFONT font, const char* text, const CImVector& co
|
|||
STORM_ASSERT(font);
|
||||
STORM_ASSERT(text);
|
||||
|
||||
void* m = SMemAlloc(sizeof(TEXTBLOCK), __FILE__, __LINE__, 0x0);
|
||||
auto m = SMemAlloc(sizeof(TEXTBLOCK), __FILE__, __LINE__, 0x0);
|
||||
auto textBlock = new (m) TEXTBLOCK();
|
||||
|
||||
C3Vector position = { 0.0f, 0.0f, pos.z };
|
||||
|
|
|
|||
|
|
@ -185,9 +185,8 @@ void ScrnLayerCreate(const RECTF* rect, float zorder, unsigned long flags, void*
|
|||
|
||||
const RECTF* r = rect ? rect : &defaultrect;
|
||||
|
||||
void* m = SMemAlloc(sizeof(CILayer), __FILE__, __LINE__, 0);
|
||||
|
||||
CILayer* l = new (m) CILayer();
|
||||
auto m = SMemAlloc(sizeof(CILayer), __FILE__, __LINE__, 0x0);
|
||||
auto l = new (m) CILayer();
|
||||
|
||||
l->rect.left = r->left;
|
||||
l->rect.bottom = r->bottom;
|
||||
|
|
|
|||
|
|
@ -744,13 +744,8 @@ CTexture* CreateBlpSync(int32_t createFlags, char* fileName, char* fileExt, CGxT
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void* v8 = SMemAlloc(sizeof(CTexture), "HTEXTURE", -2, 0);
|
||||
|
||||
CTexture* texture;
|
||||
|
||||
if (v8) {
|
||||
texture = new (v8) CTexture();
|
||||
}
|
||||
auto m = SMemAlloc(sizeof(CTexture), "HTEXTURE", -2, 0x0);
|
||||
auto texture = new (m) CTexture();
|
||||
|
||||
texture->gxTexFlags = texFlags;
|
||||
|
||||
|
|
@ -945,8 +940,8 @@ HTEXTURE TextureCreate(uint32_t width, uint32_t height, EGxTexFormat format, EGx
|
|||
}
|
||||
|
||||
HTEXTURE TextureCreate(EGxTexTarget target, uint32_t width, uint32_t height, uint32_t depth, EGxTexFormat format, EGxTexFormat dataFormat, CGxTexFlags texFlags, void* userArg, TEXTURE_CALLBACK* userFunc, const char* a10, int32_t a11) {
|
||||
void* m = SMemAlloc(sizeof(CTexture), __FILE__, __LINE__, 0x0);
|
||||
CTexture* texture = new (m) CTexture();
|
||||
auto m = SMemAlloc(sizeof(CTexture), __FILE__, __LINE__, 0x0);
|
||||
auto texture = new (m) CTexture();
|
||||
|
||||
if (a11) {
|
||||
texFlags.m_filter = CTexture::s_filterMode;
|
||||
|
|
@ -976,8 +971,8 @@ HTEXTURE TextureCreateSolid(const CImVector& color) {
|
|||
return textureHandle;
|
||||
}
|
||||
|
||||
void* m = SMemAlloc(sizeof(CTexture), __FILE__, __LINE__, 0x0);
|
||||
CTexture* texture = new (m) CTexture();
|
||||
auto m = SMemAlloc(sizeof(CTexture), __FILE__, __LINE__, 0x0);
|
||||
auto texture = new (m) CTexture();
|
||||
|
||||
FillInSolidTexture(color, texture);
|
||||
textureHandle = HandleCreate(texture);
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ CHARCODEDESC* TEXTURECACHEROW::CreateNewDesc(GLYPHBITMAPDATA* data, uint32_t row
|
|||
this->widestFreeSlot = gapToPrevious;
|
||||
|
||||
if (gapToPrevious >= glyphWidth) {
|
||||
void* m = SMemAlloc(sizeof(CHARCODEDESC), __FILE__, __LINE__, 0);
|
||||
CHARCODEDESC* newCode = new (m) CHARCODEDESC();
|
||||
auto m = SMemAlloc(sizeof(CHARCODEDESC), __FILE__, __LINE__, 0x0);
|
||||
auto newCode = new (m) CHARCODEDESC();
|
||||
|
||||
this->glyphList.LinkNode(newCode, 2, this->glyphList.Head());
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ CHARCODEDESC* TEXTURECACHEROW::CreateNewDesc(GLYPHBITMAPDATA* data, uint32_t row
|
|||
}
|
||||
|
||||
if (gapToNext >= glyphWidth) {
|
||||
void* m = SMemAlloc(sizeof(CHARCODEDESC), __FILE__, __LINE__, 0);
|
||||
auto m = SMemAlloc(sizeof(CHARCODEDESC), __FILE__, __LINE__, 0x0);
|
||||
newCode = new (m) CHARCODEDESC();
|
||||
|
||||
this->glyphList.LinkNode(newCode, 1, code);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ TEXTLINETEXTURE* TEXTLINETEXTURE::NewTextLineTexture() {
|
|||
// TODO
|
||||
// Allocate off of TEXTLINETEXTURE::s_freeTextLineTextures
|
||||
|
||||
void* m = SMemAlloc(sizeof(TEXTLINETEXTURE), __FILE__, __LINE__, 0x0);
|
||||
auto m = SMemAlloc(sizeof(TEXTLINETEXTURE), __FILE__, __LINE__, 0x0);
|
||||
return new (m) TEXTLINETEXTURE();
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ CGxString* CGxString::GetNewString(int32_t linkOnList) {
|
|||
return string;
|
||||
}
|
||||
|
||||
void* m = SMemAlloc(sizeof(CGxString), __FILE__, __LINE__, 0x8);
|
||||
auto m = SMemAlloc(sizeof(CGxString), __FILE__, __LINE__, 0x8);
|
||||
string = new (m) CGxString();
|
||||
|
||||
if (linkOnList) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue