From: Kimmo R. <ki...@us...> - 2010-03-18 23:00:10
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/client/gui/j2d In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24343/src/games/stendhal/client/gui/j2d Modified Files: TextBoxFactory.java Log Message: Use filled round rectangles for both the outline and fill of the chat bubbles to work around an incompatibility in openjdk's drawing of them. Fixes [2972839] "[Stendhal Client] OpenJDK chat bubbles". Index: TextBoxFactory.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/client/gui/j2d/TextBoxFactory.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TextBoxFactory.java 2 Jan 2010 23:05:35 -0000 1.8 --- TextBoxFactory.java 18 Mar 2010 22:59:58 -0000 1.9 *************** *** 103,117 **** private void drawBubble(final Graphics2D g2d, final Color fillColor, final Color outLineColor, final int width, final int height) { ! g2d.setColor(fillColor); ! g2d.fillRoundRect(BUBBLE_OFFSET, 0, width, height, ARC_DIAMETER, ARC_DIAMETER); ! g2d.setColor(outLineColor); ! // The definition of the arcs for fillRoundRect() and drawRoundRect() are the ! // same according to java docs, but apparently they are drawn differently anyway. ! // The widhts and heights are different by 1 (documented). ! g2d.drawRoundRect(BUBBLE_OFFSET, 0, width - 1, height - 1, ARC_DIAMETER - 2, ARC_DIAMETER - 2); // The bubble handle - g2d.setColor(fillColor); final Polygon p = new Polygon(); p.addPoint(BUBBLE_OFFSET + 1, MARGIN_WIDTH + 1); --- 103,117 ---- private void drawBubble(final Graphics2D g2d, final Color fillColor, final Color outLineColor, final int width, final int height) { ! /* ! * There's an one pixel difference in how sun java and openjdk ! * do drawRoundRect, so we use fillRoundRect for both the ! * outline and the fill to have pretty bubbles on both ! */ g2d.setColor(outLineColor); ! g2d.fillRoundRect(BUBBLE_OFFSET, 0, width, height, ARC_DIAMETER, ARC_DIAMETER); ! g2d.setColor(fillColor); ! g2d.fillRoundRect(BUBBLE_OFFSET + 1, 1, width - 2, height - 2, ARC_DIAMETER, ARC_DIAMETER); // The bubble handle final Polygon p = new Polygon(); p.addPoint(BUBBLE_OFFSET + 1, MARGIN_WIDTH + 1); *************** *** 121,125 **** g2d.setColor(outLineColor); ! g2d.drawLine(0, LINE_HEIGHT, BUBBLE_OFFSET, MARGIN_WIDTH); g2d.drawLine(0, LINE_HEIGHT, BUBBLE_OFFSET, LINE_HEIGHT / 2 + MARGIN_WIDTH); } --- 121,125 ---- g2d.setColor(outLineColor); ! g2d.drawLine(0, LINE_HEIGHT, BUBBLE_OFFSET, MARGIN_WIDTH + 1); g2d.drawLine(0, LINE_HEIGHT, BUBBLE_OFFSET, LINE_HEIGHT / 2 + MARGIN_WIDTH); } |