summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/image/qgifhandler.cpp4
-rw-r--r--src/gui/image/qpixmap_blitter.cpp2
-rw-r--r--src/gui/image/qpixmap_win.cpp2
-rw-r--r--src/gui/image/qppmhandler.cpp6
-rw-r--r--src/gui/image/qxbmhandler.cpp2
-rw-r--r--src/gui/image/qxpmhandler.cpp4
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qregion.cpp4
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp6
-rw-r--r--src/gui/text/qfontengine.cpp8
10 files changed, 21 insertions, 21 deletions
diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp
index 7ba6b123e8..9c748c0373 100644
--- a/src/gui/image/qgifhandler.cpp
+++ b/src/gui/image/qgifhandler.cpp
@@ -199,7 +199,7 @@ void QGIFFormat::disposePrevious(QImage *image)
fillRect(image, l, t, r-l+1, b-t+1, color(bgcol));
} else {
// Impossible: We don't know of a bgcol - use pixel 0
- QRgb *bits = (QRgb*)image->bits();
+ const QRgb *bits = reinterpret_cast<const QRgb *>(image->constBits());
fillRect(image, l, t, r-l+1, b-t+1, bits[0]);
}
// ### Changed: QRect(l, t, r-l+1, b-t+1)
@@ -208,7 +208,7 @@ void QGIFFormat::disposePrevious(QImage *image)
if (frame >= 0) {
for (int ln=t; ln<=b; ln++) {
memcpy(image->scanLine(ln)+l,
- backingstore.scanLine(ln-t),
+ backingstore.constScanLine(ln-t),
(r-l+1)*sizeof(QRgb));
}
// ### Changed: QRect(l, t, r-l+1, b-t+1)
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index b254c5a2af..a68425e100 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -183,7 +183,7 @@ void QBlittablePlatformPixmap::fromImage(const QImage &image,
correctFormatPic = correctFormatPic.convertToFormat(thisImg->format(), flags);
uchar *mem = thisImg->bits();
- const uchar *bits = correctFormatPic.bits();
+ const uchar *bits = correctFormatPic.constBits();
int bytesCopied = 0;
while (bytesCopied < correctFormatPic.byteCount()) {
memcpy(mem,bits,correctFormatPic.bytesPerLine());
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index a7a9b375ff..8db3bdbc7f 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -198,7 +198,7 @@ Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap)
QScopedArrayPointer<uchar> bits(new uchar[bpl * h]);
bm.invertPixels();
for (int y = 0; y < h; ++y)
- memcpy(bits.data() + y * bpl, bm.scanLine(y), bpl);
+ memcpy(bits.data() + y * bpl, bm.constScanLine(y), bpl);
HBITMAP hbm = CreateBitmap(w, h, 1, 1, bits.data());
return hbm;
}
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index 7f23656c02..6eb35e1558 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -329,7 +329,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
if (image.format() == QImage::Format_Indexed8) {
QVector<QRgb> color = image.colorTable();
for (uint y=0; y<h; y++) {
- uchar *b = image.scanLine(y);
+ const uchar *b = image.constScanLine(y);
uchar *p = buf;
uchar *end = buf+bpl;
if (gray) {
@@ -350,7 +350,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
}
} else {
for (uint y=0; y<h; y++) {
- uchar *b = image.scanLine(y);
+ const uchar *b = image.constScanLine(y);
uchar *p = buf;
uchar *end = buf + bpl;
if (gray) {
@@ -380,7 +380,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
uint bpl = w * 3;
uchar *buf = new uchar[bpl];
for (uint y=0; y<h; y++) {
- QRgb *b = (QRgb*)image.scanLine(y);
+ const QRgb *b = reinterpret_cast<const QRgb *>(image.constScanLine(y));
uchar *p = buf;
uchar *end = buf+bpl;
while (p < end) {
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
index 81525d9dd6..44d07f1624 100644
--- a/src/gui/image/qxbmhandler.cpp
+++ b/src/gui/image/qxbmhandler.cpp
@@ -210,7 +210,7 @@ static bool write_xbm_image(const QImage &sourceImage, QIODevice *device, const
char *p = buf;
int bpl = (w+7)/8;
for (int y = 0; y < h; ++y) {
- uchar *b = image.scanLine(y);
+ const uchar *b = image.constScanLine(y);
for (i = 0; i < bpl; ++i) {
*p++ = '0'; *p++ = 'x';
*p++ = hexrep[*b >> 4];
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index e9ac4a9cc2..fbce78eb74 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -1098,7 +1098,7 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const
// build color table
for(y=0; y<h; y++) {
- QRgb * yp = (QRgb *)image.scanLine(y);
+ const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y));
for(x=0; x<w; x++) {
QRgb color = *(yp + x);
if (!colorMap.contains(color))
@@ -1144,7 +1144,7 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const
// write pixels, limit to 4 characters per pixel
line.truncate(cpp*w);
for(y=0; y<h; y++) {
- QRgb * yp = (QRgb *) image.scanLine(y);
+ const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y));
int cc = 0;
for(x=0; x<w; x++) {
int color = (int)(*(yp + x));
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index fb44a7aeb1..9d981dcc2c 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3610,7 +3610,7 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
{
Q_ASSERT(image.depth() == 1);
- QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB);
+ const QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB);
QImage dest = QImage(sourceImage.size(), QImage::Format_ARGB32_Premultiplied);
QRgb fg = qPremultiply(color.rgba());
@@ -3619,7 +3619,7 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
int height = sourceImage.height();
int width = sourceImage.width();
for (int y=0; y<height; ++y) {
- uchar *source = sourceImage.scanLine(y);
+ const uchar *source = sourceImage.constScanLine(y);
QRgb *target = reinterpret_cast<QRgb *>(dest.scanLine(y));
if (!source || !target)
QT_THROW(std::bad_alloc()); // we must have run out of memory
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 5e648eabf5..757c78cec8 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -3735,7 +3735,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
QRegionPrivate *qt_bitmapToRegion(const QBitmap& bitmap)
{
- QImage image = bitmap.toImage();
+ const QImage image = bitmap.toImage();
QRegionPrivate *region = new QRegionPrivate;
@@ -3753,7 +3753,7 @@ QRegionPrivate *qt_bitmapToRegion(const QBitmap& bitmap)
int x,
y;
for (y = 0; y < image.height(); ++y) {
- uchar *line = image.scanLine(y);
+ const uchar *line = image.constScanLine(y);
int w = image.width();
uchar all = zero;
int prev1 = -1;
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 97f82d16d3..20039d902a 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -339,7 +339,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
uchar *dest = d + (c.y + y) *dbpl + c.x/8;
if (y < mh) {
- uchar *src = mask.scanLine(y);
+ const uchar *src = mask.constScanLine(y);
for (int x = 0; x < c.w/8; ++x) {
if (x < (mw+7)/8)
dest[x] = src[x];
@@ -361,7 +361,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
for (int y = 0; y < c.h; ++y) {
uchar *dest = d + (c.y + y) *dbpl + c.x;
if (y < mh) {
- uchar *src = (uchar *) mask.scanLine(y);
+ const uchar *src = mask.constScanLine(y);
for (int x = 0; x < c.w; ++x) {
if (x < mw)
dest[x] = (src[x >> 3] & (1 << (7 - (x & 7)))) > 0 ? 255 : 0;
@@ -372,7 +372,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
for (int y = 0; y < c.h; ++y) {
uchar *dest = d + (c.y + y) *dbpl + c.x;
if (y < mh) {
- uchar *src = (uchar *) mask.scanLine(y);
+ const uchar *src = mask.constScanLine(y);
for (int x = 0; x < c.w; ++x) {
if (x < mw)
dest[x] = src[x];
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index fc66c4ec4c..03ad6a24e9 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -823,7 +823,7 @@ void QFontEngine::addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &glyp
}
}
}
- const uchar *bitmap_data = bitmap.bits();
+ const uchar *bitmap_data = bitmap.constBits();
QFixedPoint offset = glyphs.offsets[i];
advanceX += offset.x;
advanceY += offset.y;
@@ -880,12 +880,12 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, con
QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &t)
{
- QImage alphaMask = alphaMapForGlyph(glyph, t);
+ const QImage alphaMask = alphaMapForGlyph(glyph, t);
QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32);
for (int y=0; y<alphaMask.height(); ++y) {
uint *dst = (uint *) rgbMask.scanLine(y);
- uchar *src = (uchar *) alphaMask.scanLine(y);
+ const uchar *src = alphaMask.constScanLine(y);
for (int x=0; x<alphaMask.width(); ++x) {
int val = src[x];
dst[x] = qRgb(val, val, val);
@@ -973,7 +973,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
for (int y=0; y<im.height(); ++y) {
uchar *dst = (uchar *) alphaMap.scanLine(y);
- uint *src = (uint *) im.scanLine(y);
+ const uint *src = reinterpret_cast<const uint *>(im.constScanLine(y));
for (int x=0; x<im.width(); ++x)
dst[x] = qAlpha(src[x]);
}