summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:27:50 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:31:07 (GMT)
commitf390f9b51cf8686e9ed44f13a33c7349b9e96a09 (patch)
tree162c768769713a7215bca64daf8f2bdc75c9fbee /src/opengl
parent0bb0699d403b7541472a72a4057ecf0ca366a7cd (diff)
downloadQt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.zip
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.gz
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.bz2
improved string operations all over the place
used character operations whenever possible better usage of QLatin1String
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qegl.cpp14
-rw-r--r--src/opengl/qgl.cpp2
-rw-r--r--src/opengl/qgl_x11.cpp6
-rw-r--r--src/opengl/qglpixmapfilter.cpp37
-rw-r--r--src/opengl/util/generator.cpp2
5 files changed, 30 insertions, 31 deletions
diff --git a/src/opengl/qegl.cpp b/src/opengl/qegl.cpp
index c6c258b..f1ae4ed 100644
--- a/src/opengl/qegl.cpp
+++ b/src/opengl/qegl.cpp
@@ -582,7 +582,7 @@ QString QEglProperties::toString() const
if (val != EGL_DONT_CARE) {
str += QLatin1String("id=");
str += QString::number(val);
- str += QLatin1String(" ");
+ str += QLatin1Char(' ');
}
#ifdef EGL_RENDERABLE_TYPE
@@ -617,11 +617,11 @@ QString QEglProperties::toString() const
bufferSize = EGL_DONT_CARE;
str += QLatin1String(" rgba=");
str += QString::number(red);
- str += QLatin1String(",");
+ str += QLatin1Char(',');
str += QString::number(green);
- str += QLatin1String(",");
+ str += QLatin1Char(',');
str += QString::number(blue);
- str += QLatin1String(",");
+ str += QLatin1Char(',');
str += QString::number(alpha);
if (bufferSize != EGL_DONT_CARE) {
// Only report buffer size if different than r+g+b+a.
@@ -708,7 +708,7 @@ QString QEglProperties::toString() const
if (height != EGL_DONT_CARE || width != EGL_DONT_CARE) {
addTag(str, QLatin1String(" max-pbuffer-size="));
str += QString::number(width);
- str += QLatin1String("x");
+ str += QLatin1Char('x');
str += QString::number(height);
if (pixels != (width * height)) {
addTag(str, QLatin1String(" max-pbuffer-pixels="));
@@ -762,9 +762,9 @@ QString QEglProperties::toString() const
if (val == EGL_TRANSPARENT_RGB) {
addTag(str, QLatin1String(" transparent-rgb="));
str += QString::number(value(EGL_TRANSPARENT_RED_VALUE));
- str += QLatin1String(",");
+ str += QLatin1Char(',');
str += QString::number(value(EGL_TRANSPARENT_GREEN_VALUE));
- str += QLatin1String(",");
+ str += QLatin1Char(',');
str += QString::number(value(EGL_TRANSPARENT_BLUE_VALUE));
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 431b488..60039eb 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -4365,7 +4365,7 @@ Q_OPENGL_EXPORT const QString qt_gl_library_name()
{
if (qt_gl_lib_name()->isNull()) {
#if defined(Q_WS_X11) || defined(Q_WS_QWS)
- return QString(QLatin1String("GL"));
+ return QLatin1String("GL");
#else // Q_WS_MAC
return QLatin1String("/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib");
#endif
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index 528cc3b..28a50bd 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -433,7 +433,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
if (!d->gpm)
return false;
}
- QString glxExt = QString(QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)));
+ QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS));
if (glxExt.contains(QLatin1String("GLX_SGI_video_sync"))) {
if (d->glFormat.swapInterval() == -1)
d->glFormat.setSwapInterval(0);
@@ -787,7 +787,7 @@ void QGLContext::swapBuffers() const
static qt_glXWaitVideoSyncSGI glXWaitVideoSyncSGI = 0;
static bool resolved = false;
if (!resolved) {
- QString glxExt = QString(QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)));
+ QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS));
if (glxExt.contains(QLatin1String("GLX_SGI_video_sync"))) {
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
void *handle = dlopen(NULL, RTLD_LAZY);
@@ -1032,7 +1032,7 @@ void *QGLContext::getProcAddress(const QString &proc) const
if (resolved && !glXGetProcAddressARB)
return 0;
if (!glXGetProcAddressARB) {
- QString glxExt = QString(QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)));
+ QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS));
if (glxExt.contains(QLatin1String("GLX_ARB_get_proc_address"))) {
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
void *handle = dlopen(NULL, RTLD_LAZY);
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index eb3298b..275bbed 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -192,15 +192,15 @@ bool QGLPixmapColorizeFilter::processGL(QPainter *, const QPointF &pos, const QP
// generates convolution filter code for arbitrary sized kernel
QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const {
QByteArray code;
- code.append("uniform sampler2D texture;\n");
- code.append("uniform vec2 inv_texture_size;\n");
- code.append("uniform float matrix[");
+ code.append("uniform sampler2D texture;\n"
+ "uniform vec2 inv_texture_size;\n"
+ "uniform float matrix[");
code.append(QByteArray::number(m_kernelWidth * m_kernelHeight));
- code.append("];\n");
- code.append("vec2 offset[");
+ code.append("];\n"
+ "vec2 offset[");
code.append(QByteArray::number(m_kernelWidth*m_kernelHeight));
- code.append("];\n");
- code.append("void main(void) {\n");
+ code.append("];\n"
+ "void main(void) {\n");
for(int y = 0; y < m_kernelHeight; y++) {
for(int x = 0; x < m_kernelWidth; x++) {
@@ -210,22 +210,21 @@ QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const {
code.append(QByteArray::number(x-(int)(m_kernelWidth/2)));
code.append(".0, inv_texture_size.y * ");
code.append(QByteArray::number((int)(m_kernelHeight/2)-y));
- code.append(".0)");
- code.append(";\n");
+ code.append(".0);\n");
}
}
- code.append(" int i = 0;\n");
- code.append(" vec2 coords = gl_TexCoord[0].st;\n");
- code.append(" vec4 sum = vec4(0.0);\n");
- code.append(" for (i = 0; i < ");
+ code.append(" int i = 0;\n"
+ " vec2 coords = gl_TexCoord[0].st;\n"
+ " vec4 sum = vec4(0.0);\n"
+ " for (i = 0; i < ");
code.append(QByteArray::number(m_kernelWidth * m_kernelHeight));
- code.append("; i++) {\n");
- code.append(" vec4 tmp = texture2D(texture,coords+offset[i]);\n");
- code.append(" sum += matrix[i] * tmp;\n");
- code.append(" }\n");
- code.append(" gl_FragColor = sum;\n");
- code.append("}");
+ code.append("; i++) {\n"
+ " vec4 tmp = texture2D(texture,coords+offset[i]);\n"
+ " sum += matrix[i] * tmp;\n"
+ " }\n"
+ " gl_FragColor = sum;\n"
+ "}");
return code;
}
diff --git a/src/opengl/util/generator.cpp b/src/opengl/util/generator.cpp
index de2450d..dac5a2d 100644
--- a/src/opengl/util/generator.cpp
+++ b/src/opengl/util/generator.cpp
@@ -116,7 +116,7 @@ QList<QStringPair> readConf(const QString &confFile)
lineStream >> enumerator;
if (lineStream.atEnd()) {
- qDebug() << "Error in file" << confFile << "(" << enumerator << ")";
+ qDebug() << "Error in file" << confFile << '(' << enumerator << ')';
exit(0);
}