Ticket #3313: work_around_openjdk_bug.2.patch
| File work_around_openjdk_bug.2.patch, 2.4 KB (added by , 17 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/MapView.java
370 370 double lat = b.min.lat(); 371 371 double lon = b.min.lon(); 372 372 373 int w = offscreenBuffer.getWidth(); 374 int h = offscreenBuffer.getHeight(); 375 373 376 Point p = getPoint(b.min); 374 377 path.moveTo(p.x, p.y); 375 378 … … 377 380 for(; lat <= max; lat += 1.0) 378 381 { 379 382 p = getPoint(new LatLon(lat >= max ? max : lat, lon)); 380 path.lineTo(p.x, p.y); 383 // OpenJDK has problems when it should draw out of bounds 384 // This ensures lineTo only draws into the visible area 385 if(p.x < 0 || p.y > h) { 386 path.moveTo(p.x, Math.min(p.y, h)); 387 } else { 388 path.lineTo(p.x, Math.max(p.y, 0)); 389 390 } 381 391 } 382 392 lat = max; max = b.max.lon(); 383 393 for(; lon <= max; lon += 1.0) 384 394 { 385 395 p = getPoint(new LatLon(lat, lon >= max ? max : lon)); 386 path.lineTo(p.x, p.y); 396 // OpenJDK... 397 if(p.y < 0 || p.x < 0) { 398 path.moveTo(Math.max(p.x, 0), p.y); 399 } else { 400 path.lineTo(Math.min(p.x, w), p.y); 401 } 387 402 } 388 403 lon = max; max = b.min.lat(); 389 404 for(; lat >= max; lat -= 1.0) 390 405 { 391 406 p = getPoint(new LatLon(lat <= max ? max : lat, lon)); 392 path.lineTo(p.x, p.y); 407 // OpenJDK... 408 if(p.x > w || p.y < 0) { 409 path.moveTo(p.x, Math.max(p.y, 0)); 410 } else { 411 path.lineTo(p.x, Math.min(p.y, h)); 412 } 393 413 } 394 414 lat = max; max = b.min.lon(); 395 415 for(; lon >= max; lon -= 1.0) 396 416 { 397 417 p = getPoint(new LatLon(lat, lon <= max ? max : lon)); 398 path.lineTo(p.x, p.y); 418 // OpenJDK... 419 if(p.y > h || p.x > w) { 420 path.moveTo(Math.min(p.x, w), p.y); 421 } else { 422 path.lineTo(Math.max(p.x, 0), p.y); 423 } 399 424 } 400 425 401 426 if (playHeadMarker != null) { 402 427 playHeadMarker.paint(tempG, this); 403 428 } 429 404 430 tempG.draw(path); 405 431 406 432 g.drawImage(offscreenBuffer, 0, 0, null);
