modules/graphics/src/main/java/com/sun/javafx/tk/quantum/ViewPainter.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -47,11 +47,11 @@
import com.sun.prism.ResourceFactory;
import com.sun.prism.Texture;
import com.sun.prism.impl.PrismSettings;
import com.sun.prism.paint.Color;
import com.sun.prism.paint.Paint;
-import static com.sun.javafx.logging.PulseLogger.PULSE_LOGGER;
+import com.sun.javafx.logging.PulseLogger;
import static com.sun.javafx.logging.PulseLogger.PULSE_LOGGING_ENABLED;
/**
* Responsible for "painting" a scene. It invokes as appropriate API on the root NGNode
* of a scene to determine dirty regions, render roots, etc. Also calls the render root
@@ -224,11 +224,11 @@
int status = -1;
// If we're rendering with dirty regions, then we'll call the root node to accumulate
// the dirty regions and then again to do the pre culling.
if (!renderEverything) {
- long start = PULSE_LOGGING_ENABLED ? System.currentTimeMillis() : 0;
+ if (PULSE_LOGGING_ENABLED) PulseLogger.newPhase("Dirty Opts Computed");
clip.setBounds(0, 0, width, height);
dirtyRegionTemp.makeEmpty();
dirtyRegionContainer.reset();
tx.setToIdentity();
projTx.setIdentity();
@@ -238,13 +238,10 @@
tx, projTx);
dirtyRegionContainer.roundOut();
if (status == DirtyRegionContainer.DTR_OK) {
root.doPreCulling(dirtyRegionContainer, tx, projTx);
}
- if (PULSE_LOGGING_ENABLED) {
- PULSE_LOGGER.renderMessage(start, System.currentTimeMillis(), "Dirty Opts Computed");
- }
}
// We're going to need to iterate over the dirty region container a lot, so we
// might as well save this reference.
final int dirtyRegionSize = status == DirtyRegionContainer.DTR_OK ? dirtyRegionContainer.size() : 0;
@@ -254,27 +251,24 @@
// NGNode know whether they ought to be paying attention to dirty region
// culling bits.
g.setHasPreCullingBits(true);
// Find the render roots. There is a different render root for each dirty region
- long start = PULSE_LOGGING_ENABLED ? System.currentTimeMillis() : 0;
+ if (PULSE_LOGGING_ENABLED) PulseLogger.newPhase("Render Roots Discovered");
for (int i = 0; i < dirtyRegionSize; ++i) {
NodePath path = getRootPath(i);
path.clear();
root.getRenderRoot(getRootPath(i), dirtyRegionContainer.getDirtyRegion(i), i, tx, projTx);
}
- if (PULSE_LOGGING_ENABLED) {
- PULSE_LOGGER.renderMessage(start, System.currentTimeMillis(), "Render Roots Discovered");
- }
// For debug purposes, write out to the pulse logger the number and size of the dirty
// regions that are being used to render this pulse.
if (PULSE_LOGGING_ENABLED) {
- PULSE_LOGGER.renderMessage(dirtyRegionSize + " different dirty regions to render");
+ PulseLogger.addMessage(dirtyRegionSize + " different dirty regions to render");
for (int i=0; i<dirtyRegionSize; i++) {
- PULSE_LOGGER.renderMessage("Dirty Region " + i + ": " + dirtyRegionContainer.getDirtyRegion(i));
- PULSE_LOGGER.renderMessage("Render Root Path " + i + ": " + getRootPath(i));
+ PulseLogger.addMessage("Dirty Region " + i + ": " + dirtyRegionContainer.getDirtyRegion(i));
+ PulseLogger.addMessage("Render Root Path " + i + ": " + getRootPath(i));
}
}
// If -Dprism.printrendergraph=true then we want to print out the render graph to the
// pulse logger, annotated with all the dirty opts. Invisible nodes are skipped.
@@ -290,11 +284,11 @@
roots.add(nodePath.last());
}
}
}
root.printDirtyOpts(s, roots);
- PULSE_LOGGER.renderMessage(s.toString());
+ PulseLogger.addMessage(s.toString());
}
// Paint each dirty region
for (int i = 0; i < dirtyRegionSize; ++i) {
final RectBounds dirtyRegion = dirtyRegionContainer.getDirtyRegion(i);
@@ -444,11 +438,11 @@
return;
}
// If the path is not empty, the first node must be the root node
assert(renderRootPath.getCurrentNode() == root);
}
- long start = PULSE_LOGGING_ENABLED ? System.currentTimeMillis() : 0;
+ if (PULSE_LOGGING_ENABLED) PulseLogger.newPhase("Painting");
try {
GlassScene scene = sceneState.getScene();
scene.clearEntireSceneDirty();
g.setLights(scene.getLights());
g.setDepthBuffer(scene.getDepthBuffer());
@@ -466,11 +460,8 @@
}
g.setCamera(sceneState.getCamera());
g.setRenderRoot(renderRootPath);
root.render(g);
} finally {
- if (PULSE_LOGGING_ENABLED) {
- PULSE_LOGGER.renderMessage(start, System.currentTimeMillis(), "Painted");
- }
}
}
}