Move some Canvas code to Texture, devirtualize Texture::draw.

This commit is contained in:
Alex Szpakowski
2020-02-03 19:02:58 -04:00
parent f9248d478c
commit b46b3ed552
19 changed files with 136 additions and 128 deletions
+12 -2
View File
@@ -126,6 +126,7 @@ class Texture : public Drawable, public Resource
public:
static love::Type type;
static int textureCount;
enum MipmapsType
{
@@ -175,16 +176,20 @@ public:
/**
* Draws the texture using the specified transformation with a Quad applied.
**/
virtual void draw(Graphics *gfx, Quad *quad, const Matrix4 &m);
void draw(Graphics *gfx, Quad *quad, const Matrix4 &m);
void drawLayer(Graphics *gfx, int layer, const Matrix4 &m);
virtual void drawLayer(Graphics *gfx, int layer, Quad *quad, const Matrix4 &m);
void drawLayer(Graphics *gfx, int layer, Quad *quad, const Matrix4 &m);
TextureType getTextureType() const;
PixelFormat getPixelFormat() const;
bool isRenderTarget() const;
bool isReadable() const;
bool isCompressed() const;
bool isFormatLinear() const;
bool isValidSlice(int slice) const;
int getWidth(int mip = 0) const;
@@ -201,6 +206,8 @@ public:
virtual void setSamplerState(const SamplerState &s);
const SamplerState &getSamplerState() const;
virtual void generateMipmaps() = 0;
Quad *getQuad() const;
static int getTotalMipmapCount(int w, int h);
@@ -220,8 +227,11 @@ protected:
TextureType texType;
PixelFormat format;
bool renderTarget;
bool readable;
bool sRGB;
int width;
int height;