From 9b50f3f7d49f57712517d1d05de69ec7495c13f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Thu, 12 Jun 2014 08:44:45 +0300 Subject: Texture power-of-two for ES2 Force power-of-2 for all ES2 devices instead of just Android and iOS. Change-Id: I6b64182f18b02153833776c82ce8378907443b85 Reviewed-by: Miikka Heikkinen --- src/datavisualization/utils/texturehelper.cpp | 2 +- src/datavisualization/utils/utils.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/datavisualization/utils/texturehelper.cpp b/src/datavisualization/utils/texturehelper.cpp index 185d99e4..2a2a89dd 100644 --- a/src/datavisualization/utils/texturehelper.cpp +++ b/src/datavisualization/utils/texturehelper.cpp @@ -41,7 +41,7 @@ GLuint TextureHelper::create2DTexture(const QImage &image, bool useTrilinearFilt QImage texImage = image; -#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) +#if defined(QT_OPENGL_ES_2) GLuint temp; GLuint imageWidth = Utils::getNearestPowerOfTwo(image.width(), temp); GLuint imageHeight = Utils::getNearestPowerOfTwo(image.height(), temp); diff --git a/src/datavisualization/utils/utils.cpp b/src/datavisualization/utils/utils.cpp index 5852bf11..2368d86a 100644 --- a/src/datavisualization/utils/utils.cpp +++ b/src/datavisualization/utils/utils.cpp @@ -67,11 +67,11 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo valueStrWidth += paddingWidth / 2; // Fix clipping problem with skewed fonts (italic or italic-style) QSize labelSize; -#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) - // Android can't handle textures with dimensions not in power of 2. Resize labels accordingly. +#if defined(QT_OPENGL_ES_2) + // ES2 can't handle textures with dimensions not in power of 2. Resize labels accordingly. // Add some padding before converting to power of two to avoid too tight fit GLuint prePadding = 5; - // Android needs to use this always (when given) because of the power of 2 -issue. + // ES2 needs to use this always (when given) because of the power of 2 -issue. if (maxLabelWidth) valueStrWidth = maxLabelWidth + paddingWidth / 2; labelSize = QSize(valueStrWidth + prePadding, valueStrHeight + prePadding); @@ -96,7 +96,7 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo painter.setFont(valueFont); if (!labelBackground) { painter.setPen(txtColor); -#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) +#if defined(QT_OPENGL_ES_2) painter.drawText((labelSize.width() - valueStrWidth) / 2.0f, (labelSize.height() - valueStrHeight) / 2.0f, valueStrWidth, valueStrHeight, -- cgit v1.2.3