()
| 433 | |
| 434 | |
| 435 | @Override |
| 436 | public void endDraw() { |
| 437 | // hm, mark pixels as changed, because this will instantly do a full |
| 438 | // copy of all the pixels to the surface.. so that's kind of a mess. |
| 439 | //updatePixels(); |
| 440 | |
| 441 | if (primaryGraphics) { |
| 442 | /* |
| 443 | //if (canvas != null) { |
| 444 | if (useCanvas) { |
| 445 | //System.out.println(canvas); |
| 446 | |
| 447 | // alternate version |
| 448 | //canvas.repaint(); // ?? what to do for swapping buffers |
| 449 | |
| 450 | // System.out.println("endDraw() frameCount is " + parent.frameCount); |
| 451 | // if (parent.frameCount != 0) { |
| 452 | redraw(); |
| 453 | // } |
| 454 | |
| 455 | } else if (useOffscreen) { |
| 456 | // don't copy the pixels/data elements of the buffered image directly, |
| 457 | // since it'll disable the nice speedy pipeline stuff, sending all drawing |
| 458 | // into a world of suck that's rough 6 trillion times slower. |
| 459 | synchronized (image) { |
| 460 | //System.out.println("inside j2d sync"); |
| 461 | image.getGraphics().drawImage(offscreen, 0, 0, null); |
| 462 | } |
| 463 | |
| 464 | } else { |
| 465 | // changed to not dispose and get on each frame, |
| 466 | // otherwise a new Graphics context is used on each frame |
| 467 | // g2.dispose(); |
| 468 | // System.out.println("not doing anything special in endDraw()"); |
| 469 | } |
| 470 | */ |
| 471 | } else { |
| 472 | // TODO this is probably overkill for most tasks... |
| 473 | loadPixels(); |
| 474 | } |
| 475 | |
| 476 | // // Marking as modified, and then calling updatePixels() in |
| 477 | // // the super class, which just sets the mx1, my1, mx2, my2 |
| 478 | // // coordinates of the modified area. This avoids doing the |
| 479 | // // full copy of the pixels to the surface in this.updatePixels(). |
| 480 | // setModified(); |
| 481 | // super.updatePixels(); |
| 482 | |
| 483 | // Marks pixels as modified so that the pixels will be updated. |
| 484 | // Also sets mx1/y1/x2/y2 so that OpenGL will pick it up. |
| 485 | setModified(); |
| 486 | |
| 487 | g2.dispose(); |
| 488 | } |
| 489 | |
| 490 | |
| 491 | /* |
no test coverage detected