--- old/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.cpp 2016-01-14 20:28:26.292338600 +0300 +++ new/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.cpp 2016-01-14 20:28:25.752337800 +0300 @@ -109,7 +109,7 @@ // Horiz/vertical #define HV_FF1 ( 0.0f) -#define HV_FF2 ( 0.51f) +#define HV_FF2 ( 0.501f) // For the record: value below (or larger) is required for Intel 855, but // breaks Nvidia, ATI and Intel 965, and since the pipeline is disabled on // 855 anyway we'll use 0.51f. --- /dev/null 2016-01-14 20:28:30.000000000 +0300 +++ new/test/java/awt/Graphics2D/RenderRectTest/RenderRectTest.java 2016-01-14 20:28:29.405343100 +0300 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/** + * @test + * @bug 8146042 + * @run main RenderRectTest + */ + +import javax.swing.*; +import java.awt.*; + +import java.awt.image.BufferedImage; + + +public class RenderRectTest { + private static JFrame frame; + private static Panel panel; + private static Point pt; + + public static void main(String[] args) throws Exception { + + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame(); + panel = new Panel() { + @Override + public void paint(Graphics graphics) { + graphics.setColor(Color.black); + graphics.drawRect(100, 100, 9, 9); + } + }; + panel.setBackground(Color.white); + panel.setPreferredSize(new Dimension(200, 200)); + panel.setMinimumSize(new Dimension(200, 200)); + panel.setMaximumSize(new Dimension(200, 200)); + frame.getContentPane().add(panel); + frame.pack(); + frame.setVisible(true); + }); + + + Robot robot = new Robot(); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> pt = panel.getLocationOnScreen()); + + pt.translate(100-1, 100-1); + BufferedImage capture = robot.createScreenCapture( + new Rectangle(pt, new Dimension(10 + 2, 10 + 2))); + + SwingUtilities.invokeLater(() -> frame.dispose()); + + int w = capture.getWidth(); + int h = capture.getHeight(); + for(int y = 0; y < h >> 1; y++) { + for(int x = 0; x < w >> 1; x++) { + if( x > 0 && y > 0 && (x == 1 || y == 1)) { + if((capture.getRGB(x, y) + | capture.getRGB(x, h - 1 - y) + | capture.getRGB(w - 1 - x, y) + | capture.getRGB(w - 1 - x, h - 1 - y)) != + Color.black.getRGB()) { + throw new RuntimeException("Wrong rectangle"); + } + } else { + if((capture.getRGB(x, y) + & capture.getRGB(x, h - 1 - y) + & capture.getRGB(w - 1 - x, y) + & capture.getRGB(w - 1 - x, h - 1 - y)) != + Color.white.getRGB()) { + throw new RuntimeException("Wrong rectangle"); + } + } + } + } + } +}