RFR: 8283063: Optimize Observable{List/Set/Map}Wrapper.retainAll/removeAll

2022-03-11 Thread Michael Strauß
`Observable{List/Set/Map}Wrapper.retainAll/removeAll` can be optimized for some 
edge cases.

1. `removeAll(c)`:
This is a no-op if 'c' is empty.
For `ObservableListWrapper`, returning early skips an object allocation. For 
`ObservableSetWrapper` and `ObservableMapWrapper`, returning early prevents an 
enumeration of the entire collection.

2. `retainAll(c)`:
This is a no-op if the backing collection is empty, or equivalent to `clear()` 
if `c` is empty.

I've added some tests to verify the optimized behavior for each of the three 
classes.

-

Commit messages:
 - Optimize removeAll/retainAll for Observable{List/Set/Map}Wrapper
 - Failing test

Changes: https://git.openjdk.java.net/jfx/pull/751/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx=751=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8283063
  Stats: 293 lines in 6 files changed: 290 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jfx/pull/751.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/751/head:pull/751

PR: https://git.openjdk.java.net/jfx/pull/751


Re: RFR: 8282703: Axis is not cached in the LinuxTouchTransform class

2022-03-11 Thread Kevin Rushforth
On Fri, 11 Mar 2022 15:20:17 GMT, chilliger  wrote:

> Did I miss something? Is touch now support with GTK? I thought the 
> implementation is missing for GTK

This PR is for Monocle, which is not used for desktop Linux (it's for embedded 
systems like Raspberry Pi).

-

PR: https://git.openjdk.java.net/jfx/pull/747


Re: RFR: 8282703: Axis is not cached in the LinuxTouchTransform class

2022-03-11 Thread chilliger
On Sat, 5 Mar 2022 15:53:52 GMT, Alexander Scherbatiy  
wrote:

> An axis is not cached in the LinuxTouchTransform class.
> 
> To reproduce the issue I added `System.out.printf("initTransform: axis: %d, 
> index: %d%n", axis, index);` log to the LinuxTouchTransform.initTransform() 
> method:
> https://github.com/openjdk/jfx/blob/5112be957be70dd6521e6fb6ee64e669c148729c/modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/LinuxTouchTransform.java#L117
> run the 
> [JFXButtonExample](https://bugs.openjdk.java.net/secure/attachment/98181/JFXButtonExample.java)
>  sample and tapped the touch screen on a Raspberry Pi with Touchscreen.
> 
> The result was
> 
> initTransform: axis: 47, index: 0
> initTransform: axis: 57, index: 0
> initTransform: axis: 53, index: 0
> initTransform: axis: 54, index: 0
> initTransform: axis: 0, index: 0
> initTransform: axis: 1, index: 0
> initTransform: axis: 53, index: 0
> initTransform: axis: 54, index: 0
> initTransform: axis: 0, index: 0
> initTransform: axis: 1, index: 0
> initTransform: axis: 53, index: 0
> initTransform: axis: 54, index: 0
> initTransform: axis: 0, index: 0
> initTransform: axis: 1, index: 0
> 
> The initTransform() is called several times for axis 0,1,47,53,54 and index 
> is always set to zero.
> 
> The straight forward fix is to store the given axis in the axes array: 
> "axes[index] = axis". This is the first commit for the current fix.
> Using this fix the output with printf from initTransform() method looks like:
> 
> initTransform: axis: 47, index: 0
> initTransform: axis: 57, index: 1
> initTransform: axis: 53, index: 2
> initTransform: axis: 54, index: 4
> initTransform: axis: 1, index: 5
> 
> Now all axes are printed only once and the index value is different for each 
> axes.
> 
> However, the minimum/maximum values are retrieved and cached for ABS_X/Y and 
> ABS_MT_POSITION_X/Y axes after the fist tap on the screen.
> The second commit improves this moving the ABS_X/Y and ABS_MT_POSITION_X/Y 
> axes initialization into the LinuxTouchTransform constructor.
> 
> Now the touch logs look like:
> 
> // LinuxTouchTransform constructor
> // device: /dev/input/mouse0
> initTransform: axis: 0, index: 0
> initTransform: axis: 1, index: 1
> initTransform: axis: 53, index: 2
> initTransform: axis: 54, index: 3
> 
> // LinuxTouchTransform constructor
> // device: /dev/input/event2
> initTransform: axis: 0, index: 0
> initTransform: axis: 1, index: 1
> initTransform: axis: 53, index: 2
> initTransform: axis: 54, index: 3
> 
> // the first tap
> initTransform: axis: 57, index: 4
> initTransform: axis: 47, index: 5
> 
> 
> The ABS_X/Y and ABS_MT_POSITION_X/Y axes and corresponding minimum/maximum 
> values are initialized in the constructor. The other axes which stores only 
> default values in translates and scalars arrays are initialized during touch 
> events.

@AlexanderScherbatiy Did I miss something? Is touch now support with GTK? I 
thought the implementation is missing for GTK: 
https://github.com/openjdk/jfx/pull/457

-

PR: https://git.openjdk.java.net/jfx/pull/747


Re: RFR: 8282093: LineChart path incorrect when outside lower bound [v2]

2022-03-11 Thread Ajit Ghaisas
On Tue, 1 Mar 2022 06:12:59 GMT, Abhinay Agarwal  wrote:

>> This regression was caused in PR #667 in which I didn't take into account 
>> the lower bounds. I have added more tests and one manual test along with the 
>> fix. The manual test can be used to identify any future issues with paths 
>> outside lower and upper bounds easily.
>
> Abhinay Agarwal has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Improve layout in manual test

Thanks for fixing this regression. Changes look good.

-

Marked as reviewed by aghaisas (Reviewer).

PR: https://git.openjdk.java.net/jfx/pull/744