| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | QBasicAtomicInt qgltextureglyphcache_serial_number = { 1 }; | - | ||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | QGLTextureGlyphCache::QGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix) | - | ||||||||||||||||||
| 8 | : QImageTextureGlyphCache(format, matrix) | - | ||||||||||||||||||
| 9 | , m_textureResource(0) | - | ||||||||||||||||||
| 10 | , pex(0) | - | ||||||||||||||||||
| 11 | , m_blitProgram(0) | - | ||||||||||||||||||
| 12 | , m_filterMode(Nearest) | - | ||||||||||||||||||
| 13 | , m_serialNumber(qgltextureglyphcache_serial_number.fetchAndAddRelaxed(1)) | - | ||||||||||||||||||
| 14 | { | - | ||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | - | |||||||||||||||||||
| 18 | m_vertexCoordinateArray[0] = -1.0f; | - | ||||||||||||||||||
| 19 | m_vertexCoordinateArray[1] = -1.0f; | - | ||||||||||||||||||
| 20 | m_vertexCoordinateArray[2] = 1.0f; | - | ||||||||||||||||||
| 21 | m_vertexCoordinateArray[3] = -1.0f; | - | ||||||||||||||||||
| 22 | m_vertexCoordinateArray[4] = 1.0f; | - | ||||||||||||||||||
| 23 | m_vertexCoordinateArray[5] = 1.0f; | - | ||||||||||||||||||
| 24 | m_vertexCoordinateArray[6] = -1.0f; | - | ||||||||||||||||||
| 25 | m_vertexCoordinateArray[7] = 1.0f; | - | ||||||||||||||||||
| 26 | - | |||||||||||||||||||
| 27 | m_textureCoordinateArray[0] = 0.0f; | - | ||||||||||||||||||
| 28 | m_textureCoordinateArray[1] = 0.0f; | - | ||||||||||||||||||
| 29 | m_textureCoordinateArray[2] = 1.0f; | - | ||||||||||||||||||
| 30 | m_textureCoordinateArray[3] = 0.0f; | - | ||||||||||||||||||
| 31 | m_textureCoordinateArray[4] = 1.0f; | - | ||||||||||||||||||
| 32 | m_textureCoordinateArray[5] = 1.0f; | - | ||||||||||||||||||
| 33 | m_textureCoordinateArray[6] = 0.0f; | - | ||||||||||||||||||
| 34 | m_textureCoordinateArray[7] = 1.0f; | - | ||||||||||||||||||
| 35 | } never executed: end of block | 0 | ||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | QGLTextureGlyphCache::~QGLTextureGlyphCache() | - | ||||||||||||||||||
| 38 | { | - | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | - | |||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | delete m_blitProgram; | - | ||||||||||||||||||
| 43 | if (m_textureResource
| 0 | ||||||||||||||||||
| 44 | m_textureResource->free(); never executed: m_textureResource->free(); | 0 | ||||||||||||||||||
| 45 | } never executed: end of block | 0 | ||||||||||||||||||
| 46 | - | |||||||||||||||||||
| 47 | void QGLTextureGlyphCache::createTextureData(int width, int height) | - | ||||||||||||||||||
| 48 | { | - | ||||||||||||||||||
| 49 | QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); | - | ||||||||||||||||||
| 50 | if (ctx == 0
| 0 | ||||||||||||||||||
| 51 | QMessageLogger(__FILE__, 94, __PRETTY_FUNCTION__).warning("QGLTextureGlyphCache::createTextureData: Called with no context"); | - | ||||||||||||||||||
| 52 | return; never executed: return; | 0 | ||||||||||||||||||
| 53 | } | - | ||||||||||||||||||
| 54 | QOpenGLFunctions *funcs = ctx->contextHandle()->functions(); | - | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | if ((!QGLFramebufferObject::hasOpenGLFramebufferObjects()
| 0 | ||||||||||||||||||
| 60 | QImageTextureGlyphCache::createTextureData(width, height); never executed: QImageTextureGlyphCache::createTextureData(width, height); | 0 | ||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | - | |||||||||||||||||||
| 63 | if (width < 16
| 0 | ||||||||||||||||||
| 64 | width = 16; never executed: width = 16; | 0 | ||||||||||||||||||
| 65 | if (height < 16
| 0 | ||||||||||||||||||
| 66 | height = 16; never executed: height = 16; | 0 | ||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | if (m_textureResource
| 0 | ||||||||||||||||||
| 69 | delete m_textureResource; | - | ||||||||||||||||||
| 70 | m_textureResource = 0; | - | ||||||||||||||||||
| 71 | } never executed: end of block | 0 | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | if (!m_textureResource
| 0 | ||||||||||||||||||
| 74 | m_textureResource = new QGLGlyphTexture(ctx); never executed: m_textureResource = new QGLGlyphTexture(ctx); | 0 | ||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 | funcs->glGenTextures(1, &m_textureResource->m_texture); | - | ||||||||||||||||||
| 77 | funcs->glBindTexture(0x0DE1, m_textureResource->m_texture); | - | ||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | m_textureResource->m_width = width; | - | ||||||||||||||||||
| 80 | m_textureResource->m_height = height; | - | ||||||||||||||||||
| 81 | - | |||||||||||||||||||
| 82 | if (m_format == QFontEngine::Format_A32
| 0 | ||||||||||||||||||
| 83 | QVarLengthArray<uchar> data(width * height * 4); | - | ||||||||||||||||||
| 84 | for (int i = 0; i < data.size()
| 0 | ||||||||||||||||||
| 85 | data[i] = 0; never executed: data[i] = 0; | 0 | ||||||||||||||||||
| 86 | funcs->glTexImage2D(0x0DE1, 0, 0x1908, width, height, 0, 0x1908, 0x1401, &data[0]); | - | ||||||||||||||||||
| 87 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 88 | QVarLengthArray<uchar> data(width * height); | - | ||||||||||||||||||
| 89 | for (int i = 0; i < data.size()
| 0 | ||||||||||||||||||
| 90 | data[i] = 0; never executed: data[i] = 0; | 0 | ||||||||||||||||||
| 91 | funcs->glTexImage2D(0x0DE1, 0, 0x1906, width, height, 0, 0x1906, 0x1401, &data[0]); | - | ||||||||||||||||||
| 92 | } never executed: end of block | 0 | ||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | funcs->glTexParameteri(0x0DE1, 0x2800, 0x2600); | - | ||||||||||||||||||
| 95 | funcs->glTexParameteri(0x0DE1, 0x2801, 0x2600); | - | ||||||||||||||||||
| 96 | funcs->glTexParameteri(0x0DE1, 0x2802, 0x812F); | - | ||||||||||||||||||
| 97 | funcs->glTexParameteri(0x0DE1, 0x2803, 0x812F); | - | ||||||||||||||||||
| 98 | m_filterMode = Nearest; | - | ||||||||||||||||||
| 99 | } never executed: end of block | 0 | ||||||||||||||||||
| 100 | - | |||||||||||||||||||
| 101 | void QGLTextureGlyphCache::resizeTextureData(int width, int height) | - | ||||||||||||||||||
| 102 | { | - | ||||||||||||||||||
| 103 | QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); | - | ||||||||||||||||||
| 104 | if (ctx == 0
| 0 | ||||||||||||||||||
| 105 | QMessageLogger(__FILE__, 148, __PRETTY_FUNCTION__).warning("QGLTextureGlyphCache::resizeTextureData: Called with no context"); | - | ||||||||||||||||||
| 106 | return; never executed: return; | 0 | ||||||||||||||||||
| 107 | } | - | ||||||||||||||||||
| 108 | QOpenGLFunctions *funcs = ctx->contextHandle()->functions(); | - | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | int oldWidth = m_textureResource->m_width; | - | ||||||||||||||||||
| 111 | int oldHeight = m_textureResource->m_height; | - | ||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | if (width < 16
| 0 | ||||||||||||||||||
| 115 | width = 16; never executed: width = 16; | 0 | ||||||||||||||||||
| 116 | if (height < 16
| 0 | ||||||||||||||||||
| 117 | height = 16; never executed: height = 16; | 0 | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | GLuint oldTexture = m_textureResource->m_texture; | - | ||||||||||||||||||
| 120 | createTextureData(width, height); | - | ||||||||||||||||||
| 121 | - | |||||||||||||||||||
| 122 | if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()
| 0 | ||||||||||||||||||
| 123 | QImageTextureGlyphCache::resizeTextureData(width, height); | - | ||||||||||||||||||
| 124 | ((!(image().depth() == 8)) ? qt_assert("image().depth() == 8",__FILE__,167) : qt_noop()); | - | ||||||||||||||||||
| 125 | funcs->glTexSubImage2D(0x0DE1, 0, 0, 0, width, oldHeight, 0x1906, 0x1401, image().constBits()); | - | ||||||||||||||||||
| 126 | funcs->glDeleteTextures(1, &oldTexture); | - | ||||||||||||||||||
| 127 | return; never executed: return; | 0 | ||||||||||||||||||
| 128 | } | - | ||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | ctx->d_ptr->refreshCurrentFbo(); | - | ||||||||||||||||||
| 134 | - | |||||||||||||||||||
| 135 | funcs->glBindFramebuffer(0x8D40, m_textureResource->m_fbo); | - | ||||||||||||||||||
| 136 | - | |||||||||||||||||||
| 137 | GLuint tmp_texture; | - | ||||||||||||||||||
| 138 | funcs->glGenTextures(1, &tmp_texture); | - | ||||||||||||||||||
| 139 | funcs->glBindTexture(0x0DE1, tmp_texture); | - | ||||||||||||||||||
| 140 | funcs->glTexImage2D(0x0DE1, 0, 0x1908, oldWidth, oldHeight, 0, | - | ||||||||||||||||||
| 141 | 0x1908, 0x1401, __null); | - | ||||||||||||||||||
| 142 | funcs->glTexParameteri(0x0DE1, 0x2801, 0x2600); | - | ||||||||||||||||||
| 143 | funcs->glTexParameteri(0x0DE1, 0x2800, 0x2600); | - | ||||||||||||||||||
| 144 | funcs->glTexParameteri(0x0DE1, 0x2802, 0x812F); | - | ||||||||||||||||||
| 145 | funcs->glTexParameteri(0x0DE1, 0x2803, 0x812F); | - | ||||||||||||||||||
| 146 | m_filterMode = Nearest; | - | ||||||||||||||||||
| 147 | funcs->glBindTexture(0x0DE1, 0); | - | ||||||||||||||||||
| 148 | funcs->glFramebufferTexture2D(0x8D40, 0x8CE0, | - | ||||||||||||||||||
| 149 | 0x0DE1, tmp_texture, 0); | - | ||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | funcs->glActiveTexture(0x84C0 + GLuint(0)); | - | ||||||||||||||||||
| 152 | funcs->glBindTexture(0x0DE1, oldTexture); | - | ||||||||||||||||||
| 153 | - | |||||||||||||||||||
| 154 | if (pex != 0
| 0 | ||||||||||||||||||
| 155 | pex->transferMode(BrushDrawingMode); never executed: pex->transferMode(BrushDrawingMode); | 0 | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | funcs->glDisable(0x0B90); | - | ||||||||||||||||||
| 158 | funcs->glDisable(0x0B71); | - | ||||||||||||||||||
| 159 | funcs->glDisable(0x0C11); | - | ||||||||||||||||||
| 160 | funcs->glDisable(0x0BE2); | - | ||||||||||||||||||
| 161 | - | |||||||||||||||||||
| 162 | funcs->glViewport(0, 0, oldWidth, oldHeight); | - | ||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | QGLShaderProgram *blitProgram = 0; | - | ||||||||||||||||||
| 165 | if (pex == 0
| 0 | ||||||||||||||||||
| 166 | if (m_blitProgram == 0
| 0 | ||||||||||||||||||
| 167 | m_blitProgram = new QGLShaderProgram(ctx); | - | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | { | - | ||||||||||||||||||
| 170 | QString source; | - | ||||||||||||||||||
| 171 | source.append(QLatin1String(qglslMainWithTexCoordsVertexShader)); | - | ||||||||||||||||||
| 172 | source.append(QLatin1String(qglslUntransformedPositionVertexShader)); | - | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | QGLShader *vertexShader = new QGLShader(QGLShader::Vertex, m_blitProgram); | - | ||||||||||||||||||
| 175 | vertexShader->compileSourceCode(source); | - | ||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | m_blitProgram->addShader(vertexShader); | - | ||||||||||||||||||
| 178 | } | - | ||||||||||||||||||
| 179 | - | |||||||||||||||||||
| 180 | { | - | ||||||||||||||||||
| 181 | QString source; | - | ||||||||||||||||||
| 182 | source.append(QLatin1String(qglslMainFragmentShader)); | - | ||||||||||||||||||
| 183 | source.append(QLatin1String(qglslImageSrcFragmentShader)); | - | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | QGLShader *fragmentShader = new QGLShader(QGLShader::Fragment, m_blitProgram); | - | ||||||||||||||||||
| 186 | fragmentShader->compileSourceCode(source); | - | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | m_blitProgram->addShader(fragmentShader); | - | ||||||||||||||||||
| 189 | } | - | ||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | m_blitProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); | - | ||||||||||||||||||
| 192 | m_blitProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); | - | ||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | m_blitProgram->link(); | - | ||||||||||||||||||
| 195 | } never executed: end of block | 0 | ||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | funcs->glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, 0x1406, 0, 0, m_vertexCoordinateArray); | - | ||||||||||||||||||
| 198 | funcs->glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, 0x1406, 0, 0, m_textureCoordinateArray); | - | ||||||||||||||||||
| 199 | - | |||||||||||||||||||
| 200 | m_blitProgram->bind(); | - | ||||||||||||||||||
| 201 | m_blitProgram->enableAttributeArray(int(QT_VERTEX_COORDS_ATTR)); | - | ||||||||||||||||||
| 202 | m_blitProgram->enableAttributeArray(int(QT_TEXTURE_COORDS_ATTR)); | - | ||||||||||||||||||
| 203 | m_blitProgram->disableAttributeArray(int(QT_OPACITY_ATTR)); | - | ||||||||||||||||||
| 204 | - | |||||||||||||||||||
| 205 | blitProgram = m_blitProgram; | - | ||||||||||||||||||
| 206 | - | |||||||||||||||||||
| 207 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 208 | pex->setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, m_vertexCoordinateArray); | - | ||||||||||||||||||
| 209 | pex->setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, m_textureCoordinateArray); | - | ||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | pex->shaderManager->useBlitProgram(); | - | ||||||||||||||||||
| 212 | blitProgram = pex->shaderManager->blitProgram(); | - | ||||||||||||||||||
| 213 | } never executed: end of block | 0 | ||||||||||||||||||
| 214 | - | |||||||||||||||||||
| 215 | blitProgram->setUniformValue("imageTexture", GLuint(0)); | - | ||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | funcs->glDrawArrays(0x0006, 0, 4); | - | ||||||||||||||||||
| 218 | - | |||||||||||||||||||
| 219 | funcs->glBindTexture(0x0DE1, m_textureResource->m_texture); | - | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | funcs->glCopyTexSubImage2D(0x0DE1, 0, 0, 0, 0, 0, oldWidth, oldHeight); | - | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | funcs->glFramebufferRenderbuffer(0x8D40, 0x8CE0, | - | ||||||||||||||||||
| 224 | 0x8D41, 0); | - | ||||||||||||||||||
| 225 | funcs->glDeleteTextures(1, &tmp_texture); | - | ||||||||||||||||||
| 226 | funcs->glDeleteTextures(1, &oldTexture); | - | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | funcs->glBindFramebuffer(0x8D40, ctx->d_ptr->current_fbo); | - | ||||||||||||||||||
| 229 | - | |||||||||||||||||||
| 230 | if (pex != 0
| 0 | ||||||||||||||||||
| 231 | funcs->glViewport(0, 0, pex->width, pex->height); | - | ||||||||||||||||||
| 232 | pex->updateClipScissorTest(); | - | ||||||||||||||||||
| 233 | } never executed: end of block | 0 | ||||||||||||||||||
| 234 | } never executed: end of block | 0 | ||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) | - | ||||||||||||||||||
| 237 | { | - | ||||||||||||||||||
| 238 | QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); | - | ||||||||||||||||||
| 239 | if (ctx == 0
| 0 | ||||||||||||||||||
| 240 | QMessageLogger(__FILE__, 283, __PRETTY_FUNCTION__).warning("QGLTextureGlyphCache::fillTexture: Called with no context"); | - | ||||||||||||||||||
| 241 | return; never executed: return; | 0 | ||||||||||||||||||
| 242 | } | - | ||||||||||||||||||
| 243 | QOpenGLFunctions *funcs = ctx->contextHandle()->functions(); | - | ||||||||||||||||||
| 244 | - | |||||||||||||||||||
| 245 | if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()
| 0 | ||||||||||||||||||
| 246 | QImageTextureGlyphCache::fillTexture(c, glyph, subPixelPosition); | - | ||||||||||||||||||
| 247 | - | |||||||||||||||||||
| 248 | funcs->glBindTexture(0x0DE1, m_textureResource->m_texture); | - | ||||||||||||||||||
| 249 | const QImage &texture = image(); | - | ||||||||||||||||||
| 250 | const uchar *bits = texture.constBits(); | - | ||||||||||||||||||
| 251 | bits += c.y * texture.bytesPerLine() + c.x; | - | ||||||||||||||||||
| 252 | for (int i=0; i<c.h
| 0 | ||||||||||||||||||
| 253 | funcs->glTexSubImage2D(0x0DE1, 0, c.x, c.y + i, c.w, 1, 0x1906, 0x1401, bits); | - | ||||||||||||||||||
| 254 | bits += texture.bytesPerLine(); | - | ||||||||||||||||||
| 255 | } never executed: end of block | 0 | ||||||||||||||||||
| 256 | return; never executed: return; | 0 | ||||||||||||||||||
| 257 | } | - | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | QImage mask = textureMapForGlyph(glyph, subPixelPosition); | - | ||||||||||||||||||
| 260 | const int maskWidth = mask.width(); | - | ||||||||||||||||||
| 261 | const int maskHeight = mask.height(); | - | ||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | if (mask.format() == QImage::Format_Mono
| 0 | ||||||||||||||||||
| 264 | mask = mask.convertToFormat(QImage::Format_Indexed8); | - | ||||||||||||||||||
| 265 | for (int y = 0; y < maskHeight
| 0 | ||||||||||||||||||
| 266 | uchar *src = (uchar *) mask.scanLine(y); | - | ||||||||||||||||||
| 267 | for (int x = 0; x < maskWidth
| 0 | ||||||||||||||||||
| 268 | src[x] = -src[x]; never executed: src[x] = -src[x]; | 0 | ||||||||||||||||||
| 269 | } never executed: end of block | 0 | ||||||||||||||||||
| 270 | } never executed: else if (mask.depth() == 32end of block
| 0 | ||||||||||||||||||
| 271 | - | |||||||||||||||||||
| 272 | - | |||||||||||||||||||
| 273 | for (int y = 0; y < maskHeight
| 0 | ||||||||||||||||||
| 274 | quint32 *src = (quint32 *) mask.scanLine(y); | - | ||||||||||||||||||
| 275 | for (int x = 0; x < maskWidth
| 0 | ||||||||||||||||||
| 276 | int r = qRed(src[x]); | - | ||||||||||||||||||
| 277 | int g = qGreen(src[x]); | - | ||||||||||||||||||
| 278 | int b = qBlue(src[x]); | - | ||||||||||||||||||
| 279 | int avg; | - | ||||||||||||||||||
| 280 | if (mask.format() == QImage::Format_RGB32
| 0 | ||||||||||||||||||
| 281 | avg = (r + g + b + 1) / 3; never executed: avg = (r + g + b + 1) / 3; | 0 | ||||||||||||||||||
| 282 | else | - | ||||||||||||||||||
| 283 | avg = qAlpha(src[x]); never executed: avg = qAlpha(src[x]); | 0 | ||||||||||||||||||
| 284 | if (ctx->contextHandle()->isOpenGLES()
| 0 | ||||||||||||||||||
| 285 | - | |||||||||||||||||||
| 286 | src[x] = (avg << 24) | (r << 0) | (g << 8) | (b << 16); | - | ||||||||||||||||||
| 287 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 288 | src[x] = (src[x] & 0x00ffffff) | (avg << 24); | - | ||||||||||||||||||
| 289 | } never executed: end of block | 0 | ||||||||||||||||||
| 290 | } | - | ||||||||||||||||||
| 291 | } never executed: end of block | 0 | ||||||||||||||||||
| 292 | } never executed: end of block | 0 | ||||||||||||||||||
| 293 | - | |||||||||||||||||||
| 294 | funcs->glBindTexture(0x0DE1, m_textureResource->m_texture); | - | ||||||||||||||||||
| 295 | if (mask.depth() == 32
| 0 | ||||||||||||||||||
| 296 | GLenum format = 0x1908; | - | ||||||||||||||||||
| 297 | - | |||||||||||||||||||
| 298 | if (!ctx->contextHandle()->isOpenGLES()
| 0 | ||||||||||||||||||
| 299 | format = 0x80E1; never executed: format = 0x80E1; | 0 | ||||||||||||||||||
| 300 | - | |||||||||||||||||||
| 301 | funcs->glTexSubImage2D(0x0DE1, 0, c.x, c.y, maskWidth, maskHeight, format, 0x1401, mask.bits()); | - | ||||||||||||||||||
| 302 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 303 | if (!ctx->d_ptr->workaround_brokenAlphaTexSubImage_init
| 0 | ||||||||||||||||||
| 304 | - | |||||||||||||||||||
| 305 | const QByteArray vendorString(reinterpret_cast<const char*>(funcs->glGetString(0x1F00))); | - | ||||||||||||||||||
| 306 | ctx->d_ptr->workaround_brokenAlphaTexSubImage = vendorString.indexOf("NVIDIA") >= 0; | - | ||||||||||||||||||
| 307 | ctx->d_ptr->workaround_brokenAlphaTexSubImage_init = true; | - | ||||||||||||||||||
| 308 | } never executed: end of block | 0 | ||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | if (ctx->d_ptr->workaround_brokenAlphaTexSubImage
| 0 | ||||||||||||||||||
| 311 | for (int i = 0; i < maskHeight
| 0 | ||||||||||||||||||
| 312 | funcs->glTexSubImage2D(0x0DE1, 0, c.x, c.y + i, maskWidth, 1, 0x1906, 0x1401, mask.scanLine(i)); never executed: funcs->glTexSubImage2D(0x0DE1, 0, c.x, c.y + i, maskWidth, 1, 0x1906, 0x1401, mask.scanLine(i)); | 0 | ||||||||||||||||||
| 313 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 314 | funcs->glTexSubImage2D(0x0DE1, 0, c.x, c.y, maskWidth, maskHeight, 0x1906, 0x1401, mask.bits()); | - | ||||||||||||||||||
| 315 | } never executed: end of block | 0 | ||||||||||||||||||
| 316 | } | - | ||||||||||||||||||
| 317 | } | - | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | int QGLTextureGlyphCache::glyphPadding() const | - | ||||||||||||||||||
| 320 | { | - | ||||||||||||||||||
| 321 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 322 | } | - | ||||||||||||||||||
| 323 | - | |||||||||||||||||||
| 324 | int QGLTextureGlyphCache::maxTextureWidth() const | - | ||||||||||||||||||
| 325 | { | - | ||||||||||||||||||
| 326 | QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); | - | ||||||||||||||||||
| 327 | if (ctx == 0
| 0 | ||||||||||||||||||
| 328 | return never executed: QImageTextureGlyphCache::maxTextureWidth();return QImageTextureGlyphCache::maxTextureWidth();never executed: return QImageTextureGlyphCache::maxTextureWidth(); | 0 | ||||||||||||||||||
| 329 | else | - | ||||||||||||||||||
| 330 | return never executed: ctx->d_ptr->maxTextureSize();return ctx->d_ptr->maxTextureSize();never executed: return ctx->d_ptr->maxTextureSize(); | 0 | ||||||||||||||||||
| 331 | } | - | ||||||||||||||||||
| 332 | - | |||||||||||||||||||
| 333 | int QGLTextureGlyphCache::maxTextureHeight() const | - | ||||||||||||||||||
| 334 | { | - | ||||||||||||||||||
| 335 | QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); | - | ||||||||||||||||||
| 336 | if (ctx == 0
| 0 | ||||||||||||||||||
| 337 | return never executed: QImageTextureGlyphCache::maxTextureHeight();return QImageTextureGlyphCache::maxTextureHeight();never executed: return QImageTextureGlyphCache::maxTextureHeight(); | 0 | ||||||||||||||||||
| 338 | - | |||||||||||||||||||
| 339 | if (ctx->d_ptr->workaround_brokenTexSubImage
| 0 | ||||||||||||||||||
| 340 | return never executed: qMin(1024, ctx->d_ptr->maxTextureSize());return qMin(1024, ctx->d_ptr->maxTextureSize());never executed: return qMin(1024, ctx->d_ptr->maxTextureSize()); | 0 | ||||||||||||||||||
| 341 | else | - | ||||||||||||||||||
| 342 | return never executed: ctx->d_ptr->maxTextureSize();return ctx->d_ptr->maxTextureSize();never executed: return ctx->d_ptr->maxTextureSize(); | 0 | ||||||||||||||||||
| 343 | } | - | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | void QGLTextureGlyphCache::clear() | - | ||||||||||||||||||
| 346 | { | - | ||||||||||||||||||
| 347 | m_textureResource->free(); | - | ||||||||||||||||||
| 348 | m_textureResource = 0; | - | ||||||||||||||||||
| 349 | - | |||||||||||||||||||
| 350 | m_w = 0; | - | ||||||||||||||||||
| 351 | m_h = 0; | - | ||||||||||||||||||
| 352 | m_cx = 0; | - | ||||||||||||||||||
| 353 | m_cy = 0; | - | ||||||||||||||||||
| 354 | m_currentRowHeight = 0; | - | ||||||||||||||||||
| 355 | coords.clear(); | - | ||||||||||||||||||
| 356 | } never executed: end of block | 0 | ||||||||||||||||||
| 357 | - | |||||||||||||||||||
| 358 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |