Remove a redundant internal Texture method

This commit is contained in:
Alex Szpakowski
2020-02-04 22:15:18 -04:00
parent 258129738f
commit 0017f9c77d
3 changed files with 54 additions and 61 deletions
+54 -59
View File
@@ -273,7 +273,8 @@ Texture::Texture(const Settings &settings, const Slices *slices)
samplerState = gfx->getDefaultSamplerState();
initQuad();
Quad::Viewport v = {0, 0, (double) width, (double) height};
quad.set(new Quad(v, width, height), Acquire::NORETAIN);
++textureCount;
}
@@ -284,12 +285,6 @@ Texture::~Texture()
setGraphicsMemorySize(0);
}
void Texture::initQuad()
{
Quad::Viewport v = {0, 0, (double) width, (double) height};
quad.set(new Quad(v, width, height), Acquire::NORETAIN);
}
void Texture::setGraphicsMemorySize(int64 bytes)
{
totalGraphicsMemory = std::max(totalGraphicsMemory - graphicsMemorySize, (int64) 0);
@@ -299,58 +294,6 @@ void Texture::setGraphicsMemorySize(int64 bytes)
totalGraphicsMemory += bytes;
}
TextureType Texture::getTextureType() const
{
return texType;
}
PixelFormat Texture::getPixelFormat() const
{
return format;
}
Texture::MipmapsMode Texture::getMipmapsMode() const
{
return mipmapsMode;
}
bool Texture::isRenderTarget() const
{
return renderTarget;
}
bool Texture::isReadable() const
{
return readable;
}
bool Texture::isCompressed() const
{
return isPixelFormatCompressed(format);
}
bool Texture::isFormatLinear() const
{
return isGammaCorrect() && !sRGB && format != PIXELFORMAT_sRGBA8_UNORM;
}
bool Texture::isValidSlice(int slice) const
{
if (slice < 0)
return false;
if (texType == TEXTURE_CUBE)
return slice < 6;
else if (texType == TEXTURE_VOLUME)
return slice < depth;
else if (texType == TEXTURE_2D_ARRAY)
return slice < layers;
else if (slice > 0)
return false;
return true;
}
void Texture::draw(Graphics *gfx, const Matrix4 &m)
{
draw(gfx, quad, m);
@@ -577,6 +520,58 @@ love::image::ImageData *Texture::newImageData(love::image::Image *module, int sl
return module->newImageData(r.w, r.h, dataformat);
}
TextureType Texture::getTextureType() const
{
return texType;
}
PixelFormat Texture::getPixelFormat() const
{
return format;
}
Texture::MipmapsMode Texture::getMipmapsMode() const
{
return mipmapsMode;
}
bool Texture::isRenderTarget() const
{
return renderTarget;
}
bool Texture::isReadable() const
{
return readable;
}
bool Texture::isCompressed() const
{
return isPixelFormatCompressed(format);
}
bool Texture::isFormatLinear() const
{
return isGammaCorrect() && !sRGB && format != PIXELFORMAT_sRGBA8_UNORM;
}
bool Texture::isValidSlice(int slice) const
{
if (slice < 0)
return false;
if (texType == TEXTURE_CUBE)
return slice < 6;
else if (texType == TEXTURE_VOLUME)
return slice < depth;
else if (texType == TEXTURE_2D_ARRAY)
return slice < layers;
else if (slice > 0)
return false;
return true;
}
int Texture::getWidth(int mip) const
{
return std::max(width >> mip, 1);
-1
View File
@@ -273,7 +273,6 @@ public:
protected:
void initQuad();
void setGraphicsMemorySize(int64 size);
void uploadImageData(love::image::ImageDataBase *d, int level, int slice, int x, int y);
-1
View File
@@ -193,7 +193,6 @@ Canvas::Canvas(const Settings &settings)
if (gfx != nullptr)
format = gfx->getSizedFormat(format, renderTarget, readable, sRGB);
initQuad();
loadVolatile();
if (status != GL_FRAMEBUFFER_COMPLETE)