Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 12454)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 12455)
@@ -655,12 +655,9 @@
         }
 
-        double startOffset = phase % repeat;
-        if (startOffset < 0) {
-            startOffset += repeat;
-        }
+        double startOffset = computeStartOffset(phase, repeat);
 
         BufferedImage image = pattern.getImage(disabled);
 
-        path.visitClippedLine(startOffset, repeat, (inLineOffset, start, end, startIsOldEnd) -> {
+        path.visitClippedLine(repeat, (inLineOffset, start, end, startIsOldEnd) -> {
             final double segmentLength = start.distanceToInView(end);
             if (segmentLength < 0.1) {
@@ -679,5 +676,5 @@
 
             // The start of the next image
-            double imageStart = -(inLineOffset % repeat);
+            double imageStart = -((inLineOffset + startOffset) % repeat);
 
             while (imageStart < segmentLength) {
@@ -691,4 +688,12 @@
             g.setTransform(saveTransform);
         });
+    }
+
+    private static double computeStartOffset(double phase, final double repeat) {
+        double startOffset = phase % repeat;
+        if (startOffset < 0) {
+            startOffset += repeat;
+        }
+        return startOffset;
     }
 
@@ -1291,5 +1296,5 @@
             double interval = 60;
 
-            path.visitClippedLine(0, 60, (inLineOffset, start, end, startIsOldEnd) -> {
+            path.visitClippedLine(60, (inLineOffset, start, end, startIsOldEnd) -> {
                 double segmentLength = start.distanceToInView(end);
                 if (segmentLength > 0.001) {
Index: /trunk/src/org/openstreetmap/josm/gui/draw/MapViewPath.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/draw/MapViewPath.java	(revision 12454)
+++ /trunk/src/org/openstreetmap/josm/gui/draw/MapViewPath.java	(revision 12455)
@@ -254,7 +254,7 @@
                 length += f;
             }
-            return visitClippedLine(((BasicStroke) stroke).getDashPhase(), length, consumer);
+            return visitClippedLine(length, consumer);
         } else {
-            return visitClippedLine(0, 0, consumer);
+            return visitClippedLine(0, consumer);
         }
     }
@@ -263,12 +263,11 @@
      * Visits all straight segments of this path. The segments are clamped to the view.
      * If they are clamped, the start points are aligned with the pattern.
-     * @param strokeOffset The initial offset of the pattern
-     * @param strokeLength The dash pattern length. 0 to use no pattern.
+     * @param strokeLength The dash pattern length. 0 to use no pattern. Only segments of this length will be removed from the line.
      * @param consumer The consumer to call for each segment
      * @return false if visiting the path failed because there e.g. were non-straight segments.
      * @since 11147
      */
-    public boolean visitClippedLine(double strokeOffset, double strokeLength, PathSegmentConsumer consumer) {
-        return new ClampingPathVisitor(state.getViewClipRectangle(), strokeOffset, strokeLength, consumer)
+    public boolean visitClippedLine(double strokeLength, PathSegmentConsumer consumer) {
+        return new ClampingPathVisitor(state.getViewClipRectangle(), strokeLength, consumer)
             .visit(this);
     }
@@ -400,11 +399,9 @@
          * Create a new {@link ClampingPathVisitor}
          * @param clip View clip rectangle
-         * @param strokeOffset Initial stroke offset
          * @param strokeLength Total length of a stroke sequence
          * @param consumer The consumer to notify of the path segments.
          */
-        ClampingPathVisitor(MapViewRectangle clip, double strokeOffset, double strokeLength, PathSegmentConsumer consumer) {
+        ClampingPathVisitor(MapViewRectangle clip, double strokeLength, PathSegmentConsumer consumer) {
             this.clip = clip;
-            this.strokeProgress = Math.min(strokeLength - strokeOffset, 0);
             this.strokeLength = strokeLength;
             this.consumer = consumer;
Index: /trunk/test/data/renderer/way-repeat-image-clamp/data.osm
===================================================================
--- /trunk/test/data/renderer/way-repeat-image-clamp/data.osm	(revision 12455)
+++ /trunk/test/data/renderer/way-repeat-image-clamp/data.osm	(revision 12455)
@@ -0,0 +1,165 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' upload='never' generator='JOSM'>
+  <node id='-32972' action='modify' lat='-1.1' lon='0.9' />
+  <node id='-32974' action='modify' lat='-1.09' lon='0.8' />
+  <node id='-32976' action='modify' lat='-1.08' lon='0.7' />
+  <node id='-32978' action='modify' lat='-1.07' lon='0.6' />
+  <node id='-32980' action='modify' lat='-1.06' lon='0.5' />
+  <node id='-32982' action='modify' lat='-1.05' lon='0.4' />
+  <node id='-32984' action='modify' lat='2.1' lon='0.9' />
+  <node id='-32986' action='modify' lat='2.11' lon='0.8' />
+  <node id='-32988' action='modify' lat='2.12' lon='0.7' />
+  <node id='-32990' action='modify' lat='2.13' lon='0.6' />
+  <node id='-32992' action='modify' lat='2.14' lon='0.5' />
+  <node id='-32994' action='modify' lat='2.15' lon='0.4' />
+  <node id='-32996' action='modify' lat='0.1' lon='-1.1' />
+  <node id='-32998' action='modify' lat='0.1' lon='0.3' />
+  <node id='-33000' action='modify' lat='0.2' lon='-1.1' />
+  <node id='-33002' action='modify' lat='0.2' lon='0.3' />
+  <node id='-33004' action='modify' lat='0.3' lon='-1.1' />
+  <node id='-33006' action='modify' lat='0.3' lon='0.3' />
+  <node id='-33008' action='modify' lat='0.9934996824' lon='-0.21174218751' />
+  <node id='-33010' action='modify' lat='1.04506908317' lon='-0.18731070987' />
+  <node id='-33012' action='modify' lat='1.09663763724' lon='-0.1194454942' />
+  <node id='-33014' action='modify' lat='1.09663763724' lon='-0.05700949577' />
+  <node id='-33016' action='modify' lat='1.09663763724' lon='0.00814111127' />
+  <node id='-33018' action='modify' lat='1.01792739618' lon='0.07057710969' />
+  <node id='-33020' action='modify' lat='0.93107249265' lon='0.07057710969' />
+  <node id='-33022' action='modify' lat='0.8442154493' lon='0.04614563205' />
+  <node id='-33024' action='modify' lat='0.80621487095' lon='-0.04615106127' />
+  <node id='-33026' action='modify' lat='0.80621487095' lon='-0.14659158046' />
+  <node id='-33028' action='modify' lat='0.85507268992' lon='-0.27689279456' />
+  <node id='-33030' action='modify' lat='1.00978484526' lon='-0.29860966357' />
+  <node id='-33032' action='modify' lat='1.10477996037' lon='-0.2606051428' />
+  <node id='-33034' action='modify' lat='1.17263176973' lon='-0.14930618909' />
+  <node id='-33036' action='modify' lat='1.20248605043' lon='0.03257258891' />
+  <node id='-33038' action='modify' lat='1.10477996037' lon='0.15472997713' />
+  <node id='-33040' action='modify' lat='0.97992865197' lon='0.15744458576' />
+  <node id='-33042' action='modify' lat='0.8252152055' lon='0.15744458576' />
+  <node id='-33044' action='modify' lat='0.72478388736' lon='0.04614563205' />
+  <node id='-33046' action='modify' lat='0.67321016342' lon='-0.11673088557' />
+  <node id='-33048' action='modify' lat='0.71664070576' lon='-0.29318044632' />
+  <node id='-33050' action='modify' lat='0.79264314901' lon='-0.35018722749' />
+  <node id='-33052' action='modify' lat='0.95821488924' lon='-0.40447940003' />
+  <node id='-33054' action='modify' lat='1.12106453953' lon='-0.36918948788' />
+  <node id='-33056' action='modify' lat='1.22148405957' lon='-0.200883753' />
+  <node id='-33058' action='modify' lat='1.26762151842' lon='-0.06515332166' />
+  <node id='-33060' action='modify' lat='1.23776796057' lon='0.15744458576' />
+  <node id='-33062' action='modify' lat='1.10477996037' lon='0.24431206182' />
+  <node id='-33064' action='modify' lat='0.89578706558' lon='0.26059971358' />
+  <node id='-33066' action='modify' lat='0.77907138258' lon='0.24702667045' />
+  <node id='-33068' action='modify' lat='0.58906240901' lon='0.0407164148' />
+  <node id='-33070' action='modify' lat='0.54563080136' lon='-0.18731070987' />
+  <node id='-33072' action='modify' lat='0.59177687351' lon='-0.34204340161' />
+  <node id='-33074' action='modify' lat='0.68135342032' lon='-0.4424839208' />
+  <node id='-33076' action='modify' lat='0.86864419747' lon='-0.5022053106' />
+  <node id='-33078' action='modify' lat='1.05592569263' lon='-0.45605696394' />
+  <node id='-33080' action='modify' lat='1.19705802345' lon='-0.37733331376' />
+  <node id='-33082' action='modify' lat='1.29747473208' lon='-0.28503662044' />
+  <node id='-33084' action='modify' lat='1.32189982704' lon='-0.04615106127' />
+  <node id='-33086' action='modify' lat='1.32189982704' lon='0.12486928223' />
+  <node id='-33088' action='modify' lat='1.2486238391' lon='0.26331432221' />
+  <node id='-33090' action='modify' lat='1.07221053561' lon='0.29588962573' />
+  <node id='-33092' action='modify' lat='0.66506689291' lon='0.28774579985' />
+  <node id='-33094' action='modify' lat='0.49948437527' lon='0.11944006498' />
+  <node id='-33096' action='modify' lat='0.42347780473' lon='-0.07872636479' />
+  <node id='-33098' action='modify' lat='0.44519404964' lon='-0.25517592554' />
+  <node id='-33100' action='modify' lat='0.49405536208' lon='-0.40990861728' />
+  <node id='-33102' action='modify' lat='0.91750121561' lon='0.323035712' />
+  <way id='-33104' action='modify'>
+    <nd ref='-32994' />
+    <nd ref='-32982' />
+    <tag k='pattern' v='A' />
+  </way>
+  <way id='-33106' action='modify'>
+    <nd ref='-32992' />
+    <nd ref='-32980' />
+    <tag k='pattern' v='A' />
+  </way>
+  <way id='-33108' action='modify'>
+    <nd ref='-32990' />
+    <nd ref='-32978' />
+    <tag k='pattern' v='A' />
+  </way>
+  <way id='-33110' action='modify'>
+    <nd ref='-32988' />
+    <nd ref='-32976' />
+    <tag k='pattern' v='A' />
+  </way>
+  <way id='-33112' action='modify'>
+    <nd ref='-32986' />
+    <nd ref='-32974' />
+    <tag k='pattern' v='A' />
+  </way>
+  <way id='-33114' action='modify'>
+    <nd ref='-32984' />
+    <nd ref='-32972' />
+    <tag k='pattern' v='A' />
+  </way>
+  <way id='-33116' action='modify'>
+    <nd ref='-33008' />
+    <nd ref='-33010' />
+    <nd ref='-33012' />
+    <nd ref='-33014' />
+    <nd ref='-33016' />
+    <nd ref='-33018' />
+    <nd ref='-33020' />
+    <nd ref='-33022' />
+    <nd ref='-33024' />
+    <nd ref='-33026' />
+    <nd ref='-33028' />
+    <nd ref='-33030' />
+    <nd ref='-33032' />
+    <nd ref='-33034' />
+    <nd ref='-33036' />
+    <nd ref='-33038' />
+    <nd ref='-33040' />
+    <nd ref='-33042' />
+    <nd ref='-33044' />
+    <nd ref='-33046' />
+    <nd ref='-33048' />
+    <nd ref='-33050' />
+    <nd ref='-33052' />
+    <nd ref='-33054' />
+    <nd ref='-33056' />
+    <nd ref='-33058' />
+    <nd ref='-33060' />
+    <nd ref='-33062' />
+    <nd ref='-33064' />
+    <nd ref='-33066' />
+    <nd ref='-33068' />
+    <nd ref='-33070' />
+    <nd ref='-33072' />
+    <nd ref='-33074' />
+    <nd ref='-33076' />
+    <nd ref='-33078' />
+    <nd ref='-33080' />
+    <nd ref='-33082' />
+    <nd ref='-33084' />
+    <nd ref='-33086' />
+    <nd ref='-33088' />
+    <nd ref='-33090' />
+    <nd ref='-33102' />
+    <nd ref='-33092' />
+    <nd ref='-33094' />
+    <nd ref='-33096' />
+    <nd ref='-33098' />
+    <nd ref='-33100' />
+    <tag k='pattern' v='A' />
+  </way>
+  <way id='-33121' action='modify'>
+    <nd ref='-33004' />
+    <nd ref='-33006' />
+    <tag k='pattern' v='A' />
+  </way>
+  <way id='-33128' action='modify'>
+    <nd ref='-33000' />
+    <nd ref='-33002' />
+    <tag k='pattern' v='B' />
+  </way>
+  <way id='-33135' action='modify'>
+    <nd ref='-32996' />
+    <nd ref='-32998' />
+    <tag k='pattern' v='C' />
+  </way>
+</osm>
Index: /trunk/test/data/renderer/way-repeat-image-clamp/style.mapcss
===================================================================
--- /trunk/test/data/renderer/way-repeat-image-clamp/style.mapcss	(revision 12455)
+++ /trunk/test/data/renderer/way-repeat-image-clamp/style.mapcss	(revision 12455)
@@ -0,0 +1,22 @@
+canvas {
+    default-points: false;
+    default-lines: false;
+}
+
+way[pattern] {
+	width: 1;
+	color: red;
+    repeat-image: "trees.svg";
+    repeat-image-align: bottom;
+    repeat-image-offset: 2;
+    repeat-image-spacing: 20;
+	repeat-image-phase: 0;
+}
+
+way[pattern=B] {
+	repeat-image-phase: 4;
+}
+
+way[pattern=C] {
+	repeat-image-phase: 8;
+}
Index: /trunk/test/data/renderer/way-repeat-image-clamp/trees.svg
===================================================================
--- /trunk/test/data/renderer/way-repeat-image-clamp/trees.svg	(revision 12455)
+++ /trunk/test/data/renderer/way-repeat-image-clamp/trees.svg	(revision 12455)
@@ -0,0 +1,378 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg1"
+   sodipodi:docname="02.svg"
+   inkscape:export-filename="/datas/Projs/Cliparts Stocker/plain_tree.png"
+   viewBox="0 0 970.83973 972.18771"
+   sodipodi:version="0.32"
+   inkscape:export-xdpi="72.000000"
+   version="1.0"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   inkscape:export-ydpi="72.000000"
+   inkscape:version="0.48.5 r10040"
+   width="100%"
+   height="100%">
+  <defs
+     id="defs3">
+    <linearGradient
+       id="linearGradient5877"
+       y2="183.60001"
+       gradientUnits="userSpaceOnUse"
+       y1="349.29999"
+       gradientTransform="scale(0.61308,1.6311)"
+       x2="207.92999"
+       x1="466.13"
+       inkscape:collect="always">
+      <stop
+         id="stop5303"
+         style="stop-color:#002f00"
+         offset="0" />
+      <stop
+         id="stop5304"
+         style="stop-color:#009300"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5880"
+       y2="457.35999"
+       gradientUnits="userSpaceOnUse"
+       y1="32.316002"
+       gradientTransform="scale(0.61308,1.6311)"
+       x2="383.14001"
+       x1="383.14001"
+       inkscape:collect="always">
+      <stop
+         id="stop2187"
+         style="stop-color:#002f00"
+         offset="0" />
+      <stop
+         id="stop2188"
+         style="stop-color:#009300"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5883"
+       y2="478.01001"
+       gradientUnits="userSpaceOnUse"
+       y1="476.92999"
+       gradientTransform="scale(0.61633,1.6225)"
+       x2="384.09"
+       x1="345.53"
+       inkscape:collect="always">
+      <stop
+         id="stop3434"
+         style="stop-color:#6c2f07"
+         offset="0" />
+      <stop
+         id="stop3435"
+         style="stop-color:#7e4932"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5883-1-7"
+       y2="478.01001"
+       gradientUnits="userSpaceOnUse"
+       y1="476.92999"
+       gradientTransform="scale(0.61633,1.6225)"
+       x2="384.09"
+       x1="345.53"
+       inkscape:collect="always">
+      <stop
+         id="stop3434-7-1"
+         style="stop-color:#6c2f07"
+         offset="0" />
+      <stop
+         id="stop3435-4-1"
+         style="stop-color:#7e4932"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5880-0-5"
+       y2="457.35999"
+       gradientUnits="userSpaceOnUse"
+       y1="32.316002"
+       gradientTransform="scale(0.61308,1.6311)"
+       x2="383.14001"
+       x1="383.14001"
+       inkscape:collect="always">
+      <stop
+         id="stop2187-9-2"
+         style="stop-color:#002f00"
+         offset="0" />
+      <stop
+         id="stop2188-4-7"
+         style="stop-color:#009300"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       y2="183.60001"
+       x2="207.92999"
+       y1="349.29999"
+       x1="466.13"
+       gradientTransform="scale(0.61308,1.6311)"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3020-6"
+       xlink:href="#linearGradient5877-8-1"
+       inkscape:collect="always" />
+    <linearGradient
+       id="linearGradient5877-8-1"
+       y2="183.60001"
+       gradientUnits="userSpaceOnUse"
+       y1="349.29999"
+       gradientTransform="scale(0.61308,1.6311)"
+       x2="207.92999"
+       x1="466.13"
+       inkscape:collect="always">
+      <stop
+         id="stop5303-8-4"
+         style="stop-color:#002f00"
+         offset="0" />
+      <stop
+         id="stop5304-2-2"
+         style="stop-color:#009300"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5883-3"
+       y2="478.01001"
+       gradientUnits="userSpaceOnUse"
+       y1="476.92999"
+       gradientTransform="scale(0.61633,1.6225)"
+       x2="384.09"
+       x1="345.53"
+       inkscape:collect="always">
+      <stop
+         id="stop3434-2"
+         style="stop-color:#6c2f07"
+         offset="0" />
+      <stop
+         id="stop3435-2"
+         style="stop-color:#7e4932"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5880-1"
+       y2="457.35999"
+       gradientUnits="userSpaceOnUse"
+       y1="32.316002"
+       gradientTransform="scale(0.61308,1.6311)"
+       x2="383.14001"
+       x1="383.14001"
+       inkscape:collect="always">
+      <stop
+         id="stop2187-6"
+         style="stop-color:#002f00"
+         offset="0" />
+      <stop
+         id="stop2188-8"
+         style="stop-color:#009300"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5877-5"
+       y2="183.60001"
+       gradientUnits="userSpaceOnUse"
+       y1="349.29999"
+       gradientTransform="scale(0.61308,1.6311)"
+       x2="207.92999"
+       x1="466.13"
+       inkscape:collect="always">
+      <stop
+         id="stop5303-7"
+         style="stop-color:#002f00"
+         offset="0" />
+      <stop
+         id="stop5304-6"
+         style="stop-color:#009300"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       y2="183.60001"
+       x2="207.92999"
+       y1="349.29999"
+       x1="466.13"
+       gradientTransform="scale(0.61308,1.6311)"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3098"
+       xlink:href="#linearGradient5877-5"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="183.60001"
+       x2="207.92999"
+       y1="349.29999"
+       x1="466.13"
+       gradientTransform="scale(0.61308,1.6311)"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3020-0"
+       xlink:href="#linearGradient5877-8-2"
+       inkscape:collect="always" />
+    <linearGradient
+       id="linearGradient5877-8-2"
+       y2="183.60001"
+       gradientUnits="userSpaceOnUse"
+       y1="349.29999"
+       gradientTransform="scale(0.61308,1.6311)"
+       x2="207.92999"
+       x1="466.13"
+       inkscape:collect="always">
+      <stop
+         id="stop5303-8-48"
+         style="stop-color:#002f00"
+         offset="0" />
+      <stop
+         id="stop5304-2-6"
+         style="stop-color:#009300"
+         offset="1" />
+    </linearGradient>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     bordercolor="#666666"
+     inkscape:pageshadow="2"
+     inkscape:window-y="-4"
+     pagecolor="#ffffff"
+     inkscape:window-height="1003"
+     inkscape:zoom="0.41427105"
+     inkscape:window-x="-4"
+     showgrid="true"
+     borderopacity="1.0"
+     inkscape:current-layer="svg1"
+     inkscape:cx="-42.294561"
+     inkscape:cy="423.0624"
+     inkscape:window-width="1680"
+     inkscape:pageopacity="0.0"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0"
+     inkscape:window-maximized="0">
+    <inkscape:grid
+       type="xygrid"
+       id="grid2995"
+       empspacing="5"
+       visible="true"
+       enabled="true"
+       snapvisiblegridlinesonly="true"
+       originx="-148.666px"
+       originy="1.0382462e-005px" />
+  </sodipodi:namedview>
+  <g
+     id="g5885"
+     transform="translate(-82.251123,-23.332315)">
+    <path
+       id="path1545"
+       style="fill:url(#linearGradient5883);fill-rule:evenodd"
+       d="m 193.88,772.09 -9.78,223.43 h 84.88 L 254.1,772.09 h -60.22 z"
+       inkscape:connector-curvature="0" />
+    <path
+       id="path909"
+       sodipodi:nodetypes="ccccccccccccc"
+       style="fill:url(#linearGradient5880);fill-opacity:0.75;fill-rule:evenodd"
+       d="m 223.51,23.337 c -8.1,0.571 -72.67,106.71 -87.16,176.56 -21.53,125.42 -31.83,285.19 -50.937,410.97 -5.671,29.1 -3.298,64.86 3.812,82.34 7.231,23.7 27.775,48.49 52.345,62.81 29.99,19.43 52.51,18.91 81.75,19.29 0.15,0.09 0.35,0.11 0.53,0 30.62,-0.04 53.49,-1.24 81.75,-19.29 24.57,-14.32 45.11,-39.11 52.34,-62.81 7.11,-17.48 9.49,-53.24 3.82,-82.34 -19.11,-125.78 -29.41,-285.55 -50.94,-410.97 -14.49,-69.85 -79.06,-175.99 -87.16,-176.56 -0.02,-0.005 -0.11,-0.006 -0.15,-0.003 z"
+       inkscape:connector-curvature="0" />
+    <path
+       id="path4679"
+       sodipodi:nodetypes="ccccccccccccc"
+       style="fill:url(#linearGradient5877);fill-rule:evenodd"
+       d="m 223.51,23.337 c -8.1,0.571 -72.67,106.71 -87.16,176.56 -21.53,125.42 -31.83,285.19 -50.937,410.97 -5.671,29.1 -3.298,64.86 3.812,82.34 7.231,23.7 27.775,48.49 52.345,62.81 29.99,19.43 52.51,18.91 81.75,19.29 0.15,0.09 0.35,0.11 0.53,0 30.62,-0.04 53.49,-1.24 81.75,-19.29 24.57,-14.32 45.11,-39.11 52.34,-62.81 7.11,-17.48 9.49,-53.24 3.82,-82.34 -19.12,-125.78 -29.41,-285.55 -50.94,-410.97 -14.49,-69.85 -79.06,-175.99 -87.16,-176.56 -0.02,-0.005 -0.11,-0.006 -0.15,-0.003 z"
+       inkscape:connector-curvature="0" />
+  </g>
+  <metadata
+     id="metadata18">
+    <rdf:RDF>
+      <cc:Work>
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <cc:license
+           rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+        <dc:publisher>
+          <cc:Agent
+             rdf:about="http://openclipart.org/">
+            <dc:title>Openclipart</dc:title>
+          </cc:Agent>
+        </dc:publisher>
+        <dc:title></dc:title>
+        <dc:date>2008-05-26T12:05:38</dc:date>
+        <dc:description />
+        <dc:source>https://openclipart.org/detail/17043/plain_tree-by-jean_victor_balin</dc:source>
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>jean_victor_balin</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <dc:subject>
+          <rdf:Bag>
+            <rdf:li>forest</rdf:li>
+            <rdf:li>garden</rdf:li>
+            <rdf:li>plant</rdf:li>
+            <rdf:li>tree</rdf:li>
+          </rdf:Bag>
+        </dc:subject>
+      </cc:Work>
+      <cc:License
+         rdf:about="http://creativecommons.org/licenses/publicdomain/">
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Reproduction" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Distribution" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="g5885-1"
+     transform="translate(267.93589,-23.332315)">
+    <path
+       inkscape:connector-curvature="0"
+       id="path1545-8"
+       style="fill:url(#linearGradient5883-3);fill-rule:evenodd"
+       d="m 193.88,772.09 -9.78,223.43 h 84.88 L 254.1,772.09 h -60.22 z" />
+    <path
+       inkscape:connector-curvature="0"
+       id="path909-9"
+       sodipodi:nodetypes="ccccccccccccc"
+       style="fill:url(#linearGradient5880-1);fill-opacity:0.75;fill-rule:evenodd"
+       d="m 223.51,23.337 c -8.1,0.571 -72.67,106.71 -87.16,176.56 -21.53,125.42 -31.83,285.19 -50.937,410.97 -5.671,29.1 -3.298,64.86 3.812,82.34 7.231,23.7 27.775,48.49 52.345,62.81 29.99,19.43 52.51,18.91 81.75,19.29 0.15,0.09 0.35,0.11 0.53,0 30.62,-0.04 53.49,-1.24 81.75,-19.29 24.57,-14.32 45.11,-39.11 52.34,-62.81 7.11,-17.48 9.49,-53.24 3.82,-82.34 -19.11,-125.78 -29.41,-285.55 -50.94,-410.97 -14.49,-69.85 -79.06,-175.99 -87.16,-176.56 -0.02,-0.005 -0.11,-0.006 -0.15,-0.003 z" />
+    <path
+       inkscape:connector-curvature="0"
+       id="path4679-2"
+       sodipodi:nodetypes="ccccccccccccc"
+       style="fill:url(#linearGradient3098);fill-rule:evenodd"
+       d="m 223.51,23.337 c -8.1,0.571 -72.67,106.71 -87.16,176.56 -21.53,125.42 -31.83,285.19 -50.937,410.97 -5.671,29.1 -3.298,64.86 3.812,82.34 7.231,23.7 27.775,48.49 52.345,62.81 29.99,19.43 52.51,18.91 81.75,19.29 0.15,0.09 0.35,0.11 0.53,0 30.62,-0.04 53.49,-1.24 81.75,-19.29 24.57,-14.32 45.11,-39.11 52.34,-62.81 7.11,-17.48 9.49,-53.24 3.82,-82.34 -19.12,-125.78 -29.41,-285.55 -50.94,-410.97 -14.49,-69.85 -79.06,-175.99 -87.16,-176.56 -0.02,-0.005 -0.11,-0.006 -0.15,-0.003 z" />
+  </g>
+  <g
+     id="g5885-4-7"
+     transform="translate(605.92089,-23.332315)">
+    <path
+       inkscape:connector-curvature="0"
+       id="path1545-5-9"
+       style="fill:url(#linearGradient5883-1-7);fill-rule:evenodd"
+       d="m 193.88,772.09 -9.78,223.43 h 84.88 L 254.1,772.09 h -60.22 z" />
+    <path
+       inkscape:connector-curvature="0"
+       id="path909-5-5"
+       sodipodi:nodetypes="ccccccccccccc"
+       style="fill:url(#linearGradient5880-0-5);fill-opacity:0.75;fill-rule:evenodd"
+       d="m 223.51,23.337 c -8.1,0.571 -72.67,106.71 -87.16,176.56 -21.53,125.42 -31.83,285.19 -50.937,410.97 -5.671,29.1 -3.298,64.86 3.812,82.34 7.231,23.7 27.775,48.49 52.345,62.81 29.99,19.43 52.51,18.91 81.75,19.29 0.15,0.09 0.35,0.11 0.53,0 30.62,-0.04 53.49,-1.24 81.75,-19.29 24.57,-14.32 45.11,-39.11 52.34,-62.81 7.11,-17.48 9.49,-53.24 3.82,-82.34 -19.11,-125.78 -29.41,-285.55 -50.94,-410.97 -14.49,-69.85 -79.06,-175.99 -87.16,-176.56 -0.02,-0.005 -0.11,-0.006 -0.15,-0.003 z" />
+    <path
+       inkscape:connector-curvature="0"
+       id="path4679-1-4"
+       sodipodi:nodetypes="ccccccccccccc"
+       style="fill:url(#linearGradient3020-6);fill-rule:evenodd"
+       d="m 223.51,23.337 c -8.1,0.571 -72.67,106.71 -87.16,176.56 -21.53,125.42 -31.83,285.19 -50.937,410.97 -5.671,29.1 -3.298,64.86 3.812,82.34 7.231,23.7 27.775,48.49 52.345,62.81 29.99,19.43 52.51,18.91 81.75,19.29 0.15,0.09 0.35,0.11 0.53,0 30.62,-0.04 53.49,-1.24 81.75,-19.29 24.57,-14.32 45.11,-39.11 52.34,-62.81 7.11,-17.48 9.49,-53.24 3.82,-82.34 -19.12,-125.78 -29.41,-285.55 -50.94,-410.97 -14.49,-69.85 -79.06,-175.99 -87.16,-176.56 -0.02,-0.005 -0.11,-0.006 -0.15,-0.003 z" />
+  </g>
+</svg>
Index: /trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
===================================================================
--- /trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java	(revision 12454)
+++ /trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java	(revision 12455)
@@ -111,5 +111,7 @@
 
                 /** Tests repeat-image feature for ways */
-                new TestConfig("way-repeat-image", AREA_DEFAULT)
+                new TestConfig("way-repeat-image", AREA_DEFAULT),
+                /** Tests the clamping for repeat-images and repeat-image-phase */
+                new TestConfig("way-repeat-image-clamp", AREA_DEFAULT)
 
                 ).map(e -> new Object[] {e, e.testDirectory})
