Search in sources :

Example 1 with PixelToParallelogramConverter

use of sun.java2d.pipe.PixelToParallelogramConverter in project jdk8u_jdk by JetBrains.

the class OGLSurfaceData method validatePipe.

public void validatePipe(SunGraphics2D sg2d) {
    TextPipe textpipe;
    boolean validated = false;
    if (/* CompositeType.SrcNoEa (any color) */
    (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY && sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) || /* CompositeType.SrcOver (any color) */
    (sg2d.compositeState == SunGraphics2D.COMP_ALPHA && sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR && (((AlphaComposite) sg2d.composite).getRule() == AlphaComposite.SRC_OVER)) || /* CompositeType.Xor (any color) */
    (sg2d.compositeState == SunGraphics2D.COMP_XOR && sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR)) {
        textpipe = oglTextPipe;
    } 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;
    OGLRenderer nonTxPipe = null;
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
            if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
                txPipe = oglTxRenderPipe;
                nonTxPipe = oglRenderPipe;
            }
        } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
            if (OGLPaints.isValid(sg2d)) {
                txPipe = oglTxRenderPipe;
                nonTxPipe = oglRenderPipe;
            }
        // custom paints handled by super.validatePipe() below
        }
    } else {
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
            if (graphicsConfig.isCapPresent(CAPS_PS30) && (sg2d.imageComp == CompositeType.SrcOverNoEa || sg2d.imageComp == CompositeType.SrcOver)) {
                if (!validated) {
                    super.validatePipe(sg2d);
                    validated = true;
                }
                PixelToParallelogramConverter aaConverter = new PixelToParallelogramConverter(sg2d.shapepipe, oglAAPgramPipe, 1.0 / 8.0, 0.499, false);
                sg2d.drawpipe = aaConverter;
                sg2d.fillpipe = aaConverter;
                sg2d.shapepipe = aaConverter;
            } else if (sg2d.compositeState == SunGraphics2D.COMP_XOR) {
                // install the solid pipes when AA and XOR are both enabled
                txPipe = oglTxRenderPipe;
                nonTxPipe = oglRenderPipe;
            }
        }
    // other cases handled by super.validatePipe() below
    }
    if (txPipe != null) {
        if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
            sg2d.drawpipe = txPipe;
            sg2d.fillpipe = txPipe;
        } else if (sg2d.strokeState != SunGraphics2D.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 OGL pipe
    sg2d.imagepipe = oglImagePipe;
}
Also used : AlphaComposite(java.awt.AlphaComposite) TextPipe(sun.java2d.pipe.TextPipe) PixelToParallelogramConverter(sun.java2d.pipe.PixelToParallelogramConverter)

Example 2 with PixelToParallelogramConverter

use of sun.java2d.pipe.PixelToParallelogramConverter in project jdk8u_jdk by JetBrains.

the class SurfaceData method validatePipe.

public void validatePipe(SunGraphics2D sg2d) {
    sg2d.imagepipe = imagepipe;
    if (sg2d.compositeState == SunGraphics2D.COMP_XOR) {
        if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) {
            sg2d.drawpipe = paintViaShape;
            sg2d.fillpipe = paintViaShape;
            sg2d.shapepipe = paintShape;
            // REMIND: Ideally custom paint mode would use glyph
            // rendering as opposed to outline rendering but the
            // glyph paint rendering pipeline uses MaskBlit which
            // is not defined for XOR.  This means that text drawn
            // in XOR mode with a Color object is different than
            // text drawn in XOR mode with a Paint object.
            sg2d.textpipe = outlineTextRenderer;
        } else {
            PixelToShapeConverter converter;
            if (canRenderParallelograms(sg2d)) {
                converter = colorViaPgram;
                // 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 = colorViaPgram;
            } else {
                converter = colorViaShape;
                sg2d.shapepipe = colorPrimitives;
            }
            if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
                sg2d.drawpipe = converter;
                sg2d.fillpipe = converter;
                // REMIND: We should not be changing text strategies
                // between outline and glyph rendering based upon the
                // presence of a complex clip as that could cause a
                // mismatch when drawing the same text both clipped
                // and unclipped on two separate rendering passes.
                // Unfortunately, all of the clipped glyph rendering
                // pipelines rely on the use of the MaskBlit operation
                // which is not defined for XOR.
                sg2d.textpipe = outlineTextRenderer;
            } else {
                if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                    sg2d.drawpipe = converter;
                    sg2d.fillpipe = converter;
                } else {
                    if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
                        sg2d.drawpipe = converter;
                    } else {
                        sg2d.drawpipe = colorPrimitives;
                    }
                    sg2d.fillpipe = colorPrimitives;
                }
                sg2d.textpipe = solidTextRenderer;
            }
        // assert(sg2d.surfaceData == this);
        }
    } else if (sg2d.compositeState == SunGraphics2D.COMP_CUSTOM) {
        if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON) {
            if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
                sg2d.drawpipe = AAClipCompViaShape;
                sg2d.fillpipe = AAClipCompViaShape;
                sg2d.shapepipe = AAClipCompViaShape;
                sg2d.textpipe = clipCompText;
            } else {
                sg2d.drawpipe = AACompViaShape;
                sg2d.fillpipe = AACompViaShape;
                sg2d.shapepipe = AACompViaShape;
                sg2d.textpipe = compText;
            }
        } else {
            sg2d.drawpipe = compViaShape;
            sg2d.fillpipe = compViaShape;
            sg2d.shapepipe = compShape;
            if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
                sg2d.textpipe = clipCompText;
            } else {
                sg2d.textpipe = compText;
            }
        }
    } else if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON) {
        sg2d.alphafill = getMaskFill(sg2d);
        // assert(sg2d.surfaceData == this);
        if (sg2d.alphafill != null) {
            if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
                sg2d.drawpipe = AAClipColorViaShape;
                sg2d.fillpipe = AAClipColorViaShape;
                sg2d.shapepipe = AAClipColorViaShape;
                sg2d.textpipe = clipColorText;
            } else {
                PixelToParallelogramConverter converter = (sg2d.alphafill.canDoParallelograms() ? AAColorViaPgram : AAColorViaShape);
                sg2d.drawpipe = converter;
                sg2d.fillpipe = converter;
                sg2d.shapepipe = converter;
                if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR || sg2d.compositeState > SunGraphics2D.COMP_ISCOPY) {
                    sg2d.textpipe = colorText;
                } else {
                    sg2d.textpipe = getTextPipe(sg2d, true);
                }
            }
        } else {
            if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
                sg2d.drawpipe = AAClipPaintViaShape;
                sg2d.fillpipe = AAClipPaintViaShape;
                sg2d.shapepipe = AAClipPaintViaShape;
                sg2d.textpipe = clipPaintText;
            } else {
                sg2d.drawpipe = AAPaintViaShape;
                sg2d.fillpipe = AAPaintViaShape;
                sg2d.shapepipe = AAPaintViaShape;
                sg2d.textpipe = paintText;
            }
        }
    } else if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR || sg2d.compositeState > SunGraphics2D.COMP_ISCOPY || sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        sg2d.drawpipe = paintViaShape;
        sg2d.fillpipe = paintViaShape;
        sg2d.shapepipe = paintShape;
        sg2d.alphafill = getMaskFill(sg2d);
        // assert(sg2d.surfaceData == this);
        if (sg2d.alphafill != null) {
            if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
                sg2d.textpipe = clipColorText;
            } else {
                sg2d.textpipe = colorText;
            }
        } else {
            if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
                sg2d.textpipe = clipPaintText;
            } else {
                sg2d.textpipe = paintText;
            }
        }
    } else {
        PixelToShapeConverter converter;
        if (canRenderParallelograms(sg2d)) {
            converter = colorViaPgram;
            // 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 = colorViaPgram;
        } else {
            converter = colorViaShape;
            sg2d.shapepipe = colorPrimitives;
        }
        if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
            sg2d.drawpipe = converter;
            sg2d.fillpipe = converter;
        } else {
            if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
                sg2d.drawpipe = converter;
            } else {
                sg2d.drawpipe = colorPrimitives;
            }
            sg2d.fillpipe = colorPrimitives;
        }
        sg2d.textpipe = getTextPipe(sg2d, false);
    // assert(sg2d.surfaceData == this);
    }
    // check for loops
    if (sg2d.textpipe instanceof LoopBasedPipe || sg2d.shapepipe instanceof LoopBasedPipe || sg2d.fillpipe instanceof LoopBasedPipe || sg2d.drawpipe instanceof LoopBasedPipe || sg2d.imagepipe instanceof LoopBasedPipe) {
        sg2d.loops = getRenderLoops(sg2d);
    }
}
Also used : LoopBasedPipe(sun.java2d.pipe.LoopBasedPipe) PixelToShapeConverter(sun.java2d.pipe.PixelToShapeConverter) PixelToParallelogramConverter(sun.java2d.pipe.PixelToParallelogramConverter)

Example 3 with PixelToParallelogramConverter

use of sun.java2d.pipe.PixelToParallelogramConverter in project jdk8u_jdk by JetBrains.

the class D3DSurfaceData method validatePipe.

public void validatePipe(SunGraphics2D sg2d) {
    TextPipe textpipe;
    boolean validated = false;
    // for the surface which had any XOR rendering done to.
    if (sg2d.compositeState >= sg2d.COMP_XOR) {
        super.validatePipe(sg2d);
        sg2d.imagepipe = d3dImagePipe;
        disableAccelerationForSurface();
        return;
    }
    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;
}
Also used : AlphaComposite(java.awt.AlphaComposite) TextPipe(sun.java2d.pipe.TextPipe) PixelToParallelogramConverter(sun.java2d.pipe.PixelToParallelogramConverter)

Aggregations

PixelToParallelogramConverter (sun.java2d.pipe.PixelToParallelogramConverter)3 AlphaComposite (java.awt.AlphaComposite)2 TextPipe (sun.java2d.pipe.TextPipe)2 LoopBasedPipe (sun.java2d.pipe.LoopBasedPipe)1 PixelToShapeConverter (sun.java2d.pipe.PixelToShapeConverter)1