[OpenJDK 2D-Dev] RFR: 8254788: Dead code in the sun.java2d.xr.XRPMBlitLoops$XrSwToPMBlit

Sergey Bylokhov serb at openjdk.java.net
Wed Oct 14 19:41:22 UTC 2020


The XrSwToPMBlit is a blit which is used as a direct(unscaled) blit of the image in the memory to the pixmap. It tries
to optimize the SrcOver composite in case of an opaque source image and use Src instead:

        if (CompositeType.SrcOverNoEa.equals(comp) && (src.getTransparency() == Transparency.OPAQUE)) {
            Blit opaqueSwToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, dst.getSurfaceType());
            opaqueSwToSurfaceBlit.Blit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
        } else {

The code above does not work for two reasons:
- The check "CompositeType.SrcOverNoEa.equals(comp)" always fails because the comp is of type
  Composite(AlphaComposite/XORComposite/etc) not a CompositeType
 - This optimisation is applied already in the sun.java2d.pipe.DrawImage#blitSurfaceData:
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java#L933

-------------

Commit messages:
 - Update XRPMBlitLoops.java

Changes: https://git.openjdk.java.net/jdk/pull/665/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=665&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8254788
  Stats: 15 lines in 1 file changed: 0 ins; 6 del; 9 mod
  Patch: https://git.openjdk.java.net/jdk/pull/665.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/665/head:pull/665

PR: https://git.openjdk.java.net/jdk/pull/665


More information about the 2d-dev mailing list