private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) { // REMIND: Eventually, the plan is that it will not be possible for // fs to be null since the FillSpans loop will be the fundamental // loop implemented for any destination type... if (sg2d.clipState == sg2d.CLIP_SHAPE) { si = sg2d.clipRegion.filter(si); // REMIND: Region.filter produces a Java-only iterator // with no native counterpart... } else { sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop; if (fs != null) { fs.FillSpans(sg2d, sg2d.getSurfaceData(), si); return; } } int spanbox[] = new int[4]; SurfaceData sd = sg2d.getSurfaceData(); while (si.nextSpan(spanbox)) { int x = spanbox[0]; int y = spanbox[1]; int w = spanbox[2] - x; int h = spanbox[3] - y; sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h); } }
/** * Construct and return a RenderLoops object containing all of the basic GraphicsPrimitive objects * for rendering to the destination surface with the given source, destination, and composite * types. */ public static RenderLoops makeRenderLoops(SurfaceType src, CompositeType comp, SurfaceType dst) { RenderLoops loops = new RenderLoops(); loops.drawLineLoop = DrawLine.locate(src, comp, dst); loops.fillRectLoop = FillRect.locate(src, comp, dst); loops.drawRectLoop = DrawRect.locate(src, comp, dst); loops.drawPolygonsLoop = DrawPolygons.locate(src, comp, dst); loops.drawPathLoop = DrawPath.locate(src, comp, dst); loops.fillPathLoop = FillPath.locate(src, comp, dst); loops.fillSpansLoop = FillSpans.locate(src, comp, dst); loops.fillParallelogramLoop = FillParallelogram.locate(src, comp, dst); loops.drawParallelogramLoop = DrawParallelogram.locate(src, comp, dst); loops.drawGlyphListLoop = DrawGlyphList.locate(src, comp, dst); loops.drawGlyphListAALoop = DrawGlyphListAA.locate(src, comp, dst); loops.drawGlyphListLCDLoop = DrawGlyphListLCD.locate(src, comp, dst); /* System.out.println("drawLine: "+loops.drawLineLoop); System.out.println("fillRect: "+loops.fillRectLoop); System.out.println("drawRect: "+loops.drawRectLoop); System.out.println("drawPolygons: "+loops.drawPolygonsLoop); System.out.println("fillSpans: "+loops.fillSpansLoop); System.out.println("drawGlyphList: "+loops.drawGlyphListLoop); System.out.println("drawGlyphListAA: "+loops.drawGlyphListAALoop); System.out.println("drawGlyphListLCD: "+loops.drawGlyphListLCDLoop); */ return loops; }