1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
937 * to the point where they will try to process a negative
938 * area of pixels and throw exceptions. The real fix is
939 * to modify the Java loops to do proper clipping so that
940 * they can deal with negative dimensions as well as
941 * improperly large dimensions, but that fix is too risky
942 * to integrate for Mantis at this point. In the meantime
943 * eliminating the negative or zero dimensions here is
944 * "correct" and saves them from some nasty exceptional
945 * conditions, one of which is the test case of 4783274.
946 */
947 return;
948 }
949 CompositeType comp = sg.imageComp;
950 if (CompositeType.SrcOverNoEa.equals(comp) &&
951 (srcData.getTransparency() == Transparency.OPAQUE ||
952 (bgColor != null &&
953 bgColor.getTransparency() == Transparency.OPAQUE)))
954 {
955 comp = CompositeType.SrcNoEa;
956 }
957 if (!isBgOperation(srcData, bgColor)) {
958 Blit blit = Blit.getFromCache(srcType, comp, dstType);
959 blit.Blit(srcData, dstData, sg.composite, clipRegion,
960 sx, sy, dx, dy, w, h);
961 } else {
962 BlitBg blit = BlitBg.getFromCache(srcType, comp, dstType);
963 blit.BlitBg(srcData, dstData, sg.composite, clipRegion,
964 bgColor.getRGB(), sx, sy, dx, dy, w, h);
965 }
966 }
967
968 protected boolean scaleSurfaceData(SunGraphics2D sg,
969 Region clipRegion,
970 SurfaceData srcData,
971 SurfaceData dstData,
972 SurfaceType srcType,
973 SurfaceType dstType,
974 int sx1, int sy1,
975 int sx2, int sy2,
976 double dx1, double dy1,
|
1 /*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
937 * to the point where they will try to process a negative
938 * area of pixels and throw exceptions. The real fix is
939 * to modify the Java loops to do proper clipping so that
940 * they can deal with negative dimensions as well as
941 * improperly large dimensions, but that fix is too risky
942 * to integrate for Mantis at this point. In the meantime
943 * eliminating the negative or zero dimensions here is
944 * "correct" and saves them from some nasty exceptional
945 * conditions, one of which is the test case of 4783274.
946 */
947 return;
948 }
949 CompositeType comp = sg.imageComp;
950 if (CompositeType.SrcOverNoEa.equals(comp) &&
951 (srcData.getTransparency() == Transparency.OPAQUE ||
952 (bgColor != null &&
953 bgColor.getTransparency() == Transparency.OPAQUE)))
954 {
955 comp = CompositeType.SrcNoEa;
956 }
957 if (srcData == dstData && sx == dx && sy == dy
958 && CompositeType.SrcNoEa.equals(comp)) {
959 // Performance optimization. We skip the Blit/BlitBG if we know that
960 // it will be noop.
961 return;
962 }
963 if (!isBgOperation(srcData, bgColor)) {
964 Blit blit = Blit.getFromCache(srcType, comp, dstType);
965 blit.Blit(srcData, dstData, sg.composite, clipRegion,
966 sx, sy, dx, dy, w, h);
967 } else {
968 BlitBg blit = BlitBg.getFromCache(srcType, comp, dstType);
969 blit.BlitBg(srcData, dstData, sg.composite, clipRegion,
970 bgColor.getRGB(), sx, sy, dx, dy, w, h);
971 }
972 }
973
974 protected boolean scaleSurfaceData(SunGraphics2D sg,
975 Region clipRegion,
976 SurfaceData srcData,
977 SurfaceData dstData,
978 SurfaceType srcType,
979 SurfaceType dstType,
980 int sx1, int sy1,
981 int sx2, int sy2,
982 double dx1, double dy1,
|