QRasterPaintEngine: Don't detach QImage
authorSérgio Martins <sergio.martins@kdab.com>
Fri, 26 Jun 2015 19:40:50 +0000 (20:40 +0100)
committerMilian Wolff <milian.wolff@kdab.com>
Tue, 25 Aug 2015 11:12:19 +0000 (11:12 +0000)
Caught being detached a few thousand times per second.

Change-Id: I6dd5fd69d7d4f32048cdb7e4ac707f24df6c15f8
(cherry picked from commit 2a81516835c680c29f3de9241a8c28027624ce4f)
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
src/gui/painting/qpaintengine_raster.cpp

index aabf4a94270c020229bd4c6c0850e182ac4fdce7..a5957ca86efc8ae197fef55cb869c5ef3ed401bb 100644 (file)
@@ -2756,12 +2756,12 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
             QFixed spp = fontEngine->subPixelPositionForX(positions[i].x);
 
             QPoint offset;
-            QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix,
-                                                                  &offset);
+            const QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix,
+                                                                        &offset);
             if (alphaMap == 0 || alphaMap->isNull())
                 continue;
 
-            alphaPenBlt(alphaMap->bits(), alphaMap->bytesPerLine(), alphaMap->depth(),
+            alphaPenBlt(alphaMap->constBits(), alphaMap->bytesPerLine(), alphaMap->depth(),
                         qFloor(positions[i].x) + offset.x(),
                         qRound(positions[i].y) + offset.y(),
                         alphaMap->width(), alphaMap->height());