36 import sun.java2d.pipe.PixelFillPipe;
37 import sun.java2d.pipe.ShapeDrawPipe;
38 import sun.java2d.pipe.SpanIterator;
39 import sun.java2d.pipe.ShapeSpanIterator;
40 import sun.java2d.pipe.LoopPipe;
41
42 import static sun.java2d.xr.XRUtils.clampToShort;
43 import static sun.java2d.xr.XRUtils.clampToUShort;
44
45 /**
46 * XRender provides only accalerated rectangles. To emulate higher "order"
47 * geometry we have to pass everything else to DoPath/FillSpans.
48 *
49 * TODO: DrawRect could be instrified
50 *
51 * @author Clemens Eisserer
52 */
53
54 public class XRRenderer implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe {
55 XRDrawHandler drawHandler;
56 MaskTileManager tileManager;
57 XRDrawLine lineGen;
58 GrowableRectArray rectBuffer;
59
60 public XRRenderer(MaskTileManager tileManager) {
61 this.tileManager = tileManager;
62 this.rectBuffer = tileManager.getMainTile().getRects();
63
64 this.drawHandler = new XRDrawHandler();
65 this.lineGen = new XRDrawLine();
66 }
67
68 /**
69 * Common validate method, used by all XRRender functions to validate the
70 * destination context.
71 */
72 private void validateSurface(SunGraphics2D sg2d) {
73 XRSurfaceData xrsd;
74 try {
75 xrsd = (XRSurfaceData) sg2d.surfaceData;
76 } catch (ClassCastException e) {
77 throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
78 }
79 xrsd.validateAsDestination(sg2d, sg2d.getCompClip());
80 xrsd.maskBuffer.validateCompositeState(sg2d.composite, sg2d.transform,
|
36 import sun.java2d.pipe.PixelFillPipe;
37 import sun.java2d.pipe.ShapeDrawPipe;
38 import sun.java2d.pipe.SpanIterator;
39 import sun.java2d.pipe.ShapeSpanIterator;
40 import sun.java2d.pipe.LoopPipe;
41
42 import static sun.java2d.xr.XRUtils.clampToShort;
43 import static sun.java2d.xr.XRUtils.clampToUShort;
44
45 /**
46 * XRender provides only accalerated rectangles. To emulate higher "order"
47 * geometry we have to pass everything else to DoPath/FillSpans.
48 *
49 * TODO: DrawRect could be instrified
50 *
51 * @author Clemens Eisserer
52 */
53
54 public class XRRenderer implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe {
55 XRDrawHandler drawHandler;
56 RectTileManager tileManager;
57 XRDrawLine lineGen;
58 GrowableRectArray rectBuffer;
59
60 public XRRenderer(RectTileManager tileManager) {
61 this.tileManager = tileManager;
62 this.rectBuffer = tileManager.getMainTile().getRects();
63
64 this.drawHandler = new XRDrawHandler();
65 this.lineGen = new XRDrawLine();
66 }
67
68 /**
69 * Common validate method, used by all XRRender functions to validate the
70 * destination context.
71 */
72 private void validateSurface(SunGraphics2D sg2d) {
73 XRSurfaceData xrsd;
74 try {
75 xrsd = (XRSurfaceData) sg2d.surfaceData;
76 } catch (ClassCastException e) {
77 throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
78 }
79 xrsd.validateAsDestination(sg2d, sg2d.getCompClip());
80 xrsd.maskBuffer.validateCompositeState(sg2d.composite, sg2d.transform,
|