summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qdistancefield.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-02-14 10:39:30 +0100
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-09-17 14:48:48 +0200
commitd84a6eab5129ba29951a7ba6d82820b21cc9872e (patch)
tree1d794ecd3f37363a286f3eeda8e571c36ec4006c /src/gui/text/qdistancefield.cpp
parentbce19cb9063003af5924c643f6fc1416146b4242 (diff)
Add Grayscale8 and Alpha8 formats to QImage and drawing
Extend the QImage format with two 8-bit grayscale and alpha formats. These formats have the advantage over Indexed8 that they have simpler conversion and can be rendered to by the raster engine. [ChangeLog][QtGui][QImage] Added support grayscale and alpha 8-bit formats which can also be rendered to. Change-Id: I4343c80a92a3dda196aa38d0c3ea251b094fc274 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui/text/qdistancefield.cpp')
-rw-r--r--src/gui/text/qdistancefield.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index 17116ee2d0..56e5386258 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -42,6 +42,7 @@
#include "qdistancefield_p.h"
#include <qmath.h>
#include <private/qdatabuffer_p.h>
+#include <private/qimage_p.h>
#include <private/qpathsimplifier_p.h>
QT_BEGIN_NAMESPACE
@@ -995,12 +996,12 @@ QImage QDistanceField::toImage(QImage::Format format) const
if (isNull())
return QImage();
- QImage image(d->width, d->height, format == QImage::Format_Indexed8 ?
+ QImage image(d->width, d->height, qt_depthForFormat(format) == 8 ?
format : QImage::Format_ARGB32_Premultiplied);
if (image.isNull())
return image;
- if (format == QImage::Format_Indexed8) {
+ if (image.depth() == 8) {
for (int y = 0; y < d->height; ++y)
memcpy(image.scanLine(y), scanLine(y), d->width);
} else {