mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Remove graphics::Canvas and graphics::Image
This commit is contained in:
@@ -183,7 +183,7 @@ static bool createRenderbuffer(int width, int height, int &samples, PixelFormat
|
||||
}
|
||||
|
||||
Canvas::Canvas(const Settings &settings)
|
||||
: love::graphics::Canvas(settings)
|
||||
: love::graphics::Texture(settings, nullptr)
|
||||
, fbo(0)
|
||||
, texture(0)
|
||||
, renderbuffer(0)
|
||||
@@ -346,7 +346,7 @@ ptrdiff_t Canvas::getHandle() const
|
||||
|
||||
love::image::ImageData *Canvas::newImageData(love::image::Image *module, int slice, int mipmap, const Rect &r)
|
||||
{
|
||||
love::image::ImageData *data = love::graphics::Canvas::newImageData(module, slice, mipmap, r);
|
||||
love::image::ImageData *data = love::graphics::Texture::newImageData(module, slice, mipmap, r);
|
||||
|
||||
bool isSRGB = false;
|
||||
OpenGL::TextureFormat fmt = gl.convertPixelFormat(data->getFormat(), false, isSRGB);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "common/config.h"
|
||||
#include "common/Color.h"
|
||||
#include "common/int.h"
|
||||
#include "graphics/Canvas.h"
|
||||
#include "graphics/Texture.h"
|
||||
#include "graphics/Volatile.h"
|
||||
#include "OpenGL.h"
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace graphics
|
||||
namespace opengl
|
||||
{
|
||||
|
||||
class Canvas final : public love::graphics::Canvas, public Volatile
|
||||
class Canvas final : public love::graphics::Texture, public Volatile
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -130,17 +130,12 @@ love::graphics::StreamBuffer *Graphics::newStreamBuffer(BufferType type, size_t
|
||||
return CreateStreamBuffer(type, size);
|
||||
}
|
||||
|
||||
love::graphics::Texture *Graphics::newImage(const Texture::Slices &data, const Image::Settings &settings)
|
||||
love::graphics::Texture *Graphics::newImage(const Texture::Settings &settings, const Texture::Slices *data)
|
||||
{
|
||||
return new Image(data, settings);
|
||||
return new Image(settings, data);
|
||||
}
|
||||
|
||||
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::Texture *Graphics::newCanvas(const Canvas::Settings &settings)
|
||||
love::graphics::Texture *Graphics::newCanvas(const Texture::Settings &settings)
|
||||
{
|
||||
return new Canvas(settings);
|
||||
}
|
||||
|
||||
@@ -60,9 +60,8 @@ public:
|
||||
// Implements Module.
|
||||
const char *getName() const 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::Texture *newImage(const Texture::Settings &settings, const Texture::Slices *data) override;
|
||||
love::graphics::Texture *newCanvas(const Texture::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;
|
||||
|
||||
@@ -33,19 +33,13 @@ namespace graphics
|
||||
namespace opengl
|
||||
{
|
||||
|
||||
Image::Image(TextureType textype, PixelFormat format, int width, int height, int slices, const Settings &settings)
|
||||
: love::graphics::Image(textype, format, width, height, slices, settings)
|
||||
, slices(textype)
|
||||
, texture(0)
|
||||
{
|
||||
loadVolatile();
|
||||
}
|
||||
|
||||
Image::Image(const Slices &slices, const Settings &settings)
|
||||
: love::graphics::Image(slices, settings)
|
||||
, slices(slices)
|
||||
Image::Image(const Settings &settings, const Slices *data)
|
||||
: love::graphics::Texture(settings, data)
|
||||
, slices(settings.type)
|
||||
, texture(0)
|
||||
{
|
||||
if (data != nullptr)
|
||||
slices = *data;
|
||||
loadVolatile();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#pragma once
|
||||
|
||||
// LOVE
|
||||
#include "graphics/Image.h"
|
||||
#include "graphics/Texture.h"
|
||||
#include "graphics/Volatile.h"
|
||||
|
||||
// OpenGL
|
||||
@@ -34,12 +34,11 @@ namespace graphics
|
||||
namespace opengl
|
||||
{
|
||||
|
||||
class Image final : public love::graphics::Image, public Volatile
|
||||
class Image final : public love::graphics::Texture, public Volatile
|
||||
{
|
||||
public:
|
||||
|
||||
Image(const Slices &data, const Settings &settings);
|
||||
Image(TextureType textype, PixelFormat format, int width, int height, int slices, const Settings &settings);
|
||||
Image(const Settings &settings, const Slices *data);
|
||||
|
||||
virtual ~Image();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user