mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
Remove CCommandProcessorFragment_GLBase::Resize
delegate
Use `ResizeImage` function directly instead.
This commit is contained in:
parent
2cd877f0ce
commit
dd62cda8ba
|
@ -1,11 +1,5 @@
|
||||||
#include "backend_base.h"
|
#include "backend_base.h"
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <engine/gfx/image_manipulation.h>
|
|
||||||
|
|
||||||
uint8_t *CCommandProcessorFragment_GLBase::Resize(const uint8_t *pData, int Width, int Height, int NewWidth, int NewHeight, int BPP)
|
|
||||||
{
|
|
||||||
return ResizeImage(pData, Width, Height, NewWidth, NewHeight, BPP);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CCommandProcessorFragment_GLBase::Texture2DTo3D(uint8_t *pImageBuffer, int ImageWidth, int ImageHeight, size_t PixelSize, int SplitCountWidth, int SplitCountHeight, uint8_t *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight)
|
bool CCommandProcessorFragment_GLBase::Texture2DTo3D(uint8_t *pImageBuffer, int ImageWidth, int ImageHeight, size_t PixelSize, int SplitCountWidth, int SplitCountHeight, uint8_t *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,8 +84,6 @@ protected:
|
||||||
SGfxErrorContainer m_Error;
|
SGfxErrorContainer m_Error;
|
||||||
SGfxWarningContainer m_Warning;
|
SGfxWarningContainer m_Warning;
|
||||||
|
|
||||||
static uint8_t *Resize(const uint8_t *pData, int Width, int Height, int NewWidth, int NewHeight, int BPP);
|
|
||||||
|
|
||||||
static bool Texture2DTo3D(uint8_t *pImageBuffer, int ImageWidth, int ImageHeight, size_t PixelSize, int SplitCountWidth, int SplitCountHeight, uint8_t *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight);
|
static bool Texture2DTo3D(uint8_t *pImageBuffer, int ImageWidth, int ImageHeight, size_t PixelSize, int SplitCountWidth, int SplitCountHeight, uint8_t *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight);
|
||||||
|
|
||||||
virtual bool GetPresentedImageData(uint32_t &Width, uint32_t &Height, CImageInfo::EImageFormat &Format, std::vector<uint8_t> &vDstData) = 0;
|
virtual bool GetPresentedImageData(uint32_t &Width, uint32_t &Height, CImageInfo::EImageFormat &Format, std::vector<uint8_t> &vDstData) = 0;
|
||||||
|
|
|
@ -632,7 +632,7 @@ void CCommandProcessorFragment_OpenGL::TextureUpdate(int Slot, int X, int Y, int
|
||||||
int ResizedW = (int)(Width * ResizeW);
|
int ResizedW = (int)(Width * ResizeW);
|
||||||
int ResizedH = (int)(Height * ResizeH);
|
int ResizedH = (int)(Height * ResizeH);
|
||||||
|
|
||||||
uint8_t *pTmpData = Resize(pTexData, Width, Height, ResizedW, ResizedH, GLFormatToPixelSize(GLFormat));
|
uint8_t *pTmpData = ResizeImage(pTexData, Width, Height, ResizedW, ResizedH, GLFormatToPixelSize(GLFormat));
|
||||||
free(pTexData);
|
free(pTexData);
|
||||||
pTexData = pTmpData;
|
pTexData = pTmpData;
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ void CCommandProcessorFragment_OpenGL::TextureUpdate(int Slot, int X, int Y, int
|
||||||
Y /= 2;
|
Y /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *pTmpData = Resize(pTexData, OldWidth, OldHeight, Width, Height, GLFormatToPixelSize(GLFormat));
|
uint8_t *pTmpData = ResizeImage(pTexData, OldWidth, OldHeight, Width, Height, GLFormatToPixelSize(GLFormat));
|
||||||
free(pTexData);
|
free(pTexData);
|
||||||
pTexData = pTmpData;
|
pTexData = pTmpData;
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
||||||
int PowerOfTwoHeight = HighestBit(Height);
|
int PowerOfTwoHeight = HighestBit(Height);
|
||||||
if(Width != PowerOfTwoWidth || Height != PowerOfTwoHeight)
|
if(Width != PowerOfTwoWidth || Height != PowerOfTwoHeight)
|
||||||
{
|
{
|
||||||
uint8_t *pTmpData = Resize(pTexData, Width, Height, PowerOfTwoWidth, PowerOfTwoHeight, GLFormatToPixelSize(GLFormat));
|
uint8_t *pTmpData = ResizeImage(pTexData, Width, Height, PowerOfTwoWidth, PowerOfTwoHeight, GLFormatToPixelSize(GLFormat));
|
||||||
free(pTexData);
|
free(pTexData);
|
||||||
pTexData = pTmpData;
|
pTexData = pTmpData;
|
||||||
|
|
||||||
|
@ -761,7 +761,7 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
||||||
|
|
||||||
if(NeedsResize)
|
if(NeedsResize)
|
||||||
{
|
{
|
||||||
uint8_t *pTmpData = Resize(pTexData, OldWidth, OldHeight, Width, Height, GLFormatToPixelSize(GLFormat));
|
uint8_t *pTmpData = ResizeImage(pTexData, OldWidth, OldHeight, Width, Height, GLFormatToPixelSize(GLFormat));
|
||||||
free(pTexData);
|
free(pTexData);
|
||||||
pTexData = pTmpData;
|
pTexData = pTmpData;
|
||||||
}
|
}
|
||||||
|
@ -879,7 +879,7 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
||||||
dbg_msg("gfx", "3D/2D array texture was resized");
|
dbg_msg("gfx", "3D/2D array texture was resized");
|
||||||
int NewWidth = maximum<int>(HighestBit(ConvertWidth), 16);
|
int NewWidth = maximum<int>(HighestBit(ConvertWidth), 16);
|
||||||
int NewHeight = maximum<int>(HighestBit(ConvertHeight), 16);
|
int NewHeight = maximum<int>(HighestBit(ConvertHeight), 16);
|
||||||
uint8_t *pNewTexData = Resize(pTexData, ConvertWidth, ConvertHeight, NewWidth, NewHeight, GLFormatToPixelSize(GLFormat));
|
uint8_t *pNewTexData = ResizeImage(pTexData, ConvertWidth, ConvertHeight, NewWidth, NewHeight, GLFormatToPixelSize(GLFormat));
|
||||||
|
|
||||||
ConvertWidth = NewWidth;
|
ConvertWidth = NewWidth;
|
||||||
ConvertHeight = NewHeight;
|
ConvertHeight = NewHeight;
|
||||||
|
|
|
@ -503,7 +503,7 @@ void CCommandProcessorFragment_OpenGL3_3::TextureUpdate(int Slot, int X, int Y,
|
||||||
Y /= 2;
|
Y /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *pTmpData = Resize(pTexData, Width, Height, Width, Height, GLFormatToPixelSize(GLFormat));
|
uint8_t *pTmpData = ResizeImage(pTexData, Width, Height, Width, Height, GLFormatToPixelSize(GLFormat));
|
||||||
free(pTexData);
|
free(pTexData);
|
||||||
pTexData = pTmpData;
|
pTexData = pTmpData;
|
||||||
}
|
}
|
||||||
|
@ -543,7 +543,7 @@ void CCommandProcessorFragment_OpenGL3_3::TextureCreate(int Slot, int Width, int
|
||||||
++RescaleCount;
|
++RescaleCount;
|
||||||
} while(Width > m_MaxTexSize || Height > m_MaxTexSize);
|
} while(Width > m_MaxTexSize || Height > m_MaxTexSize);
|
||||||
|
|
||||||
uint8_t *pTmpData = Resize(pTexData, Width, Height, Width, Height, GLFormatToPixelSize(GLFormat));
|
uint8_t *pTmpData = ResizeImage(pTexData, Width, Height, Width, Height, GLFormatToPixelSize(GLFormat));
|
||||||
free(pTexData);
|
free(pTexData);
|
||||||
pTexData = pTmpData;
|
pTexData = pTmpData;
|
||||||
}
|
}
|
||||||
|
@ -629,7 +629,7 @@ void CCommandProcessorFragment_OpenGL3_3::TextureCreate(int Slot, int Width, int
|
||||||
dbg_msg("gfx", "3D/2D array texture was resized");
|
dbg_msg("gfx", "3D/2D array texture was resized");
|
||||||
int NewWidth = maximum<int>(HighestBit(ConvertWidth), 16);
|
int NewWidth = maximum<int>(HighestBit(ConvertWidth), 16);
|
||||||
int NewHeight = maximum<int>(HighestBit(ConvertHeight), 16);
|
int NewHeight = maximum<int>(HighestBit(ConvertHeight), 16);
|
||||||
uint8_t *pNewTexData = Resize(pTexData, ConvertWidth, ConvertHeight, NewWidth, NewHeight, GLFormatToPixelSize(GLFormat));
|
uint8_t *pNewTexData = ResizeImage(pTexData, ConvertWidth, ConvertHeight, NewWidth, NewHeight, GLFormatToPixelSize(GLFormat));
|
||||||
|
|
||||||
ConvertWidth = NewWidth;
|
ConvertWidth = NewWidth;
|
||||||
ConvertHeight = NewHeight;
|
ConvertHeight = NewHeight;
|
||||||
|
|
|
@ -2548,7 +2548,7 @@ protected:
|
||||||
YOff /= 2;
|
YOff /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *pTmpData = Resize(pData, Width, Height, Width, Height, VulkanFormatToPixelSize(Format));
|
uint8_t *pTmpData = ResizeImage(pData, Width, Height, Width, Height, VulkanFormatToPixelSize(Format));
|
||||||
free(pData);
|
free(pData);
|
||||||
pData = pTmpData;
|
pData = pTmpData;
|
||||||
}
|
}
|
||||||
|
@ -2602,7 +2602,7 @@ protected:
|
||||||
++RescaleCount;
|
++RescaleCount;
|
||||||
} while((size_t)Width > m_MaxTextureSize || (size_t)Height > m_MaxTextureSize);
|
} while((size_t)Width > m_MaxTextureSize || (size_t)Height > m_MaxTextureSize);
|
||||||
|
|
||||||
uint8_t *pTmpData = Resize(pData, Width, Height, Width, Height, PixelSize);
|
uint8_t *pTmpData = ResizeImage(pData, Width, Height, Width, Height, PixelSize);
|
||||||
free(pData);
|
free(pData);
|
||||||
pData = pTmpData;
|
pData = pTmpData;
|
||||||
}
|
}
|
||||||
|
@ -2657,7 +2657,7 @@ protected:
|
||||||
dbg_msg("vulkan", "3D/2D array texture was resized");
|
dbg_msg("vulkan", "3D/2D array texture was resized");
|
||||||
int NewWidth = maximum<int>(HighestBit(ConvertWidth), 16);
|
int NewWidth = maximum<int>(HighestBit(ConvertWidth), 16);
|
||||||
int NewHeight = maximum<int>(HighestBit(ConvertHeight), 16);
|
int NewHeight = maximum<int>(HighestBit(ConvertHeight), 16);
|
||||||
uint8_t *pNewTexData = Resize(pData, ConvertWidth, ConvertHeight, NewWidth, NewHeight, PixelSize);
|
uint8_t *pNewTexData = ResizeImage(pData, ConvertWidth, ConvertHeight, NewWidth, NewHeight, PixelSize);
|
||||||
|
|
||||||
ConvertWidth = NewWidth;
|
ConvertWidth = NewWidth;
|
||||||
ConvertHeight = NewHeight;
|
ConvertHeight = NewHeight;
|
||||||
|
|
Loading…
Reference in a new issue