8143150: DrawImagePipe can skip some unnecessary blits
authorserb
Tue, 29 Dec 2015 16:41:34 +0300
changeset 35655 92d3ad496b67
parent 35654 68448100f9b4
child 35656 e5582272e65b
8143150: DrawImagePipe can skip some unnecessary blits Reviewed-by: flar
jdk/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java	Thu Dec 24 09:07:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java	Tue Dec 29 16:41:34 2015 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -955,6 +955,12 @@
         {
             comp = CompositeType.SrcNoEa;
         }
+        if (srcData == dstData && sx == dx && sy == dy
+                && CompositeType.SrcNoEa.equals(comp)) {
+            // Performance optimization. We skip the Blit/BlitBG if we know that
+            // it will be noop.
+            return;
+        }
         if (!isBgOperation(srcData, bgColor)) {
             Blit blit = Blit.getFromCache(srcType, comp, dstType);
             blit.Blit(srcData, dstData, sg.composite, clipRegion,