mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Move some Canvas code to Texture, devirtualize Texture::draw.
This commit is contained in:
@@ -137,6 +137,20 @@ bool isPixelFormatStencil(PixelFormat format)
|
||||
return format == PIXELFORMAT_STENCIL8 || format == PIXELFORMAT_DEPTH24_UNORM_STENCIL8 || format == PIXELFORMAT_DEPTH32_FLOAT_STENCIL8;
|
||||
}
|
||||
|
||||
PixelFormat getSRGBPixelFormat(PixelFormat format)
|
||||
{
|
||||
if (format == PIXELFORMAT_RGBA8_UNORM)
|
||||
return PIXELFORMAT_sRGBA8_UNORM;
|
||||
return format;
|
||||
}
|
||||
|
||||
PixelFormat getLinearPixelFormat(PixelFormat format)
|
||||
{
|
||||
if (format == PIXELFORMAT_sRGBA8_UNORM)
|
||||
return PIXELFORMAT_RGBA8_UNORM;
|
||||
return format;
|
||||
}
|
||||
|
||||
size_t getPixelFormatSize(PixelFormat format)
|
||||
{
|
||||
switch (format)
|
||||
|
||||
@@ -132,6 +132,16 @@ bool isPixelFormatDepth(PixelFormat format);
|
||||
**/
|
||||
bool isPixelFormatStencil(PixelFormat format);
|
||||
|
||||
/**
|
||||
* Gets the sRGB version of a linear pixel format, if applicable.
|
||||
**/
|
||||
PixelFormat getSRGBPixelFormat(PixelFormat format);
|
||||
|
||||
/**
|
||||
* Gets the linear version of a sRGB pixel format, if applicable.
|
||||
**/
|
||||
PixelFormat getLinearPixelFormat(PixelFormat format);
|
||||
|
||||
/**
|
||||
* Gets the size in bytes of the specified pixel format.
|
||||
* NOTE: Currently returns 0 for compressed formats.
|
||||
|
||||
Reference in New Issue
Block a user