https://bugs.kde.org/show_bug.cgi?id=432936

            Bug ID: 432936
           Summary: Performance issue related to KoDualColorButton
           Product: krita
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Color Selectors
          Assignee: krita-bugs-n...@kde.org
          Reporter: grum...@grum.fr
  Target Milestone: ---

SUMMARY

All details about this problem is available on krita-artist here:
https://krita-artists.org/t/setforegroundcolor-execution-speed/18714?u=grum999

In synthesis, there's a problem with the KoDualColorButton widget.

When button is visible in toolbar:
- Advanced Color Selector is laggy
- PyKrita calls to setForeGroundColor() and setBackGroundColor() are very slow


The problem seems to be related to current main window size:
- not "visible" on a FullHD monitor
- clearly performances killer on a 4K monitor

STEPS TO REPRODUCE
1. Create open a document
2. Execute following script:
# ---------------------------------------------------
from krita import *
import time

av=Krita.instance().activeWindow().activeView()
color=QColor(Qt.black)

ts=time.time()
for i in range(255):
    color.setRed(i)
    mc=ManagedColor.fromQColor(color, av.canvas())
    av.setForeGroundColor(mc)
print(time.time()-ts)
# ---------------------------------------------------


OBSERVED RESULT
With button in toolbar:
+---------------------+------------------------------+----------------+
| Krita’s window size | Advanced color selector size | Execution time |
+---------------------+------------------------------+----------------+
| 454x352             | None                         | ~0.50s         | 
| 454x352             | 100x40                       | ~0.65s         |
| 1920x1080           | None                         | ~0.73s         |
| 1920x1080           | 100x40                       | ~0.90s         |
| 1920x1080           | 1570x875                     | ~5.90s         |
| 3840x2094           | None                         | ~10.90s        |
| 3840x2094           | 100x40                       | ~12.00s        |
| 3840x2094           | 3494x1885                    | ~164.00s       |
+---------------------+------------------------------+----------------+
Note: by None, I mean deactivated in settings + removed from docker


Without button in toolbar (removed from toolbar or removed toolbar):
All case are ~0.5s


EXPECTED RESULT
Setting color should be fast in all case 




SOFTWARE/OS VERSIONS
Windows: not tested
macOS: not tested
Linux/KDE Plasma: Debian 10
Qt Version: 5.11 & 5.12

ADDITIONAL INFORMATION
In
https://invent.kde.org/graphics/krita/-/blob/master/libs/ui/widgets/KoDualColorButton.cpp
Methods:
- KoDualColorButton::setForegroundColor()
- KoDualColorButton::setBackgroundColor()

Replace call to repaint() method with update()
==> Seems to fix the problem, execution time is ~0.5s in all case

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to