summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2010-02-15 10:22:25 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2010-02-15 10:22:25 (GMT)
commit8197e5fae939c264220666162fe9ecb624e47bef (patch)
tree08ad63b681ff701d568d771784c97be1c6274dbd /src/openvg
parent9f387357a7e171636c97a7ef13afca60c01a9e3b (diff)
parent4a47bf6a06a4f7ebbf2336cd643c50332ac76d6d (diff)
downloadQt-8197e5fae939c264220666162fe9ecb624e47bef.zip
Qt-8197e5fae939c264220666162fe9ecb624e47bef.tar.gz
Qt-8197e5fae939c264220666162fe9ecb624e47bef.tar.bz2
Merge branch 'master' of scm.dev.troll.no:qt/oslo-staging-2 into qstatictext-4.7
Conflicts: src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp tests/auto/qlineedit/tst_qlineedit.cpp Merge branch 'master' of scm.dev.troll.no:qt/oslo-staging-2 into qstatictext-4.7 Conflicts: src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp tests/auto/qlineedit/tst_qlineedit.cpp Merge branch 'master' of scm.dev.troll.no:qt/oslo-staging-2 into qstatictext-4.7 Conflicts: src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp tests/auto/qlineedit/tst_qlineedit.cpp
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qpaintengine_vg.cpp21
-rw-r--r--src/openvg/qpixmapdata_vg.cpp12
2 files changed, 11 insertions, 22 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 41772d1..62f0293 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -979,7 +979,7 @@ static QImage 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));
for (int x=0; x < width; ++x)
target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg;
@@ -987,9 +987,6 @@ static QImage colorizeBitmap(const QImage &image, const QColor &color)
return dest;
}
-// defined in qpixmapdata_vg.cpp.
-const uchar *qt_vg_imageBits(const QImage& image);
-
static VGImage toVGImage
(const QImage & image, Qt::ImageConversionFlags flags = Qt::AutoColor)
{
@@ -1023,7 +1020,7 @@ static VGImage toVGImage
break;
}
- const uchar *pixels = qt_vg_imageBits(img);
+ const uchar *pixels = img.constBits();
VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(format, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
@@ -1067,7 +1064,7 @@ static VGImage toVGImageSubRect
break;
}
- const uchar *pixels = qt_vg_imageBits(img) + bpp * sr.x() +
+ const uchar *pixels = img.constBits() + bpp * sr.x() +
img.bytesPerLine() * sr.y();
VGImage vgImg = QVGImagePool::instance()->createPermanentImage
@@ -1089,7 +1086,7 @@ static VGImage toVGImageWithOpacity(const QImage & image, qreal opacity)
painter.drawImage(0, 0, image);
painter.end();
- const uchar *pixels = qt_vg_imageBits(img);
+ const uchar *pixels = img.constBits();
VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
@@ -1111,7 +1108,7 @@ static VGImage toVGImageWithOpacitySubRect
painter.drawImage(QPoint(0, 0), image, sr);
painter.end();
- const uchar *pixels = qt_vg_imageBits(img);
+ const uchar *pixels = img.constBits();
VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
@@ -3225,15 +3222,15 @@ void QVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d,
if (!scaledImage.isNull()) { // Not a space character
if (scaledImage.format() == QImage::Format_Indexed8) {
vgImage = vgCreateImage(VG_A_8, scaledImage.width(), scaledImage.height(), VG_IMAGE_QUALITY_FASTER);
- vgImageSubData(vgImage, qt_vg_imageBits(scaledImage), scaledImage.bytesPerLine(), VG_A_8, 0, 0, scaledImage.width(), scaledImage.height());
+ vgImageSubData(vgImage, scaledImage.constBits(), scaledImage.bytesPerLine(), VG_A_8, 0, 0, scaledImage.width(), scaledImage.height());
} else if (scaledImage.format() == QImage::Format_Mono) {
QImage img = scaledImage.convertToFormat(QImage::Format_Indexed8);
vgImage = vgCreateImage(VG_A_8, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
- vgImageSubData(vgImage, qt_vg_imageBits(img), img.bytesPerLine(), VG_A_8, 0, 0, img.width(), img.height());
+ vgImageSubData(vgImage, img.constBits(), img.bytesPerLine(), VG_A_8, 0, 0, img.width(), img.height());
} else {
QImage img = scaledImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
vgImage = vgCreateImage(VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
- vgImageSubData(vgImage, qt_vg_imageBits(img), img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, img.width(), img.height());
+ vgImageSubData(vgImage, img.constBits(), img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, img.width(), img.height());
}
}
origin[0] = -metrics.x.toReal() + 0.5f;
@@ -3717,7 +3714,7 @@ void QVGCompositionHelper::drawCursorPixmap
if (vgImage == VG_INVALID_HANDLE)
return;
vgImageSubData
- (vgImage, qt_vg_imageBits(img) + img.bytesPerLine() * (img.height() - 1),
+ (vgImage, img.constBits() + img.bytesPerLine() * (img.height() - 1),
-(img.bytesPerLine()), VG_sARGB_8888_PRE, 0, 0,
img.width(), img.height());
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 3087b77..44814cc 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -231,14 +231,6 @@ QPaintEngine* QVGPixmapData::paintEngine() const
return source.paintEngine();
}
-// This function works around QImage::bits() making a deep copy if the
-// QImage is not const. We force it to be const and then get the bits.
-// XXX: Should add a QImage::constBits() in the future to replace this.
-const uchar *qt_vg_imageBits(const QImage& image)
-{
- return image.bits();
-}
-
VGImage QVGPixmapData::toVGImage()
{
if (!isValid())
@@ -271,7 +263,7 @@ VGImage QVGPixmapData::toVGImage()
if (!source.isNull() && recreate) {
vgImageSubData
(vgImage,
- qt_vg_imageBits(source), source.bytesPerLine(),
+ source.constBits(), source.bytesPerLine(),
VG_sARGB_8888_PRE, 0, 0, w, h);
}
@@ -670,7 +662,7 @@ void* QVGPixmapData::toNativeType(NativeType type)
if (bitmap) {
if (bitmap->Create(TSize(source.width(), source.height()),
EColor16MAP) == KErrNone) {
- const uchar *sptr = qt_vg_imageBits(source);
+ const uchar *sptr = source.constBits();
bitmap->BeginDataAccess();
uchar *dptr = (uchar*)bitmap->DataAddress();