summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2010-10-04 04:21:32 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2010-10-04 04:21:32 (GMT)
commit5171bb1613ecc537f3f0d0962532e3ee059b8870 (patch)
tree02d0e565d8fc397573a2d35845c11ba74b912c8d /src/gui/painting
parentc372896c5293633d75674a320a9b715a0501a42d (diff)
parent33b76a659b2f44fa7038e375bbfb4cfd449ae617 (diff)
downloadQt-5171bb1613ecc537f3f0d0962532e3ee059b8870.zip
Qt-5171bb1613ecc537f3f0d0962532e3ee059b8870.tar.gz
Qt-5171bb1613ecc537f3f0d0962532e3ee059b8870.tar.bz2
Merge remote branch 'origin/4.7' into master-from-4.7
Conflicts: doc/src/snippets/code/doc_src_qmake-manual.qdoc src/corelib/arch/symbian/arch.pri src/declarative/graphicsitems/qdeclarativeflickable.cpp src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h tests/auto/qfontmetrics/tst_qfontmetrics.cpp
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qgrayraster.c46
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp9
-rw-r--r--src/gui/painting/qpainter.cpp8
-rw-r--r--src/gui/painting/qrasterdefs_p.h1
4 files changed, 49 insertions, 15 deletions
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 94039fb..d0e25a9 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -233,7 +233,7 @@
/* new algorithms */
typedef int TCoord; /* integer scanline/pixel coordinate */
- typedef long TPos; /* sub-pixel coordinate */
+ typedef int TPos; /* sub-pixel coordinate */
/* determine the type used to store cell areas. This normally takes at */
/* least PIXEL_BITS*2 + 1 bits. On 16-bit systems, we need to use */
@@ -317,6 +317,7 @@
PCell* ycells;
int ycount;
+ int skip_spans;
} TWorker, *PWorker;
@@ -330,7 +331,12 @@
} TRaster, *PRaster;
-
+ int q_gray_rendered_spans(TRaster *raster)
+ {
+ if ( raster && raster->worker )
+ return raster->worker->skip_spans > 0 ? 0 : -raster->worker->skip_spans;
+ return 0;
+ }
/*************************************************************************/
/* */
@@ -538,7 +544,7 @@
TCoord y2 )
{
TCoord ex1, ex2, fx1, fx2, delta;
- long p, first, dx;
+ int p, first, dx;
int incr, lift, mod, rem;
@@ -643,7 +649,7 @@
{
TCoord ey1, ey2, fy1, fy2;
TPos dx, dy, x, x2;
- long p, first;
+ int p, first;
int delta, rem, mod, lift, incr;
@@ -1178,6 +1184,7 @@
{
QT_FT_Span* span;
int coverage;
+ int skip;
/* compute the coverage line's coverage, depending on the */
@@ -1228,9 +1235,16 @@
if ( ras.num_gray_spans >= QT_FT_MAX_GRAY_SPANS )
{
- if ( ras.render_span )
- ras.render_span( ras.num_gray_spans, ras.gray_spans,
+ if ( ras.render_span && ras.num_gray_spans > ras.skip_spans )
+ {
+ skip = ras.skip_spans > 0 ? ras.skip_spans : 0;
+ ras.render_span( ras.num_gray_spans - skip,
+ ras.gray_spans + skip,
ras.render_span_data );
+ }
+
+ ras.skip_spans -= ras.num_gray_spans;
+
/* ras.render_span( span->y, ras.gray_spans, count ); */
#ifdef DEBUG_GRAYS
@@ -1600,7 +1614,8 @@
TBand* volatile band;
int volatile n, num_bands;
TPos volatile min, max, max_y;
- QT_FT_BBox* clip;
+ QT_FT_BBox* clip;
+ int skip;
ras.num_gray_spans = 0;
@@ -1670,7 +1685,7 @@
{
PCell cells_max;
int yindex;
- long cell_start, cell_end, cell_mod;
+ int cell_start, cell_end, cell_mod;
ras.ycells = (PCell*)ras.buffer;
@@ -1741,9 +1756,15 @@
}
}
- if ( ras.render_span && ras.num_gray_spans > 0 )
- ras.render_span( ras.num_gray_spans,
- ras.gray_spans, ras.render_span_data );
+ if ( ras.render_span && ras.num_gray_spans > ras.skip_spans )
+ {
+ skip = ras.skip_spans > 0 ? ras.skip_spans : 0;
+ ras.render_span( ras.num_gray_spans - skip,
+ ras.gray_spans + skip,
+ ras.render_span_data );
+ }
+
+ ras.skip_spans -= ras.num_gray_spans;
if ( ras.band_shoot > 8 && ras.band_size > 16 )
ras.band_size = ras.band_size / 2;
@@ -1764,6 +1785,9 @@
if ( !raster || !raster->buffer || !raster->buffer_size )
return ErrRaster_Invalid_Argument;
+ if ( raster->worker )
+ raster->worker->skip_spans = params->skip_spans;
+
// If raster object and raster buffer are allocated, but
// raster size isn't of the minimum size, indicate out of
// memory.
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 94d7578..cc9bfdf 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -4136,6 +4136,10 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
rasterize(outline, callback, (void *)spanData, rasterBuffer);
}
+extern "C" {
+ int q_gray_rendered_spans(QT_FT_Raster raster);
+}
+
void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
ProcessSpans callback,
void *userData, QRasterBuffer *)
@@ -4200,10 +4204,13 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
bool done = false;
int error;
+ int rendered_spans = 0;
+
while (!done) {
rasterParams.flags |= (QT_FT_RASTER_FLAG_AA | QT_FT_RASTER_FLAG_DIRECT);
rasterParams.gray_spans = callback;
+ rasterParams.skip_spans = rendered_spans;
error = qt_ft_grays_raster.raster_render(*grayRaster.data(), &rasterParams);
// Out of memory, reallocate some more and try again...
@@ -4232,6 +4239,8 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
#endif
Q_CHECK_PTR(rasterPoolBase); // note: we just freed the old rasterPoolBase. I hope it's not fatal.
+ rendered_spans += q_gray_rendered_spans(*grayRaster.data());
+
qt_ft_grays_raster.raster_done(*grayRaster.data());
qt_ft_grays_raster.raster_new(grayRaster.data());
qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 35a74c9..1402b44 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -2780,7 +2780,7 @@ void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op)
Q_D(QPainter);
if (d->extended) {
- if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
+ if ((!d->state->clipEnabled && op != Qt::NoClip) || (d->state->clipOperation == Qt::NoClip && op == Qt::UniteClip))
op = Qt::ReplaceClip;
if (!d->engine) {
@@ -2838,7 +2838,7 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op)
return;
}
- if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
+ if ((!d->state->clipEnabled && op != Qt::NoClip) || (d->state->clipOperation == Qt::NoClip && op == Qt::UniteClip))
op = Qt::ReplaceClip;
if (d->extended) {
@@ -2893,7 +2893,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
return;
}
- if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
+ if ((!d->state->clipEnabled && op != Qt::NoClip) || (d->state->clipOperation == Qt::NoClip && op == Qt::UniteClip))
op = Qt::ReplaceClip;
if (d->extended) {
@@ -3298,7 +3298,7 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op)
return;
}
- if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
+ if ((!d->state->clipEnabled && op != Qt::NoClip) || (d->state->clipOperation == Qt::NoClip && op == Qt::UniteClip))
op = Qt::ReplaceClip;
if (d->extended) {
diff --git a/src/gui/painting/qrasterdefs_p.h b/src/gui/painting/qrasterdefs_p.h
index 19a0b16..4131e4b 100644
--- a/src/gui/painting/qrasterdefs_p.h
+++ b/src/gui/painting/qrasterdefs_p.h
@@ -1088,6 +1088,7 @@ QT_FT_BEGIN_HEADER
QT_FT_Raster_BitSet_Func bit_set; /* doesn't work! */
void* user;
QT_FT_BBox clip_box;
+ int skip_spans;
} QT_FT_Raster_Params;