< prev index next >

src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java

Print this page




  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 final 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,
  81                                                sg2d.paint, sg2d);
  82     }
  83 
  84     public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) {
  85         Region compClip = sg2d.getCompClip();
  86         int transX1 = Region.clipAdd(x1, sg2d.transX);
  87         int transY1 = Region.clipAdd(y1, sg2d.transY);
  88         int transX2 = Region.clipAdd(x2, sg2d.transX);
  89         int transY2 = Region.clipAdd(y2, sg2d.transY);
  90 
  91         SunToolkit.awtLock();
  92         try {




  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,
  81                                                sg2d.paint, sg2d);
  82     }
  83 
  84     public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) {
  85         Region compClip = sg2d.getCompClip();
  86         int transX1 = Region.clipAdd(x1, sg2d.transX);
  87         int transY1 = Region.clipAdd(y1, sg2d.transY);
  88         int transX2 = Region.clipAdd(x2, sg2d.transX);
  89         int transY2 = Region.clipAdd(y2, sg2d.transY);
  90 
  91         SunToolkit.awtLock();
  92         try {


< prev index next >