From c3b2f89b85696c01062ddcd9d21a05cebf51b078 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 26 Jul 2010 16:26:38 +0200 Subject: Clean the CompositionFunction tables of drawhelper Some instructions sets were defining partial table of composition functions. To work around that, qInitDrawhelperAsm() was resetting the composition function of QPainter::CompositionMode_Destination and anything above QPainter::CompositionMode_Xor. This was a problem because it makes it impossible to implement fast path for those composition mode. This patch export prototypes for the generic functions of each composition mode. The specialized implementations now define a complete table. Reviewed-by: Andreas Kling --- src/gui/painting/qdrawhelper.cpp | 127 ++++++++++++++---------------- src/gui/painting/qdrawhelper_iwmmxt.cpp | 25 +++++- src/gui/painting/qdrawhelper_mmx.cpp | 23 +++++- src/gui/painting/qdrawhelper_mmx3dnow.cpp | 25 +++++- src/gui/painting/qdrawhelper_p.h | 35 ++++++++ src/gui/painting/qdrawhelper_sse.cpp | 25 +++++- src/gui/painting/qdrawhelper_sse3dnow.cpp | 25 +++++- 7 files changed, 208 insertions(+), 77 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index ca9556b..a77c379 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1314,7 +1314,7 @@ static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint comp_func_Clear_impl(dest, length, const_alpha); } -static void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha) +void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha) { comp_func_Clear_impl(dest, length, const_alpha); } @@ -1338,7 +1338,7 @@ static void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint colo } } -static void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) { ::memcpy(dest, src, length * sizeof(uint)); @@ -1356,7 +1356,7 @@ static void QT_FASTCALL comp_func_solid_Destination(uint *, int, uint, uint) { } -static void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint) +void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint) { } @@ -1381,7 +1381,7 @@ static void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint } } -static void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -1419,7 +1419,7 @@ static void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, } } -static void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -1461,7 +1461,7 @@ static void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint co } } -static void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -1498,7 +1498,7 @@ static void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, ui } } -static void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -1540,7 +1540,7 @@ static void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint c } } -static void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -1576,7 +1576,7 @@ static void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, u } } -static void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -1613,7 +1613,7 @@ static void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint } } -static void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -1653,7 +1653,7 @@ static void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, } } -static void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -1695,7 +1695,7 @@ static void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, } } -static void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -1794,7 +1794,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uin } } -static void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Plus_impl(dest, src, length, QFullCoverage()); @@ -1866,7 +1866,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *dest, const } } -static void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Multiply_impl(dest, src, length, QFullCoverage()); @@ -1934,7 +1934,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *dest, const u } } -static void QT_FASTCALL comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Screen_impl(dest, src, length, QFullCoverage()); @@ -2013,7 +2013,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *dest, const } } -static void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Overlay_impl(dest, src, length, QFullCoverage()); @@ -2086,7 +2086,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *dest, const u } } -static void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Darken_impl(dest, src, length, QFullCoverage()); @@ -2159,7 +2159,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *dest, const } } -static void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Lighten_impl(dest, src, length, QFullCoverage()); @@ -2242,7 +2242,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *dest, con } } -static void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_ColorDodge_impl(dest, src, length, QFullCoverage()); @@ -2325,7 +2325,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *dest, cons } } -static void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_ColorBurn_impl(dest, src, length, QFullCoverage()); @@ -2405,7 +2405,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *dest, cons } } -static void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_HardLight_impl(dest, src, length, QFullCoverage()); @@ -2496,7 +2496,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *dest, cons } } -static void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_SoftLight_impl(dest, src, length, QFullCoverage()); @@ -2569,7 +2569,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *dest, con } } -static void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Difference_impl(dest, src, length, QFullCoverage()); @@ -2636,7 +2636,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *dest, cons } } -static void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Exclusion_impl(dest, src, length, QFullCoverage()); @@ -2659,10 +2659,10 @@ static void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, *dest++ |= color; } -static void QT_FASTCALL rasterop_SourceOrDestination(uint *dest, - const uint *src, - int length, - uint const_alpha) +void QT_FASTCALL rasterop_SourceOrDestination(uint *dest, + const uint *src, + int length, + uint const_alpha) { Q_UNUSED(const_alpha); while (length--) @@ -2680,10 +2680,10 @@ static void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest, *dest++ &= color; } -static void QT_FASTCALL rasterop_SourceAndDestination(uint *dest, - const uint *src, - int length, - uint const_alpha) +void QT_FASTCALL rasterop_SourceAndDestination(uint *dest, + const uint *src, + int length, + uint const_alpha) { Q_UNUSED(const_alpha); while (length--) { @@ -2703,10 +2703,10 @@ static void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest, *dest++ ^= color; } -static void QT_FASTCALL rasterop_SourceXorDestination(uint *dest, - const uint *src, - int length, - uint const_alpha) +void QT_FASTCALL rasterop_SourceXorDestination(uint *dest, + const uint *src, + int length, + uint const_alpha) { Q_UNUSED(const_alpha); while (length--) { @@ -2728,10 +2728,10 @@ static void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest, } } -static void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest, - const uint *src, - int length, - uint const_alpha) +void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest, + const uint *src, + int length, + uint const_alpha) { Q_UNUSED(const_alpha); while (length--) { @@ -2753,10 +2753,10 @@ static void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest, } } -static void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest, - const uint *src, - int length, - uint const_alpha) +void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest, + const uint *src, + int length, + uint const_alpha) { Q_UNUSED(const_alpha); while (length--) { @@ -2778,10 +2778,10 @@ static void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest, } } -static void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest, - const uint *src, - int length, - uint const_alpha) +void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest, + const uint *src, + int length, + uint const_alpha) { Q_UNUSED(const_alpha); while (length--) { @@ -2797,8 +2797,8 @@ static void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length, qt_memfill(dest, ~color | 0xff000000, length); } -static void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src, - int length, uint const_alpha) +void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src, + int length, uint const_alpha) { Q_UNUSED(const_alpha); while (length--) @@ -2818,10 +2818,10 @@ static void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest, } } -static void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest, - const uint *src, - int length, - uint const_alpha) +void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest, + const uint *src, + int length, + uint const_alpha) { Q_UNUSED(const_alpha); while (length--) { @@ -2842,10 +2842,10 @@ static void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest, } } -static void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest, - const uint *src, - int length, - uint const_alpha) +void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest, + const uint *src, + int length, + uint const_alpha) { Q_UNUSED(const_alpha); while (length--) { @@ -7919,17 +7919,8 @@ void qInitDrawhelperAsm() functionForModeSolid = functionForModeSolidAsm; } - if (functionForModeAsm) { - const int destinationMode = QPainter::CompositionMode_Destination; - functionForModeAsm[destinationMode] = functionForMode_C[destinationMode]; - - // use the default qdrawhelper implementation for the - // extended composition modes - for (int mode = 12; mode < numCompositionFunctions; ++mode) - functionForModeAsm[mode] = functionForMode_C[mode]; - + if (functionForModeAsm) functionForMode = functionForModeAsm; - } qt_build_pow_tables(); } diff --git a/src/gui/painting/qdrawhelper_iwmmxt.cpp b/src/gui/painting/qdrawhelper_iwmmxt.cpp index 80b2c04..d99045d 100644 --- a/src/gui/painting/qdrawhelper_iwmmxt.cpp +++ b/src/gui/painting/qdrawhelper_iwmmxt.cpp @@ -106,14 +106,35 @@ CompositionFunction qt_functionForMode_IWMMXT[] = { comp_func_DestinationOver, comp_func_Clear, comp_func_Source, - 0, + comp_func_Destination, comp_func_SourceIn, comp_func_DestinationIn, comp_func_SourceOut, comp_func_DestinationOut, comp_func_SourceAtop, comp_func_DestinationAtop, - comp_func_XOR + comp_func_XOR, + comp_func_Plus, + comp_func_Multiply, + comp_func_Screen, + comp_func_Overlay, + comp_func_Darken, + comp_func_Lighten, + comp_func_ColorDodge, + comp_func_ColorBurn, + comp_func_HardLight, + comp_func_SoftLight, + comp_func_Difference, + comp_func_Exclusion, + rasterop_SourceOrDestination, + rasterop_SourceAndDestination, + rasterop_SourceXorDestination, + rasterop_NotSourceAndNotDestination, + rasterop_NotSourceOrNotDestination, + rasterop_NotSourceXorDestination, + rasterop_NotSource, + rasterop_NotSourceAndDestination, + rasterop_SourceAndNotDestination }; void qt_blend_color_argb_iwmmxt(int count, const QSpan *spans, void *userData) diff --git a/src/gui/painting/qdrawhelper_mmx.cpp b/src/gui/painting/qdrawhelper_mmx.cpp index d49c5a1..ba92554 100644 --- a/src/gui/painting/qdrawhelper_mmx.cpp +++ b/src/gui/painting/qdrawhelper_mmx.cpp @@ -77,7 +77,7 @@ CompositionFunction qt_functionForMode_MMX[numCompositionFunctions] = { comp_func_DestinationOver, comp_func_Clear, comp_func_Source, - 0, + comp_func_Destination, comp_func_SourceIn, comp_func_DestinationIn, comp_func_SourceOut, @@ -85,6 +85,27 @@ CompositionFunction qt_functionForMode_MMX[numCompositionFunctions] = { comp_func_SourceAtop, comp_func_DestinationAtop, comp_func_XOR, + comp_func_Plus, + comp_func_Multiply, + comp_func_Screen, + comp_func_Overlay, + comp_func_Darken, + comp_func_Lighten, + comp_func_ColorDodge, + comp_func_ColorBurn, + comp_func_HardLight, + comp_func_SoftLight, + comp_func_Difference, + comp_func_Exclusion, + rasterop_SourceOrDestination, + rasterop_SourceAndDestination, + rasterop_SourceXorDestination, + rasterop_NotSourceAndNotDestination, + rasterop_NotSourceOrNotDestination, + rasterop_NotSourceXorDestination, + rasterop_NotSource, + rasterop_NotSourceAndDestination, + rasterop_SourceAndNotDestination }; void qt_blend_color_argb_mmx(int count, const QSpan *spans, void *userData) diff --git a/src/gui/painting/qdrawhelper_mmx3dnow.cpp b/src/gui/painting/qdrawhelper_mmx3dnow.cpp index 8bffaa7..b1e81fc 100644 --- a/src/gui/painting/qdrawhelper_mmx3dnow.cpp +++ b/src/gui/painting/qdrawhelper_mmx3dnow.cpp @@ -85,14 +85,35 @@ CompositionFunction qt_functionForMode_MMX3DNOW[numCompositionFunctions] = { comp_func_DestinationOver, comp_func_Clear, comp_func_Source, - 0, + comp_func_Destination, comp_func_SourceIn, comp_func_DestinationIn, comp_func_SourceOut, comp_func_DestinationOut, comp_func_SourceAtop, comp_func_DestinationAtop, - comp_func_XOR + comp_func_XOR, + comp_func_Plus, + comp_func_Multiply, + comp_func_Screen, + comp_func_Overlay, + comp_func_Darken, + comp_func_Lighten, + comp_func_ColorDodge, + comp_func_ColorBurn, + comp_func_HardLight, + comp_func_SoftLight, + comp_func_Difference, + comp_func_Exclusion, + rasterop_SourceOrDestination, + rasterop_SourceAndDestination, + rasterop_SourceXorDestination, + rasterop_NotSourceAndNotDestination, + rasterop_NotSourceOrNotDestination, + rasterop_NotSourceXorDestination, + rasterop_NotSource, + rasterop_NotSourceAndDestination, + rasterop_SourceAndNotDestination }; void qt_blend_color_argb_mmx3dnow(int count, const QSpan *spans, void *userData) diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 97c78bb..eec6bf4 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1945,6 +1945,41 @@ const uint qt_bayer_matrix[16][16] = { ((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff) +// prototypes of all the composition functions +void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha); +void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint); +void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL rasterop_SourceOrDestination(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL rasterop_SourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL rasterop_SourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha); +void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha); + QT_END_NAMESPACE #endif // QDRAWHELPER_P_H diff --git a/src/gui/painting/qdrawhelper_sse.cpp b/src/gui/painting/qdrawhelper_sse.cpp index 58a7fdd..8b17c29 100644 --- a/src/gui/painting/qdrawhelper_sse.cpp +++ b/src/gui/painting/qdrawhelper_sse.cpp @@ -77,14 +77,35 @@ CompositionFunction qt_functionForMode_SSE[numCompositionFunctions] = { comp_func_DestinationOver, comp_func_Clear, comp_func_Source, - 0, + comp_func_Destination, comp_func_SourceIn, comp_func_DestinationIn, comp_func_SourceOut, comp_func_DestinationOut, comp_func_SourceAtop, comp_func_DestinationAtop, - comp_func_XOR + comp_func_XOR, + comp_func_Plus, + comp_func_Multiply, + comp_func_Screen, + comp_func_Overlay, + comp_func_Darken, + comp_func_Lighten, + comp_func_ColorDodge, + comp_func_ColorBurn, + comp_func_HardLight, + comp_func_SoftLight, + comp_func_Difference, + comp_func_Exclusion, + rasterop_SourceOrDestination, + rasterop_SourceAndDestination, + rasterop_SourceXorDestination, + rasterop_NotSourceAndNotDestination, + rasterop_NotSourceOrNotDestination, + rasterop_NotSourceXorDestination, + rasterop_NotSource, + rasterop_NotSourceAndDestination, + rasterop_SourceAndNotDestination }; void qt_blend_color_argb_sse(int count, const QSpan *spans, void *userData) diff --git a/src/gui/painting/qdrawhelper_sse3dnow.cpp b/src/gui/painting/qdrawhelper_sse3dnow.cpp index c58cf13..9ae0e07 100644 --- a/src/gui/painting/qdrawhelper_sse3dnow.cpp +++ b/src/gui/painting/qdrawhelper_sse3dnow.cpp @@ -85,14 +85,35 @@ CompositionFunction qt_functionForMode_SSE3DNOW[numCompositionFunctions] = { comp_func_DestinationOver, comp_func_Clear, comp_func_Source, - 0, + comp_func_Destination, comp_func_SourceIn, comp_func_DestinationIn, comp_func_SourceOut, comp_func_DestinationOut, comp_func_SourceAtop, comp_func_DestinationAtop, - comp_func_XOR + comp_func_XOR, + comp_func_Plus, + comp_func_Multiply, + comp_func_Screen, + comp_func_Overlay, + comp_func_Darken, + comp_func_Lighten, + comp_func_ColorDodge, + comp_func_ColorBurn, + comp_func_HardLight, + comp_func_SoftLight, + comp_func_Difference, + comp_func_Exclusion, + rasterop_SourceOrDestination, + rasterop_SourceAndDestination, + rasterop_SourceXorDestination, + rasterop_NotSourceAndNotDestination, + rasterop_NotSourceOrNotDestination, + rasterop_NotSourceXorDestination, + rasterop_NotSource, + rasterop_NotSourceAndDestination, + rasterop_SourceAndNotDestination }; void qt_blend_color_argb_sse3dnow(int count, const QSpan *spans, void *userData) -- cgit v0.12 From 34beae57ff8248e7666a4ce08a06eeff54e05e7a Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 26 Jul 2010 17:14:13 +0200 Subject: Implement the composition mode "Plus" with SSE2 Implement the composition function for CompositionMode_Plus with SSE2. The macro MIX() can be replaced by a single instruction add-saturate, which increase the speed a lot (13 times faster on the blend benchmark). Reviewed-by: Olivier Goffart Reviewed-by: Andreas Kling --- src/gui/painting/qdrawhelper.cpp | 8 ++--- src/gui/painting/qdrawhelper_p.h | 5 +++ src/gui/painting/qdrawhelper_sse2.cpp | 66 +++++++++++++++++++++++++++++++++++ tests/auto/qpainter/tst_qpainter.cpp | 24 ++++++++++--- 4 files changed, 94 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index a77c379..4ce2bee 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1715,11 +1715,6 @@ void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint con } } -static const uint AMASK = 0xff000000; -static const uint RMASK = 0x00ff0000; -static const uint GMASK = 0x0000ff00; -static const uint BMASK = 0x000000ff; - struct QFullCoverage { inline void store(uint *dest, const uint src) const { @@ -7775,6 +7770,7 @@ void qInitDrawhelperAsm() #ifdef QT_HAVE_MMX if (features & MMX) { functionForModeAsm = qt_functionForMode_MMX; + functionForModeSolidAsm = qt_functionForModeSolid_MMX; qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_mmx; #ifdef QT_HAVE_3DNOW @@ -7823,8 +7819,10 @@ void qInitDrawhelperAsm() int length, uint const_alpha); extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha); + extern void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha); functionForModeAsm[0] = comp_func_SourceOver_sse2; + functionForModeAsm[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2; functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2; extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index eec6bf4..1a87127 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -91,6 +91,11 @@ QT_BEGIN_NAMESPACE # define Q_STATIC_INLINE_FUNCTION static inline #endif +static const uint AMASK = 0xff000000; +static const uint RMASK = 0x00ff0000; +static const uint GMASK = 0x0000ff00; +static const uint BMASK = 0x000000ff; + /******************************************************************************* * QSpan * diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 279f685..b4ef23e 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -164,6 +164,72 @@ void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixe } } +inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha) +{ +#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) + const int result = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); +#undef MIX + return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha); +} + +inline int comp_func_Plus_one_pixel(uint d, const uint s) +{ +#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) + const int result = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); +#undef MIX + return result; +} + +void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha) +{ + int x = 0; + const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast(dst) >> 2) & 0x3)) & 0x3; + const int prologLength = qMin(length, offsetToAlignOn16Bytes); + + if (const_alpha == 255) { + // 1) Prologue: align destination on 16 bytes + for (; x < prologLength; ++x) + dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]); + + // 2) composition with SSE2 + for (; x < length - 3; x += 4) { + const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); + + const __m128i result = _mm_adds_epu8(srcVector, dstVector); + _mm_store_si128((__m128i *)&dst[x], result); + } + + // 3) Epilogue: + for (; x < length; ++x) + dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]); + } else { + const int one_minus_const_alpha = 255 - const_alpha; + const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); + const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha); + + // 1) Prologue: align destination on 16 bytes + for (; x < prologLength; ++x) + dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha); + + const __m128i half = _mm_set1_epi16(0x80); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + // 2) composition with SSE2 + for (; x < length - 3; x += 4) { + const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); + + __m128i result = _mm_adds_epu8(srcVector, dstVector); + INTERPOLATE_PIXEL_255_SSE2(result, result, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half) + _mm_store_si128((__m128i *)&dst[x], result); + } + + // 3) Epilogue: + for (; x < length; ++x) + dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha); + } +} + void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) { if (count < 7) { diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 27ee6e7..f358681 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -4176,14 +4176,18 @@ void tst_QPainter::inactivePainter() p.setWorldTransform(QTransform().scale(0.5, 0.5), true); } -bool testCompositionMode(int src, int dst, int expected, QPainter::CompositionMode op) +bool testCompositionMode(int src, int dst, int expected, QPainter::CompositionMode op, qreal opacity = 1.0) { - QImage actual(1, 1, QImage::Format_ARGB32_Premultiplied); + // The test image needs to be large enough to test SIMD code + const QSize imageSize(100, 100); + + QImage actual(imageSize, QImage::Format_ARGB32_Premultiplied); actual.fill(QColor(dst, dst, dst).rgb()); QPainter p(&actual); p.setCompositionMode(op); - p.fillRect(0, 0, 1, 1, QColor(src, src, src)); + p.setOpacity(opacity); + p.fillRect(QRect(QPoint(), imageSize), QColor(src, src, src)); p.end(); if (qRed(actual.pixel(0, 0)) != expected) { @@ -4191,7 +4195,9 @@ bool testCompositionMode(int src, int dst, int expected, QPainter::CompositionMo src, dst, qRed(actual.pixel(0, 0)), expected); return false; } else { - return true; + QImage refImage(imageSize, QImage::Format_ARGB32_Premultiplied); + refImage.fill(QColor(expected, expected, expected).rgb()); + return actual == refImage; } } @@ -4206,6 +4212,16 @@ void tst_QPainter::extendedBlendModes() QVERIFY(testCompositionMode( 0, 255, 255, QPainter::CompositionMode_Plus)); QVERIFY(testCompositionMode(128, 128, 255, QPainter::CompositionMode_Plus)); + QVERIFY(testCompositionMode(255, 255, 255, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(127, 128, 165, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(127, 0, 37, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode( 0, 127, 127, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(255, 0, 75, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode( 0, 255, 255, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(128, 128, 166, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(186, 200, 255, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(255, 255, 255, QPainter::CompositionMode_Multiply)); QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_Multiply)); QVERIFY(testCompositionMode(127, 255, 127, QPainter::CompositionMode_Multiply)); -- cgit v0.12 From 47857453767a0ec2c7b75a555658dd166bd7d3d4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 27 Jul 2010 10:23:46 +0200 Subject: QScriptValue::objectId(): do not assert if the value is not a cell JSC::JSValue::asCell asserts if it is not a cell Reviewed-by: Jedrzej Nowacki --- src/script/api/qscriptvalue_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 853c6c8..8f286db 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -103,7 +103,7 @@ public: qint64 objectId() { - if ( (type == JavaScriptCore) && (engine) ) + if ( (type == JavaScriptCore) && (engine) && jscValue.isCell() ) return (qint64)jscValue.asCell(); else return -1; -- cgit v0.12 From 39097c5d652efd3eb0946e5a215d82573a46dbf9 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 27 Jul 2010 10:28:30 +0200 Subject: QScriptDeclarativeObject: we need to save the current stack pointer. in DeclarativeObjectDelegate::put, else we cannot get a proper backtrace in the debugger. Reviewed-by: Kent Hansen --- src/script/bridge/qscriptdeclarativeobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/bridge/qscriptdeclarativeobject.cpp b/src/script/bridge/qscriptdeclarativeobject.cpp index 6e08b83..f330ac0 100644 --- a/src/script/bridge/qscriptdeclarativeobject.cpp +++ b/src/script/bridge/qscriptdeclarativeobject.cpp @@ -88,6 +88,7 @@ void DeclarativeObjectDelegate::put(QScriptObject* object, JSC::ExecState *exec, JSC::JSValue value, JSC::PutPropertySlot &slot) { QScriptEnginePrivate *engine = scriptEngineFromExec(exec); + QScript::SaveFrameHelper saveFrame(engine, exec); QScriptDeclarativeClass::Identifier identifier = (void *)propertyName.ustring().rep(); QScriptDeclarativeClassPrivate *p = QScriptDeclarativeClassPrivate::get(m_class); @@ -144,7 +145,7 @@ JSC::JSValue DeclarativeObjectDelegate::call(JSC::ExecState *exec, JSC::JSObject QScriptDeclarativeClass *scriptClass = static_cast(delegate)->m_class; QScriptEnginePrivate *eng_p = scriptEngineFromExec(exec); - JSC::ExecState *oldFrame = eng_p->currentFrame; + QScript::SaveFrameHelper saveFrame(eng_p, exec); eng_p->pushContext(exec, thisValue, args, callee); QScriptContext *ctxt = eng_p->contextForFrame(eng_p->currentFrame); @@ -153,7 +154,6 @@ JSC::JSValue DeclarativeObjectDelegate::call(JSC::ExecState *exec, JSC::JSObject scriptClass->call(static_cast(delegate)->m_object, ctxt); eng_p->popContext(); - eng_p->currentFrame = oldFrame; return (JSC::JSValue &)(result); } -- cgit v0.12 From ab7c405ac2e528eb23b2c56ef02bd33c42bc3256 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 27 Jul 2010 10:31:21 +0200 Subject: QScriptEngineAgent: recompile all the function when installing a debugger. Recompile all the function is necessary to ger the debug opcode that notifies us when the position changes. The change in CollectorHeapIterator.h is nessesary to get it work as Debugger::recompileAllJSFunctions uses LiveObjectIterator, LiveObjectIterator initialied m_cell to -1 and to ++(*this) in its constructor. But as m_cell is of type size_t (unsigned) then the < comparison will always fail as it is an unsigned comparison. This was already fixed upstream in r54672 Reviewed-by: Jedrzej Nowacki --- .../JavaScriptCore/runtime/CollectorHeapIterator.h | 10 ++--- src/script/api/qscriptengine.cpp | 1 + src/script/api/qscriptengineagent.cpp | 2 + .../qscriptengineagent/tst_qscriptengineagent.cpp | 51 ++++++++++++++++++++++ 4 files changed, 58 insertions(+), 6 deletions(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/CollectorHeapIterator.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/CollectorHeapIterator.h index e4f2f91..4a38df9 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/CollectorHeapIterator.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/CollectorHeapIterator.h @@ -97,14 +97,12 @@ namespace JSC { inline LiveObjectIterator& LiveObjectIterator::operator++() { - if (m_block < m_heap.nextBlock || m_cell < m_heap.nextCell) { - advance(HeapConstants::cellsPerBlock); + advance(HeapConstants::cellsPerBlock - 1); + if (m_block < m_heap.nextBlock || (m_block == m_heap.nextBlock && m_cell < m_heap.nextCell)) return *this; - } - do { - advance(HeapConstants::cellsPerBlock); - } while (m_block < m_heap.usedBlocks && !m_heap.blocks[m_block]->marked.get(m_cell)); + while (m_block < m_heap.usedBlocks && !m_heap.blocks[m_block]->marked.get(m_cell)) + advance(HeapConstants::cellsPerBlock - 1); return *this; } diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 7bccffe..26673f4 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -4196,6 +4196,7 @@ void QScriptEngine::setAgent(QScriptEngineAgent *agent) "cannot set agent belonging to different engine"); return; } + QScript::APIShim shim(d); if (d->activeAgent) QScriptEngineAgentPrivate::get(d->activeAgent)->detach(); d->activeAgent = agent; diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index 0b5828a..c3d1566 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -117,6 +117,8 @@ void QScriptEngineAgentPrivate::attach() if (engine->originalGlobalObject()->debugger()) engine->originalGlobalObject()->setDebugger(0); JSC::Debugger::attach(engine->originalGlobalObject()); + if (!QScriptEnginePrivate::get(engine)->isEvaluating()) + JSC::Debugger::recompileAllJSFunctions(engine->globalData); } void QScriptEngineAgentPrivate::detach() diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index ed00b96..c30a636 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -97,6 +97,7 @@ private slots: void functionEntryAndExit_objectCall(); void positionChange_1(); void positionChange_2(); + void positionChange_3(); void exceptionThrowAndCatch(); void eventOrder_assigment(); void eventOrder_functionDefinition(); @@ -1625,6 +1626,56 @@ void tst_QScriptEngineAgent::positionChange_2() delete spy; } +void tst_QScriptEngineAgent::positionChange_3() +{ + QScriptEngine eng; + eng.evaluate("function some_function1(a) {\n a++; \n return a + 12; } \n some_function1(42);", "function1.qs", 12); + QScriptValue some_function2 = eng.evaluate("(function (b) {\n b--; \n return b + 11; })", "function2.qs", 21); + some_function2.call(QScriptValue(), QScriptValueList() << 2 ); + + // Test that the agent work, even if installed after the function has been evaluated. + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng, ~(ScriptEngineSpy::IgnorePositionChange)); + { + spy->clear(); + QScriptValue v = eng.evaluate("some_function1(15)"); + QCOMPARE(v.toInt32(), (15+1+12)); + QCOMPARE(spy->count(), 3); + + // some_function1() + QCOMPARE(spy->at(0).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(0).scriptId != -1); + QCOMPARE(spy->at(0).lineNumber, 1); + + // a++ + QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(1).scriptId != spy->at(0).scriptId); + QCOMPARE(spy->at(1).lineNumber, 13); + // return a + 12 + QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(2).scriptId == spy->at(1).scriptId); + QCOMPARE(spy->at(2).lineNumber, 14); + } + + { + spy->clear(); + QScriptValue v = some_function2.call(QScriptValue(), QScriptValueList() << 89 ); + QCOMPARE(v.toInt32(), (89-1+11)); + QCOMPARE(spy->count(), 2); + + // b-- + QCOMPARE(spy->at(0).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(0).scriptId != -1); + QCOMPARE(spy->at(0).lineNumber, 22); + // return b + 11 + QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(1).scriptId == spy->at(0).scriptId); + QCOMPARE(spy->at(1).lineNumber, 23); + } + + QVERIFY(!eng.hasUncaughtException()); +} + + void tst_QScriptEngineAgent::exceptionThrowAndCatch() { QScriptEngine eng; -- cgit v0.12 From b932141c7d59eaee5ae72c914d7fc7078b0a3608 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 27 Jul 2010 12:52:13 +0200 Subject: Remove an useless assert from comp_func_SourceOver_sse2() The assert can never be true since const_alpha is unsigned. That line was triggering a warning on GCC. Reviewed-by: Olivier Goffart --- src/gui/painting/qdrawhelper_sse2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index b4ef23e..e090ae5 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -145,7 +145,6 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha) { - Q_ASSERT(const_alpha >= 0); Q_ASSERT(const_alpha < 256); const quint32 *src = (const quint32 *) srcPixels; -- cgit v0.12 From a62045401cc8f55c3175a2b33e8f43b356604f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 27 Jul 2010 15:16:15 +0200 Subject: Don't run the QGL test on systems that does not have GL support. On a Mac that has no screens connected, it is possible to create offscreen GL contexts, but not normal QGLWidgets. There are some assumptions both in the tests and in the QGL module that this if you can create one of them, you can create both. The test now check if it can create a valid QGLWidget, if it can't it will skip running all the QGL tests. Task-number: QTBUG-12138 Reviewed-by: Prasanth --- tests/auto/qgl/tst_qgl.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 8ee494f..7fe461c 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -2252,5 +2252,30 @@ void tst_QGL::textureCleanup() #endif } -QTEST_MAIN(tst_QGL) +class tst_QGLDummy : public QObject +{ +Q_OBJECT + +public: + tst_QGLDummy() {} + +private slots: + void qglSkipTests() { + QSKIP("QGL not supported on this system.", SkipAll); + } +}; + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QTEST_DISABLE_KEYPAD_NAVIGATION \ + QGLWidget glWidget; + if (!glWidget.isValid()) { + tst_QGLDummy tc; + return QTest::qExec(&tc, argc, argv); + } + tst_QGL tc; + return QTest::qExec(&tc, argc, argv); +} + #include "tst_qgl.moc" -- cgit v0.12