diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2012-11-09 15:41:08 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-09 16:11:48 +0100 |
commit | e5eeffbf8b286fd80a1c3b66c80692cbec4fa72e (patch) | |
tree | e00d12c6ec06b74526366fb2ca25c6a02e528c26 | |
parent | d91c1422a9d0b96172fb13da5a179688b590d125 (diff) |
Mac: More accurate focus mask
Small artifacts were visible when tabing in and out QLineEdits several times.
Change-Id: I56334e0534c67c94d357e3517d2470adcc1d8a1c
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 901208a342..3f7d2c8ed9 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2585,10 +2585,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w srow = sptr+((y*sbpl)/4); drow = dptr+((y*dbpl)/4); for (int x = 0; x < w; ++x) { - const int diff = (((qRed(*srow)-fillR)*(qRed(*srow)-fillR)) + - ((qGreen(*srow)-fillG)*((qGreen(*srow)-fillG))) + - ((qBlue(*srow)-fillB)*((qBlue(*srow)-fillB)))); - (*drow++) = (diff < 100) ? 0xffffffff : 0xff000000; + const int redDiff = qRed(*srow) - fillR; + const int greenDiff = qGreen(*srow) - fillG; + const int blueDiff = qBlue(*srow) - fillB; + const int diff = (redDiff * redDiff) + (greenDiff * greenDiff) + (blueDiff * blueDiff); + (*drow++) = (diff < 10) ? 0xffffffff : 0xff000000; ++srow; } } |