Bug 575553

Summary: [performance] cache CTabFolder backgroundImage bounds
Product: [Eclipse Project] Platform Reporter: Jörg Kubitz <jkubitz-eclipse>
Component: SWTAssignee: Jörg Kubitz <jkubitz-eclipse>
Status: RESOLVED FIXED QA Contact: Niraj Modi <niraj.modi>
Severity: enhancement    
Priority: P3 CC: Lars.Vogel, niraj.modi, rolf.theunissen
Version: 4.21Keywords: performance
Target Milestone: 4.21 RC1   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184288
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=584fc122be5067521f2ce395e5e0b049eefb8f55
https://bugs.eclipse.org/bugs/show_bug.cgi?id=575873
Whiteboard:
Bug Depends on: 576287    
Bug Blocks: 575658, 574015    

Description Jörg Kubitz CLA 2021-08-21 15:25:47 EDT
When i resize eclipse window the repaint feels rather slow.
As far as i see one reason is that the CTabFolder backgroundimages are disposed and recreated (involving drawing an image and the new costly disposetracking). Why would you do so? The background doesnt change.
There is already a check in setButtonBounds() if updateBkImages() needs to be called but it fails to detect that the background was only moved but did not realy change.

Well, lets cache the old size and only repaint if changed.
Comment 1 Eclipse Genie CLA 2021-08-21 15:32:51 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184288
Comment 3 Niraj Modi CLA 2021-08-24 04:06:38 EDT
(In reply to Eclipse Genie from comment #2)
> Gerrit change
> https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184288 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=584fc122be5067521f2ce395e5e0b049eefb8f55

Thanks Joerg for the fix, resolving now.
Comment 4 Jörg Kubitz CLA 2021-08-24 04:16:01 EDT
Thanks for review, Niraj!
Comment 5 Lars Vogel CLA 2021-08-24 05:43:41 EDT
Thanks, Jörg.
Comment 6 Rolf Theunissen CLA 2021-12-31 10:16:29 EST
This change causes a regression, see Bug 576287.

Furthermore, it creates regressions for horizontal gradients, i.e. the background should be updated when the width changes. However, the background images for horizontal gradients are broken anyhow. You can use the snippet in Bug 576287 with horizontal gradient to test.