Ticket #3313: work_around_openjdk_bug.patch
File work_around_openjdk_bug.patch, 2.4 KB (added by , 16 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 } 392 382 393 lat = max; max = b.max.lon(); 383 394 for(; lon <= max; lon += 1.0) 384 395 { 385 396 p = getPoint(new LatLon(lat, lon >= max ? max : lon)); 386 path.lineTo(p.x, p.y); 397 // OpenJDK… 398 if(p.y < 0 || p.x < 0) { 399 path.moveTo(Math.max(p.x, 0), p.y); 400 } else { 401 path.lineTo(Math.min(p.x, w), p.y); 402 } 387 403 } 388 404 lon = max; max = b.min.lat(); 389 405 for(; lat >= max; lat -= 1.0) 390 406 { 391 407 p = getPoint(new LatLon(lat <= max ? max : lat, lon)); 392 path.lineTo(p.x, p.y); 408 // OpenJDK… 409 if(p.x > w || p.y < 0) { 410 path.moveTo(p.x, Math.max(p.y, 0)); 411 } else { 412 path.lineTo(p.x, Math.min(p.y, h)); 413 } 393 414 } 394 415 lat = max; max = b.min.lon(); 395 416 for(; lon >= max; lon -= 1.0) 396 417 { 397 418 p = getPoint(new LatLon(lat, lon <= max ? max : lon)); 398 path.lineTo(p.x, p.y); 419 // OpenJDK… 420 if(p.y > h || p.x > w) { 421 path.moveTo(Math.min(p.x, w), p.y); 422 } else { 423 path.lineTo(Math.max(p.x, 0), p.y); 424 } 399 425 } 400 426 401 427 if (playHeadMarker != null) { 402 428 playHeadMarker.paint(tempG, this); 403 429 } 430 404 431 tempG.draw(path); 405 432 406 433 g.drawImage(offscreenBuffer, 0, 0, null);