/hg/icedtea6: Backports: patches/openjdk/6728834-blurred-lcd-aa-...
dlila at icedtea.classpath.org
dlila at icedtea.classpath.org
Thu Feb 17 09:06:27 PST 2011
changeset 34511f89bc1d in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=34511f89bc1d
author: Denis Lila <dlila at redhat.com>
date: Thu Feb 17 12:09:44 2011 -0500
Backports: patches/openjdk/6728834-blurred-lcd-aa-text.patch,
patches/openjdk/6749060-bad-lcd-aa-non-opaque-dest.patch
diffstat:
5 files changed, 456 insertions(+)
ChangeLog | 7
Makefile.am | 2
NEWS | 2
patches/openjdk/6728834-blurred-lcd-aa-text.patch | 226 ++++++++++++++
patches/openjdk/6749060-bad-lcd-aa-non-opaque-dest.patch | 219 +++++++++++++
diffs (491 lines):
diff -r 3f247fe29393 -r 34511f89bc1d ChangeLog
--- a/ChangeLog Wed Feb 16 22:23:50 2011 +0100
+++ b/ChangeLog Thu Feb 17 12:09:44 2011 -0500
@@ -1,3 +1,10 @@ 2011-02-16 Xerxes Ranby <xerxes at zafena
+2011-02-16 Denis Lila <dlila at redhat.com>
+
+ * NEWS: Update with the backports
+ * Makefile.am (ICEDTEA_PATCHES): Added the 2 patches
+ * patches/openjdk/6728834-blurred-lcd-aa-text.patch
+ * patches/openjdk/6749060-bad-lcd-aa-non-opaque-dest.patch
+
2011-02-16 Xerxes Ranby <xerxes at zafena.se>
Mark Wielaard <mark at klomp.org>
diff -r 3f247fe29393 -r 34511f89bc1d Makefile.am
--- a/Makefile.am Wed Feb 16 22:23:50 2011 +0100
+++ b/Makefile.am Thu Feb 17 12:09:44 2011 -0500
@@ -304,6 +304,8 @@ ICEDTEA_PATCHES = \
patches/no-static-linking.patch \
patches/rh676659-gcc-export-dynamic.patch \
patches/g344659-sparc_fix.patch \
+ patches/openjdk/6728834-blurred-lcd-aa-text.patch \
+ patches/openjdk/6749060-bad-lcd-aa-non-opaque-dest.patch \
patches/openjdk/6896068-sg2d.patch
if !WITH_ALT_HSBUILD
diff -r 3f247fe29393 -r 34511f89bc1d NEWS
--- a/NEWS Wed Feb 16 22:23:50 2011 +0100
+++ b/NEWS Thu Feb 17 12:09:44 2011 -0500
@@ -419,6 +419,8 @@ New in release 1.10 (2011-XX-XX):
- S7017581: missing copyright header in test/sun/java2d/pipe/RegionOps.java
- S6896068: SunGraphics2D exposes a reference to itself while non fully initialised.
- PR632: patches/security/20110215/6878713.patch breaks shark zero build
+ - S6749060: LCD AA text rendered incorrectly when destination is non opaque (sw pipeline only)
+ - S6728834: D3D/OGL: LCD AA text becomes bold and blurred when rendering to a non-opaque destination
* Bug fixes
- RH661505: JPEGs with sRGB IEC61966-2.1 color profiles have wrong colors
- PR616, PR99: Don't statically link libstdc++ or libgcc
diff -r 3f247fe29393 -r 34511f89bc1d patches/openjdk/6728834-blurred-lcd-aa-text.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/openjdk/6728834-blurred-lcd-aa-text.patch Thu Feb 17 12:09:44 2011 -0500
@@ -0,0 +1,226 @@
+# HG changeset patch
+# User tdv
+# Date 1217874568 25200
+# Node ID a56641c1f54e4a81a42ca755a952fd772c14a511
+# Parent e62bc7b05b8a7cd11d7e76f1c29cf07f0c3c7d34
+6728834: D3D/OGL: LCD AA text becomes bold and blurred when rendering to a non-opaque destination
+Reviewed-by: campbell
+
+diff -r e62bc7b05b8a -r a56641c1f54e src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
+--- openjdk.orig/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java Mon Aug 04 18:50:43 2008 +0400
++++ openjdk/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java Mon Aug 04 11:29:28 2008 -0700
+@@ -401,6 +401,7 @@
+ * - the fragment shader extension is available, and
+ * - blending is disabled, and
+ * - the source color is opaque
++ * - and the destination is opaque
+ *
+ * Eventually, we could enhance the native OGL text rendering code
+ * and remove the above restrictions, but that would require significantly
+@@ -410,7 +411,8 @@
+ return
+ graphicsConfig.isCapPresent(CAPS_EXT_LCD_SHADER) &&
+ sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
+- sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR;
++ sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR &&
++ sg2d.surfaceData.getTransparency() == Transparency.OPAQUE;
+ }
+
+ public void validatePipe(SunGraphics2D sg2d) {
+diff -r e62bc7b05b8a -r a56641c1f54e src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
+--- openjdk.orig/jdk/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java Mon Aug 04 18:50:43 2008 +0400
++++ openjdk/jdk/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java Mon Aug 04 11:29:28 2008 -0700
+@@ -501,12 +501,14 @@
+ * - the pixel shaders are available, and
+ * - blending is disabled, and
+ * - the source color is opaque
++ * - and the destination is opaque
+ */
+ public boolean canRenderLCDText(SunGraphics2D sg2d) {
+ return
+ graphicsDevice.isCapPresent(CAPS_LCD_SHADER) &&
+ sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
+- sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR;
++ sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR &&
++ sg2d.surfaceData.getTransparency() == Transparency.OPAQUE;
+ }
+
+ public void validatePipe(SunGraphics2D sg2d) {
+diff -r e62bc7b05b8a -r a56641c1f54e test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ openjdk/jdk/test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java Mon Aug 04 11:29:28 2008 -0700
+@@ -0,0 +1,174 @@
++/*
++ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug 6728834
++ * @summary Tests that LCD AA text rendering works properly with destinations
++ * being VolatileImage of all transparency types
++ * @author Dmitri.Trembovetski: area=Graphics
++ * @run main/manual/othervm NonOpaqueDestLCDAATest
++ * @run main/manual/othervm -Dsun.java2d.opengl=True NonOpaqueDestLCDAATest
++ */
++
++import java.awt.AlphaComposite;
++import java.awt.Color;
++import java.awt.Dimension;
++import java.awt.EventQueue;
++import java.awt.Graphics;
++import java.awt.Graphics2D;
++import java.awt.GraphicsConfiguration;
++import java.awt.RenderingHints;
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.awt.event.ComponentAdapter;
++import java.awt.event.ComponentEvent;
++import java.awt.event.WindowAdapter;
++import java.awt.event.WindowEvent;
++import java.awt.image.VolatileImage;
++import java.io.File;
++import java.util.concurrent.CountDownLatch;
++import javax.imageio.ImageIO;
++import javax.swing.JButton;
++import javax.swing.JFrame;
++import javax.swing.JPanel;
++import javax.swing.JTextArea;
++import static java.awt.Transparency.*;
++
++public class NonOpaqueDestLCDAATest extends JFrame implements ActionListener {
++ private static volatile boolean passed = true;
++ private static CountDownLatch complete = new CountDownLatch(1);
++
++ public NonOpaqueDestLCDAATest() {
++ JTextArea desc = new JTextArea();
++ desc.setText(
++ "\n Instructions: the three text strings below should appear\n" +
++ " readable, without smudges or misshapen bold glyphs.\n\n" +
++ " If they look fine the test PASSED otherwise it FAILED.\n");
++ desc.setEditable(false);
++ desc.setBackground(Color.black);
++ desc.setForeground(Color.green);
++ add("North", desc);
++ JPanel renderPanel = new JPanel() {
++ public void paintComponent(Graphics g) {
++ render(g, getWidth(), getHeight());
++ }
++ };
++ renderPanel.setPreferredSize(new Dimension(350, 150));
++ renderPanel.addComponentListener(new ComponentAdapter() {
++ public void componentResized(ComponentEvent e) {
++ images = null;
++ }
++ });
++ add("Center", renderPanel);
++
++ JButton passed = new JButton("Passed");
++ JButton failed = new JButton("Failed");
++ passed.addActionListener(this);
++ failed.addActionListener(this);
++ JPanel p = new JPanel();
++ p.add(passed);
++ p.add(failed);
++ add("South", p);
++ addWindowListener(new WindowAdapter() {
++ public void windowClosing(WindowEvent e) {
++ complete.countDown();
++ }
++ });
++ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
++ }
++
++ public void render(Graphics g, int w, int h) {
++ initImages(w, h);
++
++ Graphics2D g2d = (Graphics2D) g.create();
++ for (VolatileImage vi : images) {
++ g2d.drawImage(vi, 0, 0, null);
++ g2d.translate(0, vi.getHeight());
++ }
++ }
++
++ String tr[] = { "OPAQUE", "BITMASK", "TRANSLUCENT" };
++ public void actionPerformed(ActionEvent e) {
++ if (e.getActionCommand().equals("Passed")) {
++ passed = true;
++ System.out.println("Test Passed");
++ } else if (e.getActionCommand().equals("Failed")) {
++ System.out.println("Test Failed");
++ for (int i = 0; i < images.length; i++) {
++ String f = "NonOpaqueDestLCDAATest_"+tr[i]+".png";
++ try {
++ ImageIO.write(images[i].getSnapshot(), "png", new File(f));
++ System.out.printf("Dumped %s image to %s\n", tr[i], f);
++ } catch (Throwable t) {}
++ }
++ passed = false;
++ }
++ dispose();
++ complete.countDown();
++ }
++
++ static void clear(Graphics2D g, int w, int h) {
++ Graphics2D gg = (Graphics2D) g.create();
++ gg.setColor(new Color(0, 0, 0, 0));
++ gg.setComposite(AlphaComposite.Src);
++ gg.fillRect(0, 0, w, h);
++ }
++
++ VolatileImage images[];
++ private void initImages(int w, int h) {
++ if (images == null) {
++ images = new VolatileImage[3];
++ GraphicsConfiguration gc = getGraphicsConfiguration();
++ for (int i = OPAQUE; i <= TRANSLUCENT; i++) {
++ VolatileImage vi =
++ gc.createCompatibleVolatileImage(w,h/3,i);
++ images[i-1] = vi;
++ vi.validate(gc);
++ Graphics2D g2d = (Graphics2D) vi.getGraphics();
++ if (i > OPAQUE) {
++ clear(g2d, vi.getWidth(), vi.getHeight());
++ }
++ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
++ RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
++ String s = "LCD AA Text rendered to "+tr[i-1]+ " destination";
++ g2d.drawString(s, 10, vi.getHeight()/2);
++ }
++ }
++ }
++
++ public static void main(String[] args) throws InterruptedException {
++ EventQueue.invokeLater(new Runnable() {
++ public void run() {
++ NonOpaqueDestLCDAATest t = new NonOpaqueDestLCDAATest();
++ t.pack();
++ t.setVisible(true);
++ }
++ });
++
++ complete.await();
++ if (!passed) {
++ throw new RuntimeException("Test Failed!");
++ }
++ }
++}
diff -r 3f247fe29393 -r 34511f89bc1d patches/openjdk/6749060-bad-lcd-aa-non-opaque-dest.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/openjdk/6749060-bad-lcd-aa-non-opaque-dest.patch Thu Feb 17 12:09:44 2011 -0500
@@ -0,0 +1,219 @@
+# HG changeset patch
+# User tdv
+# Date 1223597570 25200
+# Node ID 3bc4d79d8123bbc0307e0e58f7c64ee663e25af9
+# Parent 41ff3f84cd9608ef1b4ecd0a823a8ff188712784
+6749060: LCD AA text rendered incorrectly when destination is non opaque (sw pipeline only)
+Reviewed-by: campbell, prr
+
+diff -r 41ff3f84cd96 -r 3bc4d79d8123 src/share/classes/sun/java2d/SurfaceData.java
+--- openjdk.orig/jdk/src/share/classes/sun/java2d/SurfaceData.java Wed Sep 24 11:58:21 2008 -0700
++++ openjdk/jdk/src/share/classes/sun/java2d/SurfaceData.java Thu Oct 09 17:12:50 2008 -0700
+@@ -449,7 +449,8 @@
+ // For now the answer can only be true in the following cases:
+ if (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
+ sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
+- sg2d.clipState <= SunGraphics2D.CLIP_RECTANGULAR)
++ sg2d.clipState <= SunGraphics2D.CLIP_RECTANGULAR &&
++ sg2d.surfaceData.getTransparency() == Transparency.OPAQUE)
+ {
+ if (haveLCDLoop == LCDLOOP_UNKNOWN) {
+ DrawGlyphListLCD loop =
+diff -r 41ff3f84cd96 -r 3bc4d79d8123 test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java
+--- openjdk.orig/jdk/test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java Wed Sep 24 11:58:21 2008 -0700
++++ openjdk/jdk/test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java Thu Oct 09 17:12:50 2008 -0700
+@@ -23,10 +23,11 @@
+
+ /*
+ * @test
+- * @bug 6728834
++ * @bug 6728834 6749060
+ * @summary Tests that LCD AA text rendering works properly with destinations
+ * being VolatileImage of all transparency types
+ * @author Dmitri.Trembovetski: area=Graphics
++ * @run main/manual/othervm -Dsun.java2d.d3d=false NonOpaqueDestLCDAATest
+ * @run main/manual/othervm NonOpaqueDestLCDAATest
+ * @run main/manual/othervm -Dsun.java2d.opengl=True NonOpaqueDestLCDAATest
+ */
+@@ -35,9 +36,11 @@
+ import java.awt.Color;
+ import java.awt.Dimension;
+ import java.awt.EventQueue;
++import java.awt.Font;
+ import java.awt.Graphics;
+ import java.awt.Graphics2D;
+ import java.awt.GraphicsConfiguration;
++import java.awt.Image;
+ import java.awt.RenderingHints;
+ import java.awt.event.ActionEvent;
+ import java.awt.event.ActionListener;
+@@ -45,6 +48,7 @@
+ import java.awt.event.ComponentEvent;
+ import java.awt.event.WindowAdapter;
+ import java.awt.event.WindowEvent;
++import java.awt.image.BufferedImage;
+ import java.awt.image.VolatileImage;
+ import java.io.File;
+ import java.util.concurrent.CountDownLatch;
+@@ -62,35 +66,43 @@
+ public NonOpaqueDestLCDAATest() {
+ JTextArea desc = new JTextArea();
+ desc.setText(
+- "\n Instructions: the three text strings below should appear\n" +
+- " readable, without smudges or misshapen bold glyphs.\n\n" +
+- " If they look fine the test PASSED otherwise it FAILED.\n");
++ "\n Instructions: the three text strings below should appear" +
++ " readable, without smudges or misshapen bold glyphs.\n" +
++ " You may need a magnifier to notice some bad colorfringing in "+
++ " in SW Translucent case, especially in vertical stems.\n\n"+
++ " Basically text rendered to TRANSLUCENT destination should look"+
++ " similar to one rendered to OPAQUE - it may differ in whether or" +
++ " not it's LCD, but it should look 'correct'\n\n"+
++ "If the text looks fine the test PASSED otherwise it FAILED.\n");
+ desc.setEditable(false);
+ desc.setBackground(Color.black);
+ desc.setForeground(Color.green);
+ add("North", desc);
+ JPanel renderPanel = new JPanel() {
++ @Override
+ public void paintComponent(Graphics g) {
+ render(g, getWidth(), getHeight());
+ }
+ };
+- renderPanel.setPreferredSize(new Dimension(350, 150));
++ renderPanel.setPreferredSize(new Dimension(1024, 650));
+ renderPanel.addComponentListener(new ComponentAdapter() {
++ @Override
+ public void componentResized(ComponentEvent e) {
+ images = null;
+ }
+ });
+ add("Center", renderPanel);
+
+- JButton passed = new JButton("Passed");
+- JButton failed = new JButton("Failed");
+- passed.addActionListener(this);
+- failed.addActionListener(this);
++ JButton passedBtn = new JButton("Passed");
++ JButton failedBtn = new JButton("Failed");
++ passedBtn.addActionListener(this);
++ failedBtn.addActionListener(this);
+ JPanel p = new JPanel();
+- p.add(passed);
+- p.add(failed);
++ p.add(passedBtn);
++ p.add(failedBtn);
+ add("South", p);
+ addWindowListener(new WindowAdapter() {
++ @Override
+ public void windowClosing(WindowEvent e) {
+ complete.countDown();
+ }
+@@ -101,14 +113,18 @@
+ public void render(Graphics g, int w, int h) {
+ initImages(w, h);
+
++ g.setColor(new Color(0xAD, 0xD8, 0xE6));
++ g.fillRect(0, 0, w, h);
++
+ Graphics2D g2d = (Graphics2D) g.create();
+- for (VolatileImage vi : images) {
+- g2d.drawImage(vi, 0, 0, null);
+- g2d.translate(0, vi.getHeight());
++ for (Image im : images) {
++ g2d.drawImage(im, 0, 0, null);
++ g2d.translate(0, im.getHeight(null));
+ }
+ }
+
+ String tr[] = { "OPAQUE", "BITMASK", "TRANSLUCENT" };
++ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("Passed")) {
+ passed = true;
+@@ -116,9 +132,17 @@
+ } else if (e.getActionCommand().equals("Failed")) {
+ System.out.println("Test Failed");
+ for (int i = 0; i < images.length; i++) {
+- String f = "NonOpaqueDestLCDAATest_"+tr[i]+".png";
++ String f = "NonOpaqueDestLCDAATest_"+tr[i];
+ try {
+- ImageIO.write(images[i].getSnapshot(), "png", new File(f));
++ if (images[i] instanceof VolatileImage) {
++ f += "_vi.png";
++ ImageIO.write(((VolatileImage)images[i]).
++ getSnapshot(), "png", new File(f));
++ } else {
++ f += "_bi.png";
++ ImageIO.write((BufferedImage)images[i],
++ "png", new File(f));
++ }
+ System.out.printf("Dumped %s image to %s\n", tr[i], f);
+ } catch (Throwable t) {}
+ }
+@@ -128,37 +152,51 @@
+ complete.countDown();
+ }
+
+- static void clear(Graphics2D g, int w, int h) {
++ static void clear(Graphics2D g, int type, int w, int h) {
+ Graphics2D gg = (Graphics2D) g.create();
+- gg.setColor(new Color(0, 0, 0, 0));
+- gg.setComposite(AlphaComposite.Src);
++ if (type > OPAQUE) {
++ gg.setColor(new Color(0, 0, 0, 0));
++ gg.setComposite(AlphaComposite.Src);
++ } else {
++ gg.setColor(new Color(0xAD, 0xD8, 0xE6));
++ }
+ gg.fillRect(0, 0, w, h);
+ }
+
+- VolatileImage images[];
++ private void render(Image im, int type, String s) {
++ Graphics2D g2d = (Graphics2D) im.getGraphics();
++ clear(g2d, type, im.getWidth(null), im.getHeight(null));
++ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
++ RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
++ Font f = new Font("Dialog", Font.BOLD, 40);// g2d.getFont().deriveFont(32.0f);
++ g2d.setColor(Color.white);
++ g2d.setFont(g2d.getFont().deriveFont(36.0f));
++ g2d.drawString(s, 10, im.getHeight(null) / 2);
++ }
++
++ Image images[];
+ private void initImages(int w, int h) {
+ if (images == null) {
+- images = new VolatileImage[3];
++ images = new Image[6];
+ GraphicsConfiguration gc = getGraphicsConfiguration();
+ for (int i = OPAQUE; i <= TRANSLUCENT; i++) {
+ VolatileImage vi =
+- gc.createCompatibleVolatileImage(w,h/3,i);
++ gc.createCompatibleVolatileImage(w,h/images.length,i);
+ images[i-1] = vi;
+ vi.validate(gc);
+- Graphics2D g2d = (Graphics2D) vi.getGraphics();
+- if (i > OPAQUE) {
+- clear(g2d, vi.getWidth(), vi.getHeight());
+- }
+- g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+- RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
+- String s = "LCD AA Text rendered to "+tr[i-1]+ " destination";
+- g2d.drawString(s, 10, vi.getHeight()/2);
++ String s = "LCD AA Text rendered to " + tr[i - 1] + " HW destination";
++ render(vi, i, s);
++
++ s = "LCD AA Text rendered to " + tr[i - 1] + " SW destination";
++ images[i-1+3] = gc.createCompatibleImage(w, h/images.length, i);
++ render(images[i-1+3], i, s);
+ }
+ }
+ }
+
+ public static void main(String[] args) throws InterruptedException {
+ EventQueue.invokeLater(new Runnable() {
++ @Override
+ public void run() {
+ NonOpaqueDestLCDAATest t = new NonOpaqueDestLCDAATest();
+ t.pack();
More information about the distro-pkg-dev
mailing list