src/share/classes/javax/swing/BufferStrategyPaintManager.java

Print this page




 506         bufferStrategy = null;
 507         if (root != null) {
 508             boolean contentsLost = false;
 509             BufferInfo bufferInfo = getBufferInfo(root);
 510             if (bufferInfo == null) {
 511                 contentsLost = true;
 512                 bufferInfo = new BufferInfo(root);
 513                 bufferInfos.add(bufferInfo);
 514                 if (LOGGER.isLoggable(PlatformLogger.FINER)) {
 515                     LOGGER.finer("prepare: new BufferInfo: " + root);
 516                 }
 517             }
 518             this.bufferInfo = bufferInfo;
 519             if (!bufferInfo.hasBufferStrategyChanged()) {
 520                 bufferStrategy = bufferInfo.getBufferStrategy(true);
 521                 if (bufferStrategy != null) {
 522                     bsg = bufferStrategy.getDrawGraphics();
 523                     if (bufferStrategy.contentsRestored()) {
 524                         contentsLost = true;
 525                         if (LOGGER.isLoggable(PlatformLogger.FINER)) {
 526                             LOGGER.finer(
 527                                 "prepare: contents restored in prepare");
 528                         }
 529                     }
 530                 }
 531                 else {
 532                     // Couldn't create BufferStrategy, fallback to normal
 533                     // painting.
 534                     return false;
 535                 }
 536                 if (bufferInfo.getContentsLostDuringExpose()) {
 537                     contentsLost = true;
 538                     bufferInfo.setContentsLostDuringExpose(false);
 539                     if (LOGGER.isLoggable(PlatformLogger.FINER)) {
 540                         LOGGER.finer("prepare: contents lost on expose");
 541                     }
 542                 }
 543                 if (isPaint && c == rootJ && x == 0 && y == 0 &&
 544                       c.getWidth() == w && c.getHeight() == h) {
 545                     bufferInfo.setInSync(true);
 546                 }
 547                 else if (contentsLost) {




 506         bufferStrategy = null;
 507         if (root != null) {
 508             boolean contentsLost = false;
 509             BufferInfo bufferInfo = getBufferInfo(root);
 510             if (bufferInfo == null) {
 511                 contentsLost = true;
 512                 bufferInfo = new BufferInfo(root);
 513                 bufferInfos.add(bufferInfo);
 514                 if (LOGGER.isLoggable(PlatformLogger.FINER)) {
 515                     LOGGER.finer("prepare: new BufferInfo: " + root);
 516                 }
 517             }
 518             this.bufferInfo = bufferInfo;
 519             if (!bufferInfo.hasBufferStrategyChanged()) {
 520                 bufferStrategy = bufferInfo.getBufferStrategy(true);
 521                 if (bufferStrategy != null) {
 522                     bsg = bufferStrategy.getDrawGraphics();
 523                     if (bufferStrategy.contentsRestored()) {
 524                         contentsLost = true;
 525                         if (LOGGER.isLoggable(PlatformLogger.FINER)) {
 526                             LOGGER.finer("prepare: contents restored in prepare");

 527                         }
 528                     }
 529                 }
 530                 else {
 531                     // Couldn't create BufferStrategy, fallback to normal
 532                     // painting.
 533                     return false;
 534                 }
 535                 if (bufferInfo.getContentsLostDuringExpose()) {
 536                     contentsLost = true;
 537                     bufferInfo.setContentsLostDuringExpose(false);
 538                     if (LOGGER.isLoggable(PlatformLogger.FINER)) {
 539                         LOGGER.finer("prepare: contents lost on expose");
 540                     }
 541                 }
 542                 if (isPaint && c == rootJ && x == 0 && y == 0 &&
 543                       c.getWidth() == w && c.getHeight() == h) {
 544                     bufferInfo.setInSync(true);
 545                 }
 546                 else if (contentsLost) {