﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
17119	[Patch] Improve rendering time of partly visible complex shapes	GerdP	team	"==== What steps will reproduce the problem?
1. Load relation 7379046 (6471 Members)
2. Zoom to node 2576979853
3. Use Download in current view
4. Try to edit

==== What is the expected result?
Nothing special, editing should be possible
==== What happens instead?
Extreme slow reaction, CPU is near 100% when moving the mouse.
==== Please provide any additional information below. Attach a screenshot if possible.
Problem is that the complete outer ring of the multipolygon is passed to `java.awt.Graphics2D.clip(Shape s)` each time you move the mouse. I've noticed this while working on #17095.
The attached patch clips the polygon with the rather simple Sutherland-Hodgman algorithm before using `Graphics2D.clip()`. As a result, the reaction is much faster, though still not without any delay. 
In the new ShapeClipper class I've copied source that I wrote for the mkgmap project years ago.
The code might as well go into class Geometry.

{{{
Build-Date:2018-12-17 19:37:47
Revision:14573
Is-Local-Build:true

Identification: JOSM/1.5 (14573 SVN en) Windows 10 64-Bit
OS Build number: Windows 10 Home 1803 (17134)
Memory Usage: 1639 MB / 1753 MB (523 MB allocated, but free)
Java version: 1.8.0_191-b12, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Screen: \Display0 1920x1080
Maximum Screen Size: 1920x1080
VM arguments: [-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:50636, -ea, -Dfile.encoding=UTF-8]
Program arguments: [--debug]
Dataset consistency test: No problems found

Plugins:
+ OpeningHoursEditor (34535)
+ apache-commons (34506)
+ buildings_tools (34724)
+ download_along (34503)
+ ejml (34389)
+ geotools (34513)
+ jaxb (34506)
+ jts (34524)
+ o5m (34405)
+ opendata (34698)
+ pbf (34576)
+ poly (34546)
+ reverter (34552)
+ utilsplugin2 (34780)

Last errors/warnings:
- W: Update plugins - org.openstreetmap.josm.plugins.PluginHandler$UpdatePluginsMessagePanel[,0,0,0x0,invalid,layout=java.awt.GridBagLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]
- W: No configuration settings found.  Using hardcoded default values for all pools.
- W: Cannot start IPv4 remotecontrol https server on port 8112: Keystore was tampered with, or password was incorrect
- W: Cannot start IPv6 remotecontrol https server on port 8112: Keystore was tampered with, or password was incorrect
- E: Invalid Bounds: Bounds[0.0,0.0,0.0,0.0]
}}}
"	enhancement	closed	normal	18.12	Core mappaint		fixed	template_report performance	
