Search in sources :

Example 1 with BlitBg

use of sun.java2d.loops.BlitBg in project jdk8u_jdk by JetBrains.

the class SurfaceDataProxy method updateSurfaceDataBg.

/**
     * This is an alternate implementation for updating the cached
     * SurfaceData from the source (primary) SurfaceData using a
     * background color for transparent pixels.
     * A simple BlitBg is used to copy the pixels from the source to
     * the destination SurfaceData with the specified bgColor.
     * A subclass can override the normal updateSurfaceData method
     * and call this implementation instead if it wants to use color
     * keying for bitmask images.
     */
public void updateSurfaceDataBg(SurfaceData srcData, SurfaceData dstData, int w, int h, Color bgColor) {
    SurfaceType srcType = srcData.getSurfaceType();
    SurfaceType dstType = dstData.getSurfaceType();
    BlitBg blitbg = BlitBg.getFromCache(srcType, CompositeType.SrcNoEa, dstType);
    blitbg.BlitBg(srcData, dstData, AlphaComposite.Src, null, bgColor.getRGB(), 0, 0, 0, 0, w, h);
    dstData.markDirty();
}
Also used : BlitBg(sun.java2d.loops.BlitBg) SurfaceType(sun.java2d.loops.SurfaceType)

Example 2 with BlitBg

use of sun.java2d.loops.BlitBg in project jdk8u_jdk by JetBrains.

the class DrawImage method blitSurfaceData.

protected void blitSurfaceData(SunGraphics2D sg, Region clipRegion, SurfaceData srcData, SurfaceData dstData, SurfaceType srcType, SurfaceType dstType, int sx, int sy, int dx, int dy, int w, int h, Color bgColor) {
    if (w <= 0 || h <= 0) {
        /*
             * Fix for bugid 4783274 - BlitBg throws an exception for
             * a particular set of anomalous parameters.
             * REMIND: The native loops do proper clipping and would
             * detect this situation themselves, but the Java loops
             * all seem to trust their parameters a little too well
             * to the point where they will try to process a negative
             * area of pixels and throw exceptions.  The real fix is
             * to modify the Java loops to do proper clipping so that
             * they can deal with negative dimensions as well as
             * improperly large dimensions, but that fix is too risky
             * to integrate for Mantis at this point.  In the meantime
             * eliminating the negative or zero dimensions here is
             * "correct" and saves them from some nasty exceptional
             * conditions, one of which is the test case of 4783274.
             */
        return;
    }
    CompositeType comp = sg.imageComp;
    if (CompositeType.SrcOverNoEa.equals(comp) && (srcData.getTransparency() == Transparency.OPAQUE || (bgColor != null && bgColor.getTransparency() == Transparency.OPAQUE))) {
        comp = CompositeType.SrcNoEa;
    }
    if (!isBgOperation(srcData, bgColor)) {
        Blit blit = Blit.getFromCache(srcType, comp, dstType);
        blit.Blit(srcData, dstData, sg.composite, clipRegion, sx, sy, dx, dy, w, h);
    } else {
        BlitBg blit = BlitBg.getFromCache(srcType, comp, dstType);
        blit.BlitBg(srcData, dstData, sg.composite, clipRegion, bgColor.getRGB(), sx, sy, dx, dy, w, h);
    }
}
Also used : BlitBg(sun.java2d.loops.BlitBg) Blit(sun.java2d.loops.Blit) MaskBlit(sun.java2d.loops.MaskBlit) ScaledBlit(sun.java2d.loops.ScaledBlit) CompositeType(sun.java2d.loops.CompositeType)

Aggregations

BlitBg (sun.java2d.loops.BlitBg)2 Blit (sun.java2d.loops.Blit)1 CompositeType (sun.java2d.loops.CompositeType)1 MaskBlit (sun.java2d.loops.MaskBlit)1 ScaledBlit (sun.java2d.loops.ScaledBlit)1 SurfaceType (sun.java2d.loops.SurfaceType)1