mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 17:58:45 +02:00
PR comments
This commit is contained in:
parent
839b8d432e
commit
7d99f9e72f
2 changed files with 4 additions and 9 deletions
|
@ -51,6 +51,7 @@ void AnimationReader::run() {
|
||||||
if (originalPriority == QThread::InheritPriority) {
|
if (originalPriority == QThread::InheritPriority) {
|
||||||
originalPriority = QThread::NormalPriority;
|
originalPriority = QThread::NormalPriority;
|
||||||
}
|
}
|
||||||
|
QThread::currentThread()->setPriority(QThread::LowPriority);
|
||||||
try {
|
try {
|
||||||
if (_data.isEmpty()) {
|
if (_data.isEmpty()) {
|
||||||
throw QString("Reply is NULL ?!");
|
throw QString("Reply is NULL ?!");
|
||||||
|
|
|
@ -53,32 +53,26 @@ void TextureMap::setLightmapOffsetScale(float offset, float scale) {
|
||||||
// FIXME why is this in the model library? Move to GPU or GPU_GL
|
// FIXME why is this in the model library? Move to GPU or GPU_GL
|
||||||
gpu::Texture* TextureUsage::create2DTextureFromImage(const QImage& srcImage, const std::string& srcImageName) {
|
gpu::Texture* TextureUsage::create2DTextureFromImage(const QImage& srcImage, const std::string& srcImageName) {
|
||||||
QImage image = srcImage;
|
QImage image = srcImage;
|
||||||
|
bool validAlpha = false;
|
||||||
if (image.hasAlphaChannel()) {
|
if (image.hasAlphaChannel()) {
|
||||||
if (image.format() != QImage::Format_ARGB32) {
|
if (image.format() != QImage::Format_ARGB32) {
|
||||||
image = image.convertToFormat(QImage::Format_ARGB32);
|
image = image.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actual alpha channel?
|
// Actual alpha channel?
|
||||||
bool transparent { false };
|
|
||||||
for (int y = 0; y < image.height(); ++y) {
|
for (int y = 0; y < image.height(); ++y) {
|
||||||
const QRgb* data = reinterpret_cast<const QRgb*>(image.constScanLine(y));
|
const QRgb* data = reinterpret_cast<const QRgb*>(image.constScanLine(y));
|
||||||
for (int x = 0; x < image.width(); ++x) {
|
for (int x = 0; x < image.width(); ++x) {
|
||||||
auto alpha = qAlpha(data[x]);
|
auto alpha = qAlpha(data[x]);
|
||||||
if (alpha != 255) {
|
if (alpha != 255) {
|
||||||
transparent = true;
|
validAlpha = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// or bullshit alpha channel?
|
|
||||||
if (!transparent) {
|
|
||||||
qCDebug(modelLog) << "Image with alpha channel is completely opaque:" << QString(srcImageName.c_str());
|
|
||||||
image = image.convertToFormat(QImage::Format_RGB888);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!image.hasAlphaChannel() && image.format() != QImage::Format_RGB888) {
|
if (!validAlpha && image.format() != QImage::Format_RGB888) {
|
||||||
image = image.convertToFormat(QImage::Format_RGB888);
|
image = image.convertToFormat(QImage::Format_RGB888);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue