diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-11-04 14:57:33 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-11-05 09:19:31 (GMT) |
commit | a12b1538df45268f2a66ec55856ffeeb131eb751 (patch) | |
tree | ed6bfae36ddf31d7976d8a6bc2d08f95ff98fc6d /src/gui/painting | |
parent | b91f1a2f749586014e8b28c6766015ff6ba62ee7 (diff) | |
download | Qt-a12b1538df45268f2a66ec55856ffeeb131eb751.zip Qt-a12b1538df45268f2a66ec55856ffeeb131eb751.tar.gz Qt-a12b1538df45268f2a66ec55856ffeeb131eb751.tar.bz2 |
Fixed soft-light composition mode in raster and OpenGL1.
Updated the soft-light composition mode implementation in the raster
and OpenGL1 engines to use the equations in the SVG specification as of
April 2009.
Task-number: QTBUG-3193
Reviewed-by: Trond
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 41602a1..4df7f8a 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2386,12 +2386,12 @@ static void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int len } /* - if 2.Sca < Sa - Dca' = Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa) - otherwise if 8.Dca <= Da - Dca' = Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa).(3 - 8.Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) - otherwise - Dca' = (Dca.Sa + ((Dca/Da)^(0.5).Da - Dca).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa) + if 2.Sca <= Sa + Dca' = Dca.(Sa + (2.Sca - Sa).(1 - Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) + otherwise if 2.Sca > Sa and 4.Dca <= Da + Dca' = Dca.Sa + Da.(2.Sca - Sa).(4.Dca/Da.(4.Dca/Da + 1).(Dca/Da - 1) + 7.Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) + otherwise if 2.Sca > Sa and 4.Dca > Da + Dca' = Dca.Sa + Da.(2.Sca - Sa).((Dca/Da)^0.5 - Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) */ static inline int soft_light_op(int dst, int src, int da, int sa) { @@ -2400,13 +2400,11 @@ static inline int soft_light_op(int dst, int src, int da, int sa) const int temp = (src * (255 - da) + dst * (255 - sa)) * 255; if (src2 < sa) - return (dst * ((sa * 255) - (255 - dst_np) * (src2 - sa)) + temp) / 65025; - else if (8 * dst <= da) - return (dst * ((sa * 255) - ((255 - dst_np) * (src2 - sa) * ((3 * 255) - 8 * dst_np)) / 255) + temp) / 65025; + return (dst * (sa * 255 + (src2 - sa) * (255 - dst_np)) + temp) / 65025; + else if (4 * dst <= da) + return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; else { - // sqrt is too expensive to do three times per pixel, so skipping it for now - // a future possibility is to use a LUT - return ((dst * sa * 255) + (int(dst_np) * da - (dst * 255)) * (src2 - sa) + temp) / 65025; + return (dst * sa * 255 + da * (src2 - sa) * (int(sqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; } } |