public void validatePipe(SunGraphics2D sg2d) { if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON && sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR && (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY || sg2d.compositeState == SunGraphics2D.COMP_XOR)) { if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { // Do this to init textpipe correctly; we will override the // other non-text pipes below // REMIND: we should clean this up eventually instead of // having this work duplicated. super.validatePipe(sg2d); } else { switch (sg2d.textAntialiasHint) { case SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT: /* equate DEFAULT to OFF which it is for us */ case SunHints.INTVAL_TEXT_ANTIALIAS_OFF: sg2d.textpipe = solidTextRenderer; break; case SunHints.INTVAL_TEXT_ANTIALIAS_ON: sg2d.textpipe = aaTextRenderer; break; default: switch (sg2d.getFontInfo().aaHint) { case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB: case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB: sg2d.textpipe = lcdTextRenderer; break; case SunHints.INTVAL_TEXT_ANTIALIAS_ON: sg2d.textpipe = aaTextRenderer; break; default: sg2d.textpipe = solidTextRenderer; } } } sg2d.imagepipe = imagepipe; if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { sg2d.drawpipe = gdiTxPipe; sg2d.fillpipe = gdiTxPipe; } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) { sg2d.drawpipe = gdiTxPipe; sg2d.fillpipe = gdiPipe; } else { sg2d.drawpipe = gdiPipe; sg2d.fillpipe = gdiPipe; } sg2d.shapepipe = gdiPipe; // This is needed for AA text. // Note that even a SolidTextRenderer can dispatch AA text // if a GlyphVector overrides the AA setting. // We use getRenderLoops() rather than setting solidloops // directly so that we get the appropriate loops in XOR mode. if (sg2d.loops == null) { // assert(some pipe will always be a LoopBasedPipe) sg2d.loops = getRenderLoops(sg2d); } } else { super.validatePipe(sg2d); } }
public void validatePipe(SunGraphics2D sg2d) { TextPipe textpipe; boolean validated = false; // REMIND: the D3D pipeline doesn't support XOR!, more // fixes will be needed below. For now we disable D3D rendering // for the surface which had any XOR rendering done to. if (sg2d.compositeState >= sg2d.COMP_XOR) { super.validatePipe(sg2d); sg2d.imagepipe = d3dImagePipe; disableAccelerationForSurface(); return; } // D3DTextRenderer handles both AA and non-AA text, but // only works with the following modes: // (Note: For LCD text we only enter this code path if // canRenderLCDText() has already validated that the mode is // CompositeType.SrcNoEa (opaque color), which will be subsumed // by the CompositeType.SrcNoEa (any color) test below.) if ( /* CompositeType.SrcNoEa (any color) */ (sg2d.compositeState <= sg2d.COMP_ISCOPY && sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) || /* CompositeType.SrcOver (any color) */ (sg2d.compositeState == sg2d.COMP_ALPHA && sg2d.paintState <= sg2d.PAINT_ALPHACOLOR && (((AlphaComposite) sg2d.composite).getRule() == AlphaComposite.SRC_OVER)) || /* CompositeType.Xor (any color) */ (sg2d.compositeState == sg2d.COMP_XOR && sg2d.paintState <= sg2d.PAINT_ALPHACOLOR)) { textpipe = d3dTextPipe; } else { // do this to initialize textpipe correctly; we will attempt // to override the non-text pipes below super.validatePipe(sg2d); textpipe = sg2d.textpipe; validated = true; } PixelToParallelogramConverter txPipe = null; D3DRenderer nonTxPipe = null; if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) { if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) { if (sg2d.compositeState <= sg2d.COMP_XOR) { txPipe = d3dTxRenderPipe; nonTxPipe = d3dRenderPipe; } } else if (sg2d.compositeState <= sg2d.COMP_ALPHA) { if (D3DPaints.isValid(sg2d)) { txPipe = d3dTxRenderPipe; nonTxPipe = d3dRenderPipe; } // custom paints handled by super.validatePipe() below } } else { if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) { if (graphicsDevice.isCapPresent(CAPS_AA_SHADER) && (sg2d.imageComp == CompositeType.SrcOverNoEa || sg2d.imageComp == CompositeType.SrcOver)) { if (!validated) { super.validatePipe(sg2d); validated = true; } PixelToParallelogramConverter aaConverter = new PixelToParallelogramConverter( sg2d.shapepipe, d3dAAPgramPipe, 1.0 / 8.0, 0.499, false); sg2d.drawpipe = aaConverter; sg2d.fillpipe = aaConverter; sg2d.shapepipe = aaConverter; } else if (sg2d.compositeState == sg2d.COMP_XOR) { // install the solid pipes when AA and XOR are both enabled txPipe = d3dTxRenderPipe; nonTxPipe = d3dRenderPipe; } } // other cases handled by super.validatePipe() below } if (txPipe != null) { if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) { sg2d.drawpipe = txPipe; sg2d.fillpipe = txPipe; } else if (sg2d.strokeState != sg2d.STROKE_THIN) { sg2d.drawpipe = txPipe; sg2d.fillpipe = nonTxPipe; } else { sg2d.drawpipe = nonTxPipe; sg2d.fillpipe = nonTxPipe; } // Note that we use the transforming pipe here because it // will examine the shape and possibly perform an optimized // operation if it can be simplified. The simplifications // will be valid for all STROKE and TRANSFORM types. sg2d.shapepipe = txPipe; } else { if (!validated) { super.validatePipe(sg2d); } } // install the text pipe based on our earlier decision sg2d.textpipe = textpipe; // always override the image pipe with the specialized D3D pipe sg2d.imagepipe = d3dImagePipe; }