Replaced some references to Image and Canvas with Texture.

This commit is contained in:
Alex Szpakowski
2020-02-04 20:52:57 -04:00
parent c3b77e0a92
commit b71eaf73cc
12 changed files with 47 additions and 50 deletions
+2 -2
View File
@@ -288,13 +288,13 @@ bool Canvas::loadVolatile()
void Canvas::unloadVolatile()
{
if (fbo != 0 || renderbuffer != 0 || texture != 0)
if (isRenderTarget() && (fbo != 0 || renderbuffer != 0 || texture != 0))
{
// This is a bit ugly, but we need some way to destroy the cached FBO
// when this Canvas' texture is destroyed.
auto gfx = Module::getInstance<Graphics>(Module::M_GRAPHICS);
if (gfx != nullptr)
gfx->cleanupCanvas(this);
gfx->cleanupRenderTexture(this);
}
if (fbo != 0)
+4 -4
View File
@@ -130,17 +130,17 @@ love::graphics::StreamBuffer *Graphics::newStreamBuffer(BufferType type, size_t
return CreateStreamBuffer(type, size);
}
love::graphics::Image *Graphics::newImage(const Texture::Slices &data, const Image::Settings &settings)
love::graphics::Texture *Graphics::newImage(const Texture::Slices &data, const Image::Settings &settings)
{
return new Image(data, settings);
}
love::graphics::Image *Graphics::newImage(TextureType textype, PixelFormat format, int width, int height, int slices, const Image::Settings &settings)
love::graphics::Texture *Graphics::newImage(TextureType textype, PixelFormat format, int width, int height, int slices, const Image::Settings &settings)
{
return new Image(textype, format, width, height, slices, settings);
}
love::graphics::Canvas *Graphics::newCanvas(const Canvas::Settings &settings)
love::graphics::Texture *Graphics::newCanvas(const Canvas::Settings &settings)
{
return new Canvas(settings);
}
@@ -820,7 +820,7 @@ void Graphics::discard(OpenGL::FramebufferTarget target, const std::vector<bool>
glDiscardFramebufferEXT(gltarget, (GLint) attachments.size(), &attachments[0]);
}
void Graphics::cleanupCanvas(Canvas *texture)
void Graphics::cleanupRenderTexture(Texture *texture)
{
if (!texture->isRenderTarget())
return;
+4 -4
View File
@@ -60,9 +60,9 @@ public:
// Implements Module.
const char *getName() const override;
love::graphics::Image *newImage(const Texture::Slices &data, const Image::Settings &settings) override;
love::graphics::Image *newImage(TextureType textype, PixelFormat format, int width, int height, int slices, const Image::Settings &settings) override;
love::graphics::Canvas *newCanvas(const Canvas::Settings &settings) override;
love::graphics::Texture *newImage(const Texture::Slices &data, const Image::Settings &settings) override;
love::graphics::Texture *newImage(TextureType textype, PixelFormat format, int width, int height, int slices, const Image::Settings &settings) override;
love::graphics::Texture *newCanvas(const Canvas::Settings &settings) override;
love::graphics::Buffer *newBuffer(size_t size, const void *data, BufferType type, vertex::Usage usage, uint32 mapflags) override;
void setViewportSize(int width, int height, int pixelwidth, int pixelheight) override;
@@ -112,7 +112,7 @@ public:
Shader::Language getShaderLanguageTarget() const override;
// Internal use.
void cleanupCanvas(Canvas *canvas);
void cleanupRenderTexture(Texture *texture);
private: