< prev index next >

modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCPathImpl.java

Print this page

        

*** 30,97 **** import com.sun.javafx.geom.Path2D; import com.sun.javafx.geom.PathIterator; import com.sun.javafx.geom.Point2D; import com.sun.javafx.geom.RectBounds; import com.sun.javafx.geom.RoundRectangle2D; - import com.sun.javafx.geom.Shape; import com.sun.javafx.geom.transform.BaseTransform; import com.sun.webkit.graphics.WCPath; import com.sun.webkit.graphics.WCPathIterator; import com.sun.webkit.graphics.WCRectangle; ! ! import java.util.ArrayList; ! import java.util.List; ! import java.util.logging.Level; ! import java.util.logging.Logger; final class WCPathImpl extends WCPath<Path2D> { private final Path2D path; private boolean hasCP = false; ! private final static Logger log = ! Logger.getLogger(WCPathImpl.class.getName()); WCPathImpl() { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "Create empty WCPathImpl({0})", getID()); } path = new Path2D(); } WCPathImpl(WCPathImpl wcp) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "Create WCPathImpl({0}) from WCPathImpl({1})", new Object[] { getID(), wcp.getID()}); } path = new Path2D(wcp.path); hasCP = wcp.hasCP; } public void addRect(double x, double y, double w, double h) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).addRect({1},{2},{3},{4})", new Object[] {getID(), x, y, w, h}); } hasCP = true; path.append(new RoundRectangle2D( (float)x, (float)y, (float)w, (int)h, 0.0f, 0.0f), false); } public void addEllipse(double x, double y, double w, double h) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).addEllipse({1},{2},{3},{4})", new Object[] {getID(), x, y, w, h}); } hasCP = true; path.append(new Ellipse2D((float)x, (float)y, (float)w, (float)h), false); } public void addArcTo(double x1, double y1, double x2, double y2, double r) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).addArcTo({1},{2},{3},{4})", new Object[] {getID(), x1, y1, x2, y2}); } Arc2D arc = new Arc2D(); arc.setArcByTangent( --- 30,93 ---- import com.sun.javafx.geom.Path2D; import com.sun.javafx.geom.PathIterator; import com.sun.javafx.geom.Point2D; import com.sun.javafx.geom.RectBounds; import com.sun.javafx.geom.RoundRectangle2D; import com.sun.javafx.geom.transform.BaseTransform; import com.sun.webkit.graphics.WCPath; import com.sun.webkit.graphics.WCPathIterator; import com.sun.webkit.graphics.WCRectangle; ! import com.sun.javafx.logging.PlatformLogger; ! import com.sun.javafx.logging.PlatformLogger.Level; final class WCPathImpl extends WCPath<Path2D> { private final Path2D path; private boolean hasCP = false; ! private final static PlatformLogger log = ! PlatformLogger.getLogger(WCPathImpl.class.getName()); WCPathImpl() { if (log.isLoggable(Level.FINE)) { ! log.fine("Create empty WCPathImpl({0})", getID()); } path = new Path2D(); } WCPathImpl(WCPathImpl wcp) { if (log.isLoggable(Level.FINE)) { ! log.fine("Create WCPathImpl({0}) from WCPathImpl({1})", new Object[] { getID(), wcp.getID()}); } path = new Path2D(wcp.path); hasCP = wcp.hasCP; } public void addRect(double x, double y, double w, double h) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).addRect({1},{2},{3},{4})", new Object[] {getID(), x, y, w, h}); } hasCP = true; path.append(new RoundRectangle2D( (float)x, (float)y, (float)w, (int)h, 0.0f, 0.0f), false); } public void addEllipse(double x, double y, double w, double h) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).addEllipse({1},{2},{3},{4})", new Object[] {getID(), x, y, w, h}); } hasCP = true; path.append(new Ellipse2D((float)x, (float)y, (float)w, (float)h), false); } public void addArcTo(double x1, double y1, double x2, double y2, double r) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).addArcTo({1},{2},{3},{4})", new Object[] {getID(), x1, y1, x2, y2}); } Arc2D arc = new Arc2D(); arc.setArcByTangent(
*** 111,121 **** final float TWO_PI = 2.0f * (float) Math.PI; float startAngle = (float) sa; float endAngle = (float) ea; if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).addArc(x={1},y={2},r={3},sa=|{4}|,ea=|{5}|,aclock={6})", new Object[] {getID(), x, y, r, startAngle, endAngle, aclockwise}); } hasCP = true; --- 107,117 ---- final float TWO_PI = 2.0f * (float) Math.PI; float startAngle = (float) sa; float endAngle = (float) ea; if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).addArc(x={1},y={2},r={3},sa=|{4}|,ea=|{5}|,aclock={6})", new Object[] {getID(), x, y, r, startAngle, endAngle, aclockwise}); } hasCP = true;
*** 160,170 **** (float) Math.toDegrees(startAngle - newEndAngle), Arc2D.OPEN), true); } public boolean contains(int rule, double x, double y) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).contains({1},{2},{3})", new Object[] {getID(), rule, x, y}); } final int savedRule = path.getWindingRule(); path.setWindingRule(rule); final boolean res = path.contains((float)x, (float)y); --- 156,166 ---- (float) Math.toDegrees(startAngle - newEndAngle), Arc2D.OPEN), true); } public boolean contains(int rule, double x, double y) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).contains({1},{2},{3})", new Object[] {getID(), rule, x, y}); } final int savedRule = path.getWindingRule(); path.setWindingRule(rule); final boolean res = path.contains((float)x, (float)y);
*** 179,244 **** return new WCRectangle(b.getMinX(), b.getMinY(), b.getWidth(), b.getHeight()); } public void clear() { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).clear()", getID()); } hasCP = false; path.reset(); } public void moveTo(double x, double y) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).moveTo({1},{2})", new Object[] {getID(), x, y}); } hasCP = true; path.moveTo((float)x, (float)y); } public void addLineTo(double x, double y) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).addLineTo({1},{2})", new Object[] {getID(), x, y}); } hasCP = true; path.lineTo((float)x, (float)y); } public void addQuadCurveTo(double x0, double y0, double x1, double y1) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).addQuadCurveTo({1},{2},{3},{4})", new Object[] {getID(), x0, y0, x1, y1}); } hasCP = true; path.quadTo((float)x0, (float)y0, (float)x1, (float)y1); } public void addBezierCurveTo(double x0, double y0, double x1, double y1, double x2, double y2) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).addBezierCurveTo({1},{2},{3},{4},{5},{6})", new Object[] {getID(), x0, y0, x1, y1, x2, y2}); } hasCP = true; path.curveTo((float)x0, (float)y0, (float)x1, (float)y1, (float)x2, (float)y2); } public void addPath(WCPath p) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).addPath({1})", new Object[] {getID(), p.getID()}); } hasCP = hasCP || ((WCPathImpl)p).hasCP; path.append(((WCPathImpl)p).path, false); } public void closeSubpath() { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).closeSubpath()", getID()); } path.closePath(); } public boolean hasCurrentPoint() { --- 175,240 ---- return new WCRectangle(b.getMinX(), b.getMinY(), b.getWidth(), b.getHeight()); } public void clear() { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).clear()", getID()); } hasCP = false; path.reset(); } public void moveTo(double x, double y) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).moveTo({1},{2})", new Object[] {getID(), x, y}); } hasCP = true; path.moveTo((float)x, (float)y); } public void addLineTo(double x, double y) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).addLineTo({1},{2})", new Object[] {getID(), x, y}); } hasCP = true; path.lineTo((float)x, (float)y); } public void addQuadCurveTo(double x0, double y0, double x1, double y1) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).addQuadCurveTo({1},{2},{3},{4})", new Object[] {getID(), x0, y0, x1, y1}); } hasCP = true; path.quadTo((float)x0, (float)y0, (float)x1, (float)y1); } public void addBezierCurveTo(double x0, double y0, double x1, double y1, double x2, double y2) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).addBezierCurveTo({1},{2},{3},{4},{5},{6})", new Object[] {getID(), x0, y0, x1, y1, x2, y2}); } hasCP = true; path.curveTo((float)x0, (float)y0, (float)x1, (float)y1, (float)x2, (float)y2); } public void addPath(WCPath p) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).addPath({1})", new Object[] {getID(), p.getID()}); } hasCP = hasCP || ((WCPathImpl)p).hasCP; path.append(((WCPathImpl)p).path, false); } public void closeSubpath() { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).closeSubpath()", getID()); } path.closePath(); } public boolean hasCurrentPoint() {
*** 268,296 **** this.path.setWindingRule(1 - rule); // convert webkit to prism } public Path2D getPlatformPath() { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).getPath() BEGIN=====", getID()); PathIterator pi = path.getPathIterator(null); float [] coords = new float[6]; while(!pi.isDone()) { switch(pi.currentSegment(coords)) { case PathIterator.SEG_MOVETO: ! log.log(Level.FINE, "SEG_MOVETO ({0},{1})", new Object[] {coords[0], coords[1]}); break; case PathIterator.SEG_LINETO: ! log.log(Level.FINE, "SEG_LINETO ({0},{1})", new Object[] {coords[0], coords[1]}); break; case PathIterator.SEG_QUADTO: ! log.log(Level.FINE, "SEG_QUADTO ({0},{1},{2},{3})", new Object[] {coords[0], coords[1], coords[2], coords[3]}); break; case PathIterator.SEG_CUBICTO: ! log.log(Level.FINE, "SEG_CUBICTO ({0},{1},{2},{3},{4},{5})", new Object[] {coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]}); break; case PathIterator.SEG_CLOSE: log.fine("SEG_CLOSE"); --- 264,292 ---- this.path.setWindingRule(1 - rule); // convert webkit to prism } public Path2D getPlatformPath() { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).getPath() BEGIN=====", getID()); PathIterator pi = path.getPathIterator(null); float [] coords = new float[6]; while(!pi.isDone()) { switch(pi.currentSegment(coords)) { case PathIterator.SEG_MOVETO: ! log.fine("SEG_MOVETO ({0},{1})", new Object[] {coords[0], coords[1]}); break; case PathIterator.SEG_LINETO: ! log.fine("SEG_LINETO ({0},{1})", new Object[] {coords[0], coords[1]}); break; case PathIterator.SEG_QUADTO: ! log.fine("SEG_QUADTO ({0},{1},{2},{3})", new Object[] {coords[0], coords[1], coords[2], coords[3]}); break; case PathIterator.SEG_CUBICTO: ! log.fine("SEG_CUBICTO ({0},{1},{2},{3},{4},{5})", new Object[] {coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]}); break; case PathIterator.SEG_CLOSE: log.fine("SEG_CLOSE");
*** 330,351 **** } public void translate(double x, double y) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).translate({1}, {2})", new Object[] {getID(), x, y}); } path.transform(BaseTransform.getTranslateInstance(x, y)); } public void transform(double mxx, double myx, double mxy, double myy, double mxt, double myt) { if (log.isLoggable(Level.FINE)) { ! log.log(Level.FINE, "WCPathImpl({0}).transform({1},{2},{3},{4},{5},{6})", new Object[] {getID(), mxx, myx, mxy, myy, mxt, myt}); } path.transform(BaseTransform.getInstance(mxx, myx, mxy, myy, mxt, myt)); } } --- 326,347 ---- } public void translate(double x, double y) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).translate({1}, {2})", new Object[] {getID(), x, y}); } path.transform(BaseTransform.getTranslateInstance(x, y)); } public void transform(double mxx, double myx, double mxy, double myy, double mxt, double myt) { if (log.isLoggable(Level.FINE)) { ! log.fine("WCPathImpl({0}).transform({1},{2},{3},{4},{5},{6})", new Object[] {getID(), mxx, myx, mxy, myy, mxt, myt}); } path.transform(BaseTransform.getInstance(mxx, myx, mxy, myy, mxt, myt)); } }
< prev index next >