Replace an old workaround for alpha-only shadows

SceneOpenGLShadow::prepareBackend used to use QImage::Format_Indexed8,
plus a special code path in GLTexture, to create single-channel OpenGL textures.
Now that Qt supports QImage::Format_Alpha8, this workaround can be removed.
This commit is contained in:
Manuel Stoeckl 2021-08-11 22:49:49 -04:00
parent 4ab4f928f0
commit 51d82fc6e5
2 changed files with 4 additions and 6 deletions

View file

@ -52,7 +52,7 @@ struct {
{ 0, 0, 0 }, // QImage::Format_Invalid
{ 0, 0, 0 }, // QImage::Format_Mono
{ 0, 0, 0 }, // QImage::Format_MonoLSB
{ GL_R8, GL_RED, GL_UNSIGNED_BYTE }, // QImage::Format_Indexed8
{ 0, 0, 0 }, // QImage::Format_Indexed8
{ GL_RGB8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV }, // QImage::Format_RGB32
{ 0, 0, 0 }, // QImage::Format_ARGB32
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV }, // QImage::Format_ARGB32_Premultiplied
@ -130,8 +130,7 @@ GLTexture::GLTexture(const QImage& image, GLenum target)
const QImage::Format index = image.format();
if (index < sizeof(formatTable) / sizeof(formatTable[0]) && formatTable[index].internalFormat
&& !(index == QImage::Format_Indexed8 && image.colorCount() > 0)) {
if (index < sizeof(formatTable) / sizeof(formatTable[0]) && formatTable[index].internalFormat) {
internalFormat = formatTable[index].internalFormat;
format = formatTable[index].format;
type = formatTable[index].type;
@ -396,8 +395,7 @@ void GLTexture::update(const QImage &image, const QPoint &offset, const QRect &s
const QImage::Format index = image.format();
if (index < sizeof(formatTable) / sizeof(formatTable[0]) && formatTable[index].internalFormat
&& !(index == QImage::Format_Indexed8 && image.colorCount() > 0)) {
if (index < sizeof(formatTable) / sizeof(formatTable[0]) && formatTable[index].internalFormat) {
format = formatTable[index].format;
type = formatTable[index].type;
im = img;

View file

@ -1768,7 +1768,7 @@ bool SceneOpenGLShadow::prepareBackend()
// Check if the image is alpha-only in practice, and if so convert it to an 8-bpp format
if (!GLPlatform::instance()->isGLES() && GLTexture::supportsSwizzle() && GLTexture::supportsFormatRG()) {
QImage alphaImage(image.size(), QImage::Format_Indexed8); // Change to Format_Alpha8 w/ Qt 5.5
QImage alphaImage(image.size(), QImage::Format_Alpha8);
bool alphaOnly = true;
for (ptrdiff_t y = 0; alphaOnly && y < image.height(); y++) {