changeset 13617:908481d0ee1d

8143150: DrawImagePipe can skip some unnecessary blits Reviewed-by: flar
author serb
date Tue, 29 Dec 2015 16:41:34 +0300
parents f3ae57f4bef1
children f298f4a5d8a3
files src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java	Thu Dec 24 09:07:50 2015 -0800
+++ b/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,