src/share/classes/javax/swing/BufferStrategyPaintManager.java
Print this page
*** 213,223 ****
}
});
}
private void dispose(java.util.List<BufferInfo> bufferInfos) {
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("BufferStrategyPaintManager disposed",
new RuntimeException());
}
if (bufferInfos != null) {
for (BufferInfo bufferInfo : bufferInfos) {
--- 213,223 ----
}
});
}
private void dispose(java.util.List<BufferInfo> bufferInfos) {
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("BufferStrategyPaintManager disposed",
new RuntimeException());
}
if (bufferInfos != null) {
for (BufferInfo bufferInfo : bufferInfos) {
*** 298,308 ****
bufferInfo.setInSync(false);
// Fall through to old rendering.
}
}
// Invalid root, do what Swing has always done.
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("prepare failed");
}
return super.paint(paintingComponent, bufferComponent, g, x, y, w, h);
}
--- 298,308 ----
bufferInfo.setInSync(false);
// Fall through to old rendering.
}
}
// Invalid root, do what Swing has always done.
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("prepare failed");
}
return super.paint(paintingComponent, bufferComponent, g, x, y, w, h);
}
*** 330,340 ****
bsg.copyArea(xOffset + x, yOffset + y, w, h, deltaX,
deltaY);
}
accumulate(x + xOffset + deltaX, y + yOffset + deltaY, w, h);
} else {
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("copyArea: prepare failed or not in sync");
}
// Prepare failed, or not in sync. By calling super.copyArea
// we'll copy on screen. We need to flush any pending paint to
// the screen otherwise we'll do a copyArea on the wrong thing.
--- 330,340 ----
bsg.copyArea(xOffset + x, yOffset + y, w, h, deltaX,
deltaY);
}
accumulate(x + xOffset + deltaX, y + yOffset + deltaY, w, h);
} else {
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("copyArea: prepare failed or not in sync");
}
// Prepare failed, or not in sync. By calling super.copyArea
// we'll copy on screen. We need to flush any pending paint to
// the screen otherwise we'll do a copyArea on the wrong thing.
*** 358,376 ****
wait();
} catch (InterruptedException ie) {
}
}
}
! if (LOGGER.isLoggable(PlatformLogger.FINEST)) {
LOGGER.finest("beginPaint");
}
// Reset the area that needs to be painted.
resetAccumulated();
}
public void endPaint() {
! if (LOGGER.isLoggable(PlatformLogger.FINEST)) {
LOGGER.finest("endPaint: region " + accumulatedX + " " +
accumulatedY + " " + accumulatedMaxX + " " +
accumulatedMaxY);
}
if (painting) {
--- 358,376 ----
wait();
} catch (InterruptedException ie) {
}
}
}
! if (LOGGER.isLoggable(PlatformLogger.Level.FINEST)) {
LOGGER.finest("beginPaint");
}
// Reset the area that needs to be painted.
resetAccumulated();
}
public void endPaint() {
! if (LOGGER.isLoggable(PlatformLogger.Level.FINEST)) {
LOGGER.finest("endPaint: region " + accumulatedX + " " +
accumulatedY + " " + accumulatedMaxX + " " +
accumulatedMaxY);
}
if (painting) {
*** 415,425 ****
bsSubRegion.show(accumulatedX, accumulatedY,
accumulatedMaxX, accumulatedMaxY);
contentsLost = bufferStrategy.contentsLost();
}
if (contentsLost) {
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("endPaint: contents lost");
}
// Shown region was bogus, mark buffer as out of sync.
bufferInfo.setInSync(false);
success = false;
--- 415,425 ----
bsSubRegion.show(accumulatedX, accumulatedY,
accumulatedMaxX, accumulatedMaxY);
contentsLost = bufferStrategy.contentsLost();
}
if (contentsLost) {
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("endPaint: contents lost");
}
// Shown region was bogus, mark buffer as out of sync.
bufferInfo.setInSync(false);
success = false;
*** 509,519 ****
BufferInfo bufferInfo = getBufferInfo(root);
if (bufferInfo == null) {
contentsLost = true;
bufferInfo = new BufferInfo(root);
bufferInfos.add(bufferInfo);
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("prepare: new BufferInfo: " + root);
}
}
this.bufferInfo = bufferInfo;
if (!bufferInfo.hasBufferStrategyChanged()) {
--- 509,519 ----
BufferInfo bufferInfo = getBufferInfo(root);
if (bufferInfo == null) {
contentsLost = true;
bufferInfo = new BufferInfo(root);
bufferInfos.add(bufferInfo);
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("prepare: new BufferInfo: " + root);
}
}
this.bufferInfo = bufferInfo;
if (!bufferInfo.hasBufferStrategyChanged()) {
*** 520,530 ****
bufferStrategy = bufferInfo.getBufferStrategy(true);
if (bufferStrategy != null) {
bsg = bufferStrategy.getDrawGraphics();
if (bufferStrategy.contentsRestored()) {
contentsLost = true;
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("prepare: contents restored in prepare");
}
}
}
else {
--- 520,530 ----
bufferStrategy = bufferInfo.getBufferStrategy(true);
if (bufferStrategy != null) {
bsg = bufferStrategy.getDrawGraphics();
if (bufferStrategy.contentsRestored()) {
contentsLost = true;
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("prepare: contents restored in prepare");
}
}
}
else {
*** 533,543 ****
return false;
}
if (bufferInfo.getContentsLostDuringExpose()) {
contentsLost = true;
bufferInfo.setContentsLostDuringExpose(false);
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("prepare: contents lost on expose");
}
}
if (isPaint && c == rootJ && x == 0 && y == 0 &&
c.getWidth() == w && c.getHeight() == h) {
--- 533,543 ----
return false;
}
if (bufferInfo.getContentsLostDuringExpose()) {
contentsLost = true;
bufferInfo.setContentsLostDuringExpose(false);
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("prepare: contents lost on expose");
}
}
if (isPaint && c == rootJ && x == 0 && y == 0 &&
c.getWidth() == w && c.getHeight() == h) {
*** 636,646 ****
BufferInfo bufferInfo = bufferInfos.get(counter);
Container biRoot = bufferInfo.getRoot();
if (biRoot == null) {
// Window gc'ed
bufferInfos.remove(counter);
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("BufferInfo pruned, root null");
}
}
else if (biRoot == root) {
return bufferInfo;
--- 636,646 ----
BufferInfo bufferInfo = bufferInfos.get(counter);
Container biRoot = bufferInfo.getRoot();
if (biRoot == null) {
// Window gc'ed
bufferInfos.remove(counter);
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("BufferInfo pruned, root null");
}
}
else if (biRoot == root) {
return bufferInfo;
*** 742,752 ****
if (bs == null && create) {
bs = createBufferStrategy();
if (bs != null) {
weakBS = new WeakReference<BufferStrategy>(bs);
}
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("getBufferStrategy: created bs: " + bs);
}
}
return bs;
}
--- 742,752 ----
if (bs == null && create) {
bs = createBufferStrategy();
if (bs != null) {
weakBS = new WeakReference<BufferStrategy>(bs);
}
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("getBufferStrategy: created bs: " + bs);
}
}
return bs;
}
*** 800,810 ****
return null;
}
BufferStrategy bs = null;
if (SwingUtilities3.isVsyncRequested(root)) {
bs = createBufferStrategy(root, true);
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("createBufferStrategy: using vsynced strategy");
}
}
if (bs == null) {
bs = createBufferStrategy(root, false);
--- 800,810 ----
return null;
}
BufferStrategy bs = null;
if (SwingUtilities3.isVsyncRequested(root)) {
bs = createBufferStrategy(root, true);
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("createBufferStrategy: using vsynced strategy");
}
}
if (bs == null) {
bs = createBufferStrategy(root, false);
*** 842,852 ****
getCreateBufferStrategyMethod().invoke(root, 2, caps);
bs = (BufferStrategy)getGetBufferStrategyMethod().
invoke(root);
} catch (InvocationTargetException ite) {
// Type is not supported
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("createBufferStratety failed",
ite);
}
} catch (IllegalArgumentException iae) {
assert false;
--- 842,852 ----
getCreateBufferStrategyMethod().invoke(root, 2, caps);
bs = (BufferStrategy)getGetBufferStrategyMethod().
invoke(root);
} catch (InvocationTargetException ite) {
// Type is not supported
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("createBufferStratety failed",
ite);
}
} catch (IllegalArgumentException iae) {
assert false;
*** 858,868 ****
try {
((Window)root).createBufferStrategy(2, caps);
bs = ((Window)root).getBufferStrategy();
} catch (AWTException e) {
// Type not supported
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("createBufferStratety failed",
e);
}
}
}
--- 858,868 ----
try {
((Window)root).createBufferStrategy(2, caps);
bs = ((Window)root).getBufferStrategy();
} catch (AWTException e) {
// Type not supported
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("createBufferStratety failed",
e);
}
}
}
*** 872,882 ****
/**
* Cleans up and removes any references.
*/
public void dispose() {
Container root = getRoot();
! if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer("disposed BufferInfo for: " + root);
}
if (root != null) {
root.removeComponentListener(this);
if (root instanceof Window) {
--- 872,882 ----
/**
* Cleans up and removes any references.
*/
public void dispose() {
Container root = getRoot();
! if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
LOGGER.finer("disposed BufferInfo for: " + root);
}
if (root != null) {
root.removeComponentListener(this);
if (root instanceof Window) {