Browse Source

Remove a redundant internal Texture method

Alex Szpakowski 5 years ago
parent
commit
0017f9c77d

+ 54 - 59
src/modules/graphics/Texture.cpp

@@ -273,7 +273,8 @@ Texture::Texture(const Settings &settings, const Slices *slices)
 
 
 	samplerState = gfx->getDefaultSamplerState();
 	samplerState = gfx->getDefaultSamplerState();
 
 
-	initQuad();
+	Quad::Viewport v = {0, 0, (double) width, (double) height};
+	quad.set(new Quad(v, width, height), Acquire::NORETAIN);
 
 
 	++textureCount;
 	++textureCount;
 }
 }
@@ -284,12 +285,6 @@ Texture::~Texture()
 	setGraphicsMemorySize(0);
 	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)
 void Texture::setGraphicsMemorySize(int64 bytes)
 {
 {
 	totalGraphicsMemory = std::max(totalGraphicsMemory - graphicsMemorySize, (int64) 0);
 	totalGraphicsMemory = std::max(totalGraphicsMemory - graphicsMemorySize, (int64) 0);
@@ -299,58 +294,6 @@ void Texture::setGraphicsMemorySize(int64 bytes)
 	totalGraphicsMemory += 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)
 void Texture::draw(Graphics *gfx, const Matrix4 &m)
 {
 {
 	draw(gfx, quad, 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);
 	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
 int Texture::getWidth(int mip) const
 {
 {
 	return std::max(width >> mip, 1);
 	return std::max(width >> mip, 1);

+ 0 - 1
src/modules/graphics/Texture.h

@@ -273,7 +273,6 @@ public:
 
 
 protected:
 protected:
 
 
-	void initQuad();
 	void setGraphicsMemorySize(int64 size);
 	void setGraphicsMemorySize(int64 size);
 
 
 	void uploadImageData(love::image::ImageDataBase *d, int level, int slice, int x, int y);
 	void uploadImageData(love::image::ImageDataBase *d, int level, int slice, int x, int y);

+ 0 - 1
src/modules/graphics/opengl/Canvas.cpp

@@ -193,7 +193,6 @@ Canvas::Canvas(const Settings &settings)
 	if (gfx != nullptr)
 	if (gfx != nullptr)
 		format = gfx->getSizedFormat(format, renderTarget, readable, sRGB);
 		format = gfx->getSizedFormat(format, renderTarget, readable, sRGB);
 
 
-	initQuad();
 	loadVolatile();
 	loadVolatile();
 
 
 	if (status != GL_FRAMEBUFFER_COMPLETE)
 	if (status != GL_FRAMEBUFFER_COMPLETE)