summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpaintengine_raster.cpp
diff options
context:
space:
mode:
authorCarolina Gomes <ext-carolina.s.gomes@nomovok.com>2010-06-14 11:23:48 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-06-14 11:23:48 (GMT)
commit44af23156fac578543e6d17c67d739e75e51c972 (patch)
tree63626c20c3995ec8c4781ed0aff7ba7f1d5368af /src/gui/painting/qpaintengine_raster.cpp
parent104fac002e228fb17304ec76d57febe33f8e8e7f (diff)
downloadQt-44af23156fac578543e6d17c67d739e75e51c972.zip
Qt-44af23156fac578543e6d17c67d739e75e51c972.tar.gz
Qt-44af23156fac578543e6d17c67d739e75e51c972.tar.bz2
Fixed error reporting in grayraster and reduced default pool size.
Task-number: QTBUG-10471 Merge-request: 642 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui/painting/qpaintengine_raster.cpp')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 08e14fb..9f1128b 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -345,7 +345,7 @@ void QRasterPaintEngine::init()
// The antialiasing raster.
d->grayRaster.reset(new QT_FT_Raster);
Q_CHECK_PTR(d->grayRaster.data());
- if (qt_ft_grays_raster.raster_new(0, d->grayRaster.data()))
+ if (qt_ft_grays_raster.raster_new(d->grayRaster.data()))
QT_THROW(std::bad_alloc()); // an error creating the raster is caused by a bad malloc
@@ -4185,7 +4185,11 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
return;
}
- const int rasterPoolInitialSize = 8192;
+ // Initial size for raster pool is MINIMUM_POOL_SIZE so as to
+ // minimize memory reallocations. However if initial size for
+ // raster pool is changed for lower value, reallocations will
+ // occur normally.
+ const int rasterPoolInitialSize = MINIMUM_POOL_SIZE;
int rasterPoolSize = rasterPoolInitialSize;
unsigned char *rasterPoolBase;
#if defined(Q_WS_WIN64)
@@ -4229,7 +4233,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
error = qt_ft_grays_raster.raster_render(*grayRaster.data(), &rasterParams);
// Out of memory, reallocate some more and try again...
- if (error == -6) { // -6 is Result_err_OutOfMemory
+ if (error == -6) { // ErrRaster_OutOfMemory from qgrayraster.c
int new_size = rasterPoolSize * 2;
if (new_size > 1024 * 1024) {
qWarning("QPainter: Rasterization of primitive failed");
@@ -4255,7 +4259,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
Q_CHECK_PTR(rasterPoolBase); // note: we just freed the old rasterPoolBase. I hope it's not fatal.
qt_ft_grays_raster.raster_done(*grayRaster.data());
- qt_ft_grays_raster.raster_new(0, grayRaster.data());
+ qt_ft_grays_raster.raster_new(grayRaster.data());
qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize);
} else {
done = true;