summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-13 14:43:26 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-13 14:43:26 (GMT)
commit5de6b5b90e56e325d8972c4eed2ce8df2f716a76 (patch)
tree0e1f53d9cb0046ca8dee4dd0445984cf86fd27f0 /src/gui/painting
parentce1c485bea8baddbc89d35b3a0f94374205d94a3 (diff)
parent6b2cf497268037a5c127affeef3e6efd055164ec (diff)
downloadQt-5de6b5b90e56e325d8972c4eed2ce8df2f716a76.zip
Qt-5de6b5b90e56e325d8972c4eed2ce8df2f716a76.tar.gz
Qt-5de6b5b90e56e325d8972c4eed2ce8df2f716a76.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (53 commits) removed a few warnings on wince builds Removed double setting of _WIN32_WINNT QTreeView: remove dead code. doc: Clarify effect of QFont::NoFontMerging Revert "Implement heightForWidth support for QTabWidget and QStackedLayout." build fix for S60 Improve handling of QAction in soft key manager Remove useless assert qdrawhelper: fix optim in 2245641ba QSlider and StyleSheet: fix one pixel error while drawing the SliderAddPage accelerate QWindowsPipeWriter for bigger chunks of data Fix antialiasing with transformed text in OpenGL2 paint engine Fix flattening of largely scaled, thin, dashed beziers. Increased the precision used to flatten beziers Fix QT_NO_MOVIE Fix compile error with QT_NO_ACTION in QtGui Fix QT_NO_COMPLETER Fix QT_NO_FSCOMPLETER Fix QT_NO_FILESYSTEMMODEL Build fix ...
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbezier.cpp4
-rw-r--r--src/gui/painting/qdrawhelper.cpp454
-rw-r--r--src/gui/painting/qpathclipper.cpp7
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp7
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h1
5 files changed, 193 insertions, 280 deletions
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index ea7fe4f..147fbf9 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -117,8 +117,8 @@ QBezier QBezier::mapBy(const QTransform &transform) const
return QBezier::fromPoints(transform.map(pt1()), transform.map(pt2()), transform.map(pt3()), transform.map(pt4()));
}
-//0.5 is really low
-static const qreal flatness = 0.5;
+//0.05 is really low, but required for scaled-up beziers...
+static const qreal flatness = qreal(0.05);
//based on "Fast, precise flattening of cubic Bezier path and offset curves"
// by T. F. Hain, A. L. Ahmad, S. V. R. Racherla and D. D. Langan
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 917b910..b440fce 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -70,8 +70,10 @@ static uint gccBug(uint value)
constants and structures
*/
-static const int fixed_scale = 1 << 16;
-static const int half_point = 1 << 15;
+enum {
+ fixed_scale = 1 << 16,
+ half_point = 1 << 15
+};
static const int buffer_size = 2048;
struct LinearGradientValues
@@ -691,37 +693,42 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
fy -= half_point;
while (b < end) {
int x1 = (fx >> 16);
- int x2 = x1 + 1;
+ int x2;
int y1 = (fy >> 16);
- int y2 = y1 + 1;
-
- int distx = ((fx - (x1 << 16)) >> 8);
- int disty = ((fy - (y1 << 16)) >> 8);
- int idistx = 256 - distx;
- int idisty = 256 - disty;
+ int y2;
if (blendType == BlendTransformedBilinearTiled) {
x1 %= image_width;
+ if (x1 < 0) x1 += image_width;
+ x2 = x1 + 1;
x2 %= image_width;
- y1 %= image_height;
- y2 %= image_height;
- if (x1 < 0) x1 += image_width;
- if (x2 < 0) x2 += image_width;
+ y1 %= image_height;
if (y1 < 0) y1 += image_height;
- if (y2 < 0) y2 += image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
+ y2 = y1 + 1;
+ y2 %= image_height;
} else {
- x1 = qBound(0, x1, image_width - 1);
- x2 = qBound(0, x2, image_width - 1);
- y1 = qBound(0, y1, image_height - 1);
- y2 = qBound(0, y2, image_height - 1);
+ if (x1 < 0) {
+ x2 = x1 = 0;
+ } else if (x1 >= image_width - 1) {
+ x2 = x1 = image_width - 1;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < 0) {
+ y2 = y1 = 0;
+ } else if (y1 >= image_height - 1) {
+ y2 = y1 = image_height - 1;
+ } else {
+ y2 = y1 + 1;
+ }
}
+ Q_ASSERT(x1 >= 0 && x1 < image_width);
+ Q_ASSERT(x2 >= 0 && x2 < image_width);
+ Q_ASSERT(y1 >= 0 && y1 < image_height);
+ Q_ASSERT(y2 >= 0 && y2 < image_height);
+
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
@@ -730,6 +737,11 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
uint bl = fetch(s2, x1, data->texture.colorTable);
uint br = fetch(s2, x2, data->texture.colorTable);
+ int distx = (fx & 0x0000ffff) >> 8;
+ int disty = (fy & 0x0000ffff) >> 8;
+ int idistx = 256 - distx;
+ int idisty = 256 - disty;
+
uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
*b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
@@ -753,9 +765,9 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
const qreal py = fy * iw - 0.5;
int x1 = int(px) - (px < 0);
- int x2 = x1 + 1;
+ int x2;
int y1 = int(py) - (py < 0);
- int y2 = y1 + 1;
+ int y2;
int distx = int((px - x1) * 256);
int disty = int((py - y1) * 256);
@@ -764,26 +776,36 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
if (blendType == BlendTransformedBilinearTiled) {
x1 %= image_width;
+ if (x1 < 0) x1 += image_width;
+ x2 = x1 + 1;
x2 %= image_width;
- y1 %= image_height;
- y2 %= image_height;
- if (x1 < 0) x1 += image_width;
- if (x2 < 0) x2 += image_width;
+ y1 %= image_height;
if (y1 < 0) y1 += image_height;
- if (y2 < 0) y2 += image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
+ y2 = y1 + 1;
+ y2 %= image_height;
} else {
- x1 = qBound(0, x1, image_width - 1);
- x2 = qBound(0, x2, image_width - 1);
- y1 = qBound(0, y1, image_height - 1);
- y2 = qBound(0, y2, image_height - 1);
+ if (x1 < 0) {
+ x2 = x1 = 0;
+ } else if (x1 >= image_width - 1) {
+ x2 = x1 = image_width - 1;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < 0) {
+ y2 = y1 = 0;
+ } else if (y1 >= image_height - 1) {
+ y2 = y1 = image_height - 1;
+ } else {
+ y2 = y1 + 1;
+ }
}
+ Q_ASSERT(x1 >= 0 && x1 < image_width);
+ Q_ASSERT(x2 >= 0 && x2 < image_width);
+ Q_ASSERT(y1 >= 0 && y1 < image_height);
+ Q_ASSERT(y2 >= 0 && y2 < image_height);
+
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
@@ -5141,7 +5163,7 @@ static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData)
}
-template <SpanMethod spanMethod>
+template <SpanMethod spanMethod, TextureBlendType blendType> /* blendType must be either BlendTransformedBilinear or BlendTransformedBilinearTiled */
Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
@@ -5154,10 +5176,12 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode];
uint buffer[buffer_size];
- int image_x1 = data->texture.x1;
- int image_y1 = data->texture.y1;
- int image_x2 = data->texture.x2;
- int image_y2 = data->texture.y2;
+ const int image_x1 = data->texture.x1;
+ const int image_y1 = data->texture.y1;
+ const int image_x2 = data->texture.x2;
+ const int image_y2 = data->texture.y2;
+ const int image_width = data->texture.width;
+ const int image_height = data->texture.height;
const int scanline_offset = data->texture.bytesPerLine / 4;
if (data->fast_matrix) {
@@ -5187,19 +5211,41 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
uint *b = buffer;
while (b < end) {
int x1 = (x >> 16);
- int x2 = x1 + 1;
+ int x2;
int y1 = (y >> 16);
- int y2 = y1 + 1;
-
- int distx = ((x - (x1 << 16)) >> 8);
- int disty = ((y - (y1 << 16)) >> 8);
- int idistx = 256 - distx;
- int idisty = 256 - disty;
-
- x1 = qBound(image_x1, x1, image_x2 - 1);
- x2 = qBound(image_x1, x2, image_x2 - 1);
- y1 = qBound(image_y1, y1, image_y2 - 1);
- y2 = qBound(image_y1, y2, image_y2 - 1);
+ int y2;
+
+ if (blendType == BlendTransformedBilinearTiled) {
+ x1 %= image_width;
+ if (x1 < 0) x1 += image_width;
+ x2 = x1 + 1;
+ x2 %= image_width;
+
+ y1 %= image_height;
+ if (y1 < 0) y1 += image_height;
+ y2 = y1 + 1;
+ y2 %= image_height;
+
+ Q_ASSERT(x1 >= 0 && x1 < image_width);
+ Q_ASSERT(x2 >= 0 && x2 < image_width);
+ Q_ASSERT(y1 >= 0 && y1 < image_height);
+ Q_ASSERT(y2 >= 0 && y2 < image_height);
+ } else {
+ if (x1 < image_x1) {
+ x2 = x1 = image_x1;
+ } else if (x1 >= image_x2 - 1) {
+ x2 = x1 = image_x2 - 1;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < image_y1) {
+ y2 = y1 = image_y1;
+ } else if (y1 >= image_y2 - 1) {
+ y2 = y1 = image_y2 - 1;
+ } else {
+ y2 = y1 + 1;
+ }
+ }
int y1_offset = y1 * scanline_offset;
int y2_offset = y2 * scanline_offset;
@@ -5216,6 +5262,11 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
uint br = image_bits[y2_offset + x2];
#endif
+ int distx = (x & 0x0000ffff) >> 8;
+ int disty = (y & 0x0000ffff) >> 8;
+ int idistx = 256 - distx;
+ int idisty = 256 - disty;
+
uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
*b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
@@ -5265,19 +5316,46 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
const qreal py = y * iw - 0.5;
int x1 = int(px) - (px < 0);
- int x2 = x1 + 1;
+ int x2;
int y1 = int(py) - (py < 0);
- int y2 = y1 + 1;
+ int y2;
int distx = int((px - x1) * 256);
int disty = int((py - y1) * 256);
int idistx = 256 - distx;
int idisty = 256 - disty;
- x1 = qBound(image_x1, x1, image_x2 - 1);
- x2 = qBound(image_x1, x2, image_x2 - 1);
- y1 = qBound(image_y1, y1, image_y2 - 1);
- y2 = qBound(image_y1, y2, image_y2 - 1);
+ if (blendType == BlendTransformedBilinearTiled) {
+ x1 %= image_width;
+ if (x1 < 0) x1 += image_width;
+ x2 = x1 + 1;
+ x2 %= image_width;
+
+ y1 %= image_height;
+ if (y1 < 0) y1 += image_height;
+ y2 = y1 + 1;
+ y2 %= image_height;
+
+ Q_ASSERT(x1 >= 0 && x1 < image_width);
+ Q_ASSERT(x2 >= 0 && x2 < image_width);
+ Q_ASSERT(y1 >= 0 && y1 < image_height);
+ Q_ASSERT(y2 >= 0 && y2 < image_height);
+ } else {
+ if (x1 < image_x1) {
+ x2 = x1 = image_x1;
+ } else if (x1 >= image_x2 - 1) {
+ x2 = x1 = image_x2 - 1;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < image_y1) {
+ y2 = y1 = image_y1;
+ } else if (y1 >= image_y2 - 1) {
+ y2 = y1 = image_y2 - 1;
+ } else {
+ y2 = y1 + 1;
+ }
+ }
int y1_offset = y1 * scanline_offset;
int y2_offset = y2 * scanline_offset;
@@ -5366,17 +5444,27 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan
SRC *b = buffer;
while (b < end) {
int x1 = (x >> 16);
- int x2 = x1 + 1;
+ int x2;
int y1 = (y >> 16);
- int y2 = y1 + 1;
+ int y2;
- const int distx = ((x - (x1 << 16)) >> 8);
- const int disty = ((y - (y1 << 16)) >> 8);
- x1 = qBound(src_minx, x1, src_maxx);
- x2 = qBound(src_minx, x2, src_maxx);
- y1 = qBound(src_miny, y1, src_maxy);
- y2 = qBound(src_miny, y2, src_maxy);
+ const int distx = (x & 0x0000ffff) >> 8;
+ const int disty = (y & 0x0000ffff) >> 8;
+ if (x1 < src_minx) {
+ x2 = x1 = src_minx;
+ } else if (x1 >= src_maxx) {
+ x2 = x1 = src_maxx;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < src_miny) {
+ y2 = y1 = src_miny;
+ } else if (y1 >= src_maxy) {
+ y2 = y1 = src_maxy;
+ } else {
+ y2 = y1 + 1;
+ }
#if 0
if (x1 == x2) {
if (y1 == y2) {
@@ -5467,17 +5555,27 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan
const qreal py = y * iw - qreal(0.5);
int x1 = int(px) - (px < 0);
- int x2 = x1 + 1;
+ int x2;
int y1 = int(py) - (py < 0);
- int y2 = y1 + 1;
+ int y2;
const int distx = int((px - x1) * 256);
const int disty = int((py - y1) * 256);
- x1 = qBound(src_minx, x1, src_maxx);
- x2 = qBound(src_minx, x2, src_maxx);
- y1 = qBound(src_miny, y1, src_maxy);
- y2 = qBound(src_miny, y2, src_maxy);
+ if (x1 < src_minx) {
+ x2 = x1 = src_minx;
+ } else if (x1 >= src_maxx) {
+ x2 = x1 = src_maxx;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < src_miny) {
+ y2 = y1 = src_miny;
+ } else if (y1 >= src_maxy) {
+ y2 = y1 = src_maxy;
+ } else {
+ y2 = y1 + 1;
+ }
const SRC *src1 = (SRC*)data->texture.scanLine(y1);
const SRC *src2 = (SRC*)data->texture.scanLine(y2);
@@ -5646,197 +5744,6 @@ static void blend_transformed_bilinear_rgb444(int count, const QSpan *spans, voi
}
template <SpanMethod spanMethod>
-Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_tiled_argb(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- if (data->texture.format != QImage::Format_ARGB32_Premultiplied
- && data->texture.format != QImage::Format_RGB32) {
- blend_src_generic<spanMethod>(count, spans, userData);
- return;
- }
-
- CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode];
- uint buffer[buffer_size];
-
- int image_width = data->texture.width;
- int image_height = data->texture.height;
- const int scanline_offset = data->texture.bytesPerLine / 4;
-
- if (data->fast_matrix) {
- // The increment pr x in the scanline
- int fdx = (int)(data->m11 * fixed_scale);
- int fdy = (int)(data->m12 * fixed_scale);
-
- while (count--) {
- void *t = data->rasterBuffer->scanLine(spans->y);
-
- uint *target = ((uint *)t) + spans->x;
- uint *image_bits = (uint *)data->texture.imageData;
-
- const qreal cx = spans->x + 0.5;
- const qreal cy = spans->y + 0.5;
-
- int x = int((data->m21 * cy
- + data->m11 * cx + data->dx) * fixed_scale) - half_point;
- int y = int((data->m22 * cy
- + data->m12 * cx + data->dy) * fixed_scale) - half_point;
-
- int length = spans->len;
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(length, buffer_size);
- const uint *end = buffer + l;
- uint *b = buffer;
- while (b < end) {
- int x1 = (x >> 16);
- int x2 = (x1 + 1);
- int y1 = (y >> 16);
- int y2 = (y1 + 1);
-
- int distx = ((x - (x1 << 16)) >> 8);
- int disty = ((y - (y1 << 16)) >> 8);
- int idistx = 256 - distx;
- int idisty = 256 - disty;
-
- x1 %= image_width;
- x2 %= image_width;
- y1 %= image_height;
- y2 %= image_height;
-
- if (x1 < 0) x1 += image_width;
- if (x2 < 0) x2 += image_width;
- if (y1 < 0) y1 += image_height;
- if (y2 < 0) y2 += image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
-
- int y1_offset = y1 * scanline_offset;
- int y2_offset = y2 * scanline_offset;
-
-#if defined(Q_IRIX_GCC3_3_WORKAROUND)
- uint tl = gccBug(image_bits[y1_offset + x1]);
- uint tr = gccBug(image_bits[y1_offset + x2]);
- uint bl = gccBug(image_bits[y2_offset + x1]);
- uint br = gccBug(image_bits[y2_offset + x2]);
-#else
- uint tl = image_bits[y1_offset + x1];
- uint tr = image_bits[y1_offset + x2];
- uint bl = image_bits[y2_offset + x1];
- uint br = image_bits[y2_offset + x2];
-#endif
-
- uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
- uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
- *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
- ++b;
- x += fdx;
- y += fdy;
- }
- if (spanMethod == RegularSpans)
- func(target, buffer, l, coverage);
- else
- drawBufferSpan(data, buffer, buffer_size,
- spans->x + spans->len - length,
- spans->y, l, coverage);
- target += l;
- length -= l;
- }
- ++spans;
- }
- } else {
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
- while (count--) {
- void *t = data->rasterBuffer->scanLine(spans->y);
-
- uint *target = ((uint *)t) + spans->x;
- uint *image_bits = (uint *)data->texture.imageData;
-
- const qreal cx = spans->x + 0.5;
- const qreal cy = spans->y + 0.5;
-
- qreal x = data->m21 * cy + data->m11 * cx + data->dx;
- qreal y = data->m22 * cy + data->m12 * cx + data->dy;
- qreal w = data->m23 * cy + data->m13 * cx + data->m33;
-
- int length = spans->len;
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(length, buffer_size);
- const uint *end = buffer + l;
- uint *b = buffer;
- while (b < end) {
- const qreal iw = w == 0 ? 1 : 1 / w;
- const qreal px = x * iw - 0.5;
- const qreal py = y * iw - 0.5;
-
- int x1 = int(px) - (px < 0);
- int x2 = x1 + 1;
- int y1 = int(py) - (py < 0);
- int y2 = y1 + 1;
-
- int distx = int((px - x1) * 256);
- int disty = int((py - y1) * 256);
- int idistx = 256 - distx;
- int idisty = 256 - disty;
-
- x1 %= image_width;
- x2 %= image_width;
- y1 %= image_height;
- y2 %= image_height;
-
- if (x1 < 0) x1 += image_width;
- if (x2 < 0) x2 += image_width;
- if (y1 < 0) y1 += image_height;
- if (y2 < 0) y2 += image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
-
- int y1_offset = y1 * scanline_offset;
- int y2_offset = y2 * scanline_offset;
-
-#if defined(Q_IRIX_GCC3_3_WORKAROUND)
- uint tl = gccBug(image_bits[y1_offset + x1]);
- uint tr = gccBug(image_bits[y1_offset + x2]);
- uint bl = gccBug(image_bits[y2_offset + x1]);
- uint br = gccBug(image_bits[y2_offset + x2]);
-#else
- uint tl = image_bits[y1_offset + x1];
- uint tr = image_bits[y1_offset + x2];
- uint bl = image_bits[y2_offset + x1];
- uint br = image_bits[y2_offset + x2];
-#endif
-
- uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
- uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
- *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
- ++b;
- x += fdx;
- y += fdy;
- w += fdw;
- }
- if (spanMethod == RegularSpans)
- func(target, buffer, l, coverage);
- else
- drawBufferSpan(data, buffer, buffer_size,
- spans->x + spans->len - length,
- spans->y, l, coverage);
- target += l;
- length -= l;
- }
- ++spans;
- }
- }
-}
-
-template <SpanMethod spanMethod>
Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_argb(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
@@ -6738,7 +6645,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32
- SPANFUNC_POINTER(blend_transformed_bilinear_argb, RegularSpans), // ARGB32_Premultiplied
+ blend_transformed_bilinear_argb<RegularSpans, BlendTransformedBilinear>, // ARGB32_Premultiplied
blend_transformed_bilinear_rgb565,
blend_transformed_bilinear_argb8565,
blend_transformed_bilinear_rgb666,
@@ -6757,7 +6664,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32
- SPANFUNC_POINTER(blend_transformed_bilinear_tiled_argb, RegularSpans), // ARGB32_Premultiplied
+ blend_transformed_bilinear_argb<RegularSpans, BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB16
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB8565_Premultiplied
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB666
@@ -6856,7 +6763,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag
blend_src_generic<CallbackSpans>, // Indexed8
blend_src_generic<CallbackSpans>, // RGB32
blend_src_generic<CallbackSpans>, // ARGB32
- blend_transformed_bilinear_argb<CallbackSpans>, // ARGB32_Premultiplied
+ blend_transformed_bilinear_argb<CallbackSpans, BlendTransformedBilinear>, // ARGB32_Premultiplied
blend_src_generic<CallbackSpans>, // RGB16
blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
blend_src_generic<CallbackSpans>, // RGB666
@@ -6875,7 +6782,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag
blend_src_generic<CallbackSpans>, // Indexed8
blend_src_generic<CallbackSpans>, // RGB32
blend_src_generic<CallbackSpans>, // ARGB32
- blend_transformed_bilinear_tiled_argb<CallbackSpans>, // ARGB32_Premultiplied
+ blend_transformed_bilinear_argb<CallbackSpans, BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
blend_src_generic<CallbackSpans>, // RGB16
blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
blend_src_generic<CallbackSpans>, // RGB666
@@ -7135,6 +7042,11 @@ void qt_build_pow_tables() {
int winSmooth;
if (SystemParametersInfo(0x200C /* SPI_GETFONTSMOOTHINGCONTRAST */, 0, &winSmooth, 0))
smoothing = winSmooth / 1000.0;
+
+ // Safeguard ourselves against corrupt registry values...
+ if (smoothing > 5 || smoothing < 1)
+ smoothing = 1.4;
+
#endif
#ifdef Q_WS_X11
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 949a820..00e74ba 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -935,10 +935,9 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const
qreal result = b_angle - a_angle;
- if (qFuzzyIsNull(result) || qFuzzyCompare(result, 128))
- return 0;
-
- if (result < 0)
+ if (result >= 128.)
+ return result - 128.;
+ else if (result < 0)
return result + 128.;
else
return result;
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 9eda0ef..631a9cf 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -79,6 +79,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
m_current_fontengine = fontEngine;
const int margin = glyphMargin();
+ const int paddingDoubled = glyphPadding() * 2;
QHash<glyph_t, Coord> listItemCoordinates;
int rowHeight = 0;
@@ -124,7 +125,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
if (listItemCoordinates.isEmpty())
return;
- rowHeight += margin * 2;
+ rowHeight += margin * 2 + paddingDoubled;
if (isNull())
createCache(QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH, qt_next_power_of_two(rowHeight));
@@ -138,7 +139,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
if (m_cx + c.w > m_w) {
// no room on the current line, start new glyph strip
m_cx = 0;
- m_cy += m_currentRowHeight;
+ m_cy += m_currentRowHeight + paddingDoubled;
m_currentRowHeight = 0; // New row
}
if (m_cy + c.h > m_h) {
@@ -156,7 +157,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
fillTexture(c, iter.key());
coords.insert(iter.key(), c);
- m_cx += c.w;
+ m_cx += c.w + paddingDoubled;
++iter;
}
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 8c2f5b4..390fe51 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -98,6 +98,7 @@ public:
virtual void createTextureData(int width, int height) = 0;
virtual void resizeTextureData(int width, int height) = 0;
virtual int glyphMargin() const { return 0; }
+ virtual int glyphPadding() const { return 0; }
virtual void fillTexture(const Coord &coord, glyph_t glyph) = 0;