From: <aki...@us...> - 2006-12-01 22:05:22
|
Revision: 766 http://svn.sourceforge.net/gridarta/?rev=766&view=rev Author: akirschbaum Date: 2006-12-01 14:05:22 -0800 (Fri, 01 Dec 2006) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-01 22:00:38 UTC (rev 765) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-01 22:05:22 UTC (rev 766) @@ -81,7 +81,7 @@ private final boolean isPickmap; /** offset to map borders (32 for std. rect. maps, 0 for pickmaps). */ - private int bOffset; + private int borderOffset; private final CMainControl mainControl; @@ -115,8 +115,8 @@ } tmpIcon = new ImageIcon(); - bOffset = !pickmap ? 32 : 0; - renderTransform = new AffineTransform(1f, 0f, 0f, 1f, (float) bOffset, (float) bOffset); + borderOffset = !pickmap ? 32 : 0; + renderTransform = new AffineTransform(1f, 0f, 0f, 1f, (float) borderOffset, (float) borderOffset); highLightMask = new Color[]{ new Color(1.0f, 0.0f, 0.0f, 0.33f), new Color(0.0f, 1.0f, 0.0f, 0.33f), @@ -165,10 +165,10 @@ bufGrfx.fillRect(0, 0, mapWidth, mapHeight); // paint the mapview into the image - storeOffset = bOffset; - bOffset = 0; + storeOffset = borderOffset; + borderOffset = 0; paintComponent((Graphics2D) bufGrfx, true); - bOffset = storeOffset; + borderOffset = storeOffset; return bufImage; } @@ -187,10 +187,10 @@ repaint(); } else { log.debug("modelChanged(), we are in a backbuffered behaviour."); - final int storeOffset = bOffset; - bOffset = 0; + final int storeOffset = borderOffset; + borderOffset = 0; paintComponent((Graphics2D) backBuffer.getGraphics(), false); - bOffset = storeOffset; + borderOffset = storeOffset; repaint(); } } @@ -221,9 +221,9 @@ if (!mapControl.getMapModel().containsArchObject(x, y)) { // empty square if (isPickmap) { - grfx.fillRect(x * 32 + bOffset, y * 32 + bOffset, 32, 32); + grfx.fillRect(x * 32 + borderOffset, y * 32 + borderOffset, 32, 32); } else { - mainControl.getUnknownTileIconX().paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); + mainControl.getUnknownTileIconX().paintIcon(this, grfx, x * 32 + borderOffset, y * 32 + borderOffset); } } else { for (final GameObject node : mapControl.getMapModel().getMapSquare(new Point(x, y))) { @@ -233,17 +233,17 @@ } if (mainControl.isTileEdit(node.getEditType()) || mainControl.getTileEdit() == 0 || isPickmap) { if (node.getArchetypeName() == null) { - mainControl.getNoarchTileIconX().paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); + mainControl.getNoarchTileIconX().paintIcon(this, grfx, x * 32 + borderOffset, y * 32 + borderOffset); } else if (node.getFaceFlag()) { - mainControl.getNofaceTileIconX().paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); + mainControl.getNofaceTileIconX().paintIcon(this, grfx, x * 32 + borderOffset, y * 32 + borderOffset); } else { if (node.getFaceNr() == -1) { - mainControl.getUnknownTileIconX().paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); + mainControl.getUnknownTileIconX().paintIcon(this, grfx, x * 32 + borderOffset, y * 32 + borderOffset); } else { // draw object face final ImageIcon img = archlist.getFace(node.getFaceNr()); if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { - archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); + archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, x * 32 + borderOffset, y * 32 + borderOffset); } else if (node.isHead()) { oversizedMultiHeads.addElement(node); // store oversized arches for later } @@ -259,7 +259,7 @@ final Color alpha = highLightMask[i]; final Color c = grfx.getColor(); grfx.setColor(alpha); - grfx.fillRect(x * 32 + bOffset, y * 32 + bOffset, 32, 32); + grfx.fillRect(x * 32 + borderOffset, y * 32 + borderOffset, 32, 32); grfx.setColor(c); } } @@ -267,24 +267,24 @@ // at the end, we have to draw the oversized multipart images on top of the rest for (int i = 0; i < oversizedMultiHeads.size(); i++) { final GameObject node = oversizedMultiHeads.elementAt(i); - archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, node.getMapX() * 32 + bOffset, node.getMapY() * 32 + bOffset); + archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, node.getMapX() * 32 + borderOffset, node.getMapY() * 32 + borderOffset); } // grid lines if (mapViewBasic.isGridVisible() && !isSnapshot) { for (int x = 0; x <= mapViewBasic.getMapSize().getWidth(); x++) { grfx.drawLine( - x * 32 + bOffset, - 0 + bOffset, - x * 32 + bOffset, - mapViewBasic.getMapSize().getHeight() * 32 + bOffset); + x * 32 + borderOffset, + 0 + borderOffset, + x * 32 + borderOffset, + mapViewBasic.getMapSize().getHeight() * 32 + borderOffset); } for (int y = 0; y <= mapViewBasic.getMapSize().getHeight(); y++) { grfx.drawLine( - 0 + bOffset, - y * 32 + bOffset, - mapViewBasic.getMapSize().getWidth() * 32 + bOffset, - y * 32 + bOffset); + 0 + borderOffset, + y * 32 + borderOffset, + mapViewBasic.getMapSize().getWidth() * 32 + borderOffset, + y * 32 + borderOffset); } } if (mapViewBasic.isHighlight() && mapViewBasic.getMapMouseRightPos().y != -1 && mapViewBasic.getMapMouseRightPos().x != -1 && !isSnapshot) { @@ -322,7 +322,7 @@ // draw the empty-tile icon (direcly to the mapview) if (isPickmap) { grfx.setColor(IGUIConstants.BG_COLOR); - grfx.fillRect(x * 32 + bOffset, y * 32 + bOffset, 32, 32); + grfx.fillRect(x * 32 + borderOffset, y * 32 + borderOffset, 32, 32); } else { mainControl.getUnknownTileIconX().paintIcon(this, grfx, x * 32, y * 32); } @@ -449,7 +449,7 @@ // Draw the Icon: // Rectangular view - mainControl.getMapSelIconX().paintIcon(this, grfx, posx * 32 + bOffset, posy * 32 + bOffset); + mainControl.getMapSelIconX().paintIcon(this, grfx, posx * 32 + borderOffset, posy * 32 + borderOffset); if (signY == 0) { break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-01 22:06:28
|
Revision: 767 http://svn.sourceforge.net/gridarta/?rev=767&view=rev Author: akirschbaum Date: 2006-12-01 14:06:28 -0800 (Fri, 01 Dec 2006) Log Message: ----------- Declare variable more local. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-01 22:05:22 UTC (rev 766) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-01 22:06:28 UTC (rev 767) @@ -151,8 +151,6 @@ * @return an image of the entire mapview */ public BufferedImage getFullImage() { - final int storeOffset; // tmp. storage to save map offset - final Size2D mapSize = mapControl.getMapSize(); final int mapWidth = 32 * mapSize.getWidth(); final int mapHeight = 32 * mapSize.getHeight(); @@ -165,7 +163,7 @@ bufGrfx.fillRect(0, 0, mapWidth, mapHeight); // paint the mapview into the image - storeOffset = borderOffset; + final int storeOffset = borderOffset; borderOffset = 0; paintComponent((Graphics2D) bufGrfx, true); borderOffset = storeOffset; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-09 15:29:15
|
Revision: 973 http://svn.sourceforge.net/gridarta/?rev=973&view=rev Author: christianhujer Date: 2006-12-09 07:29:16 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Removed pointless arithmetic expressions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-09 15:28:21 UTC (rev 972) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-09 15:29:16 UTC (rev 973) @@ -271,13 +271,13 @@ for (int x = 0; x <= mapViewBasic.getMapSize().getWidth(); x++) { grfx.drawLine( x * 32 + borderOffset, - 0 + borderOffset, + borderOffset, x * 32 + borderOffset, mapViewBasic.getMapSize().getHeight() * 32 + borderOffset); } for (int y = 0; y <= mapViewBasic.getMapSize().getHeight(); y++) { grfx.drawLine( - 0 + borderOffset, + borderOffset, y * 32 + borderOffset, mapViewBasic.getMapSize().getWidth() * 32 + borderOffset, y * 32 + borderOffset); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-17 15:57:51
|
Revision: 1149 http://svn.sourceforge.net/gridarta/?rev=1149&view=rev Author: akirschbaum Date: 2006-12-17 07:57:52 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Fix comment. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 15:50:49 UTC (rev 1148) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 15:57:52 UTC (rev 1149) @@ -59,7 +59,7 @@ /** * The component that does the actual rendering of tiles in the palette. * Flat version. -b * @author unknown (probably Ragnor) + * @author unknown */ public final class DefaultLevelRenderer extends LevelRenderer implements MapGridListener { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-17 16:21:56
|
Revision: 1152 http://svn.sourceforge.net/gridarta/?rev=1152&view=rev Author: akirschbaum Date: 2006-12-17 08:21:56 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 16:11:55 UTC (rev 1151) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 16:21:56 UTC (rev 1152) @@ -86,10 +86,8 @@ private final boolean isPickmap; /** offset to map borders (32 for std. rect. maps, 0 for pickmaps). */ - private int borderOffset; + private final Point borderOffset = new Point(); - private final CMainControl mainControl; - private final Color[] highLightMask; private BufferedImage backBuffer; @@ -99,10 +97,12 @@ private final AffineTransform renderTransform; - private MapModel mapModel; + private final MapModel mapModel; - private Size2D mapSize = new Size2D(1, 1); + private final CMainControl mainControl; + private Size2D mapSize; + private final MapGrid mapGrid; /** @@ -126,17 +126,17 @@ // initialize the tmp. graphic buffer tmpImage = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); tmpGrfx = tmpImage.getGraphics(); - if (!pickmap) { + if (isPickmap) { + tmpGrfx.setColor(IGUIConstants.BG_COLOR); + } else { tmpGrfx.setColor(mainControl.getMainView().getBackground()); // background color of window - } else { - tmpGrfx.setColor(IGUIConstants.BG_COLOR); } tmpIcon = new ImageIcon(); setFocusable(true); - borderOffset = !pickmap ? 32 : 0; - renderTransform = new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, (float) borderOffset, (float) borderOffset); + borderOffset.setLocation(pickmap ? 0 : 32, pickmap ? 0 : 32); + renderTransform = new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, borderOffset.x, borderOffset.y); highLightMask = new Color[]{ new Color(1.0f, 0.0f, 0.0f, 0.33f), new Color(0.0f, 1.0f, 0.0f, 0.33f), @@ -181,10 +181,10 @@ bufGrfx.fillRect(0, 0, mapWidth, mapHeight); // paint the mapview into the image - final int storeOffset = borderOffset; - borderOffset = 0; + final Point storeOffset = new Point(borderOffset); + borderOffset.setLocation(0, 0); paintComponent((Graphics2D) bufGrfx, true); - borderOffset = storeOffset; + borderOffset.setLocation(storeOffset); return bufImage; } @@ -203,10 +203,10 @@ repaint(); } else { log.debug("modelChanged(), we are in a backbuffered behaviour."); - final int storeOffset = borderOffset; - borderOffset = 0; + final Point storeOffset = new Point(borderOffset); + borderOffset.setLocation(0, 0); paintComponent((Graphics2D) backBuffer.getGraphics(), false); - borderOffset = storeOffset; + borderOffset.setLocation(storeOffset); repaint(); } } @@ -219,8 +219,8 @@ * @return Boundary rectangle of tile */ public Rectangle getTileBounds(final Point p) { - tmpRec.x = borderOffset + p.x * 32; - tmpRec.y = borderOffset + p.y * 32; + tmpRec.x = borderOffset.x + p.x * 32; + tmpRec.y = borderOffset.y + p.y * 32; tmpRec.width = 32; tmpRec.height = 32; return tmpRec; @@ -253,9 +253,9 @@ if (!mapModel.containsArchObject(point)) { // empty square if (isPickmap) { - grfx.fillRect(point.x * 32 + borderOffset, point.y * 32 + borderOffset, 32, 32); + grfx.fillRect(point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y, 32, 32); } else { - CMainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset, point.y * 32 + borderOffset); + CMainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); } } else { for (final GameObject node : mapModel.getMapSquare(point)) { @@ -265,17 +265,17 @@ } if (mainControl.isTileEdit(node) || isPickmap) { if (node.getArchetypeName() == null) { - CMainControl.getNoarchTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset, point.y * 32 + borderOffset); + CMainControl.getNoarchTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); } else if (node.getFaceFlag()) { - CMainControl.getNofaceTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset, point.y * 32 + borderOffset); + CMainControl.getNofaceTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); } else { if (node.getFaceNr() == -1) { - CMainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset, point.y * 32 + borderOffset); + CMainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); } else { // draw object face final ImageIcon img = archlist.getFace(node.getFaceNr()); if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { - archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, point.x * 32 + borderOffset, point.y * 32 + borderOffset); + archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); } else if (node.isHead()) { oversizedMultiHeads.addElement(node); // store oversized arches for later } @@ -291,7 +291,7 @@ final Color alpha = highLightMask[i]; final Color c = grfx.getColor(); grfx.setColor(alpha); - grfx.fillRect(point.x * 32 + borderOffset, point.y * 32 + borderOffset, 32, 32); + grfx.fillRect(point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y, 32, 32); grfx.setColor(c); } } @@ -299,7 +299,7 @@ // at the end, we have to draw the oversized multipart images on top of the rest for (int i = 0; i < oversizedMultiHeads.size(); i++) { final GameObject node = oversizedMultiHeads.elementAt(i); - archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, node.getMapX() * 32 + borderOffset, node.getMapY() * 32 + borderOffset); + archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, node.getMapX() * 32 + borderOffset.x, node.getMapY() * 32 + borderOffset.y); } if (!isSnapshot) { @@ -334,7 +334,7 @@ // draw the empty-tile icon (direcly to the mapview) if (isPickmap) { grfx.setColor(IGUIConstants.BG_COLOR); - grfx.fillRect(point.x * 32 + borderOffset, point.y * 32 + borderOffset, 32, 32); + grfx.fillRect(point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y, 32, 32); } else { CMainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32, point.y * 32); } @@ -432,16 +432,16 @@ private void paintSelection(final Graphics2D grfx) { for (int y = 0; y < mapSize.getHeight(); y++) { for (int x = 0; x < mapSize.getWidth(); x++) { - if (grfx.hitClip(x * 32 + borderOffset, y * 32 + borderOffset, 32, 32)) { + if (grfx.hitClip(x * 32 + borderOffset.x, y * 32 + borderOffset.y, 32, 32)) { final int gridFlags = mapGrid.getFlags(x, y); if ((gridFlags & MapGrid.GRID_FLAG_SELECTION) != 0) { - CMainControl.getMapSelIcon().paintIcon(this, grfx, x * 32 + borderOffset, y * 32 + borderOffset); + CMainControl.getMapSelIcon().paintIcon(this, grfx, x * 32 + borderOffset.x, y * 32 + borderOffset.y); } if ((gridFlags & MapGrid.GRID_FLAG_SELECTING) != 0) { - CMainControl.getMapSelIcon().paintIcon(this, grfx, x * 32 + borderOffset, y * 32 + borderOffset); + CMainControl.getMapSelIcon().paintIcon(this, grfx, x * 32 + borderOffset.x, y * 32 + borderOffset.y); } if ((gridFlags & MapGrid.GRID_FLAG_CURSOR) != 0) { - CMainControl.getMapCursorIcon().paintIcon(this, grfx, x * 32 + borderOffset, y * 32 + borderOffset); + CMainControl.getMapCursorIcon().paintIcon(this, grfx, x * 32 + borderOffset.x, y * 32 + borderOffset.y); } } } @@ -459,17 +459,17 @@ if (mapViewBasic.isGridVisible()) { for (int x = 0; x <= mapGrid.getSize().getWidth(); x++) { grfx.drawLine( - x * 32 + borderOffset, - borderOffset, - x * 32 + borderOffset, - mapGrid.getSize().getHeight() * 32 + borderOffset); + x * 32 + borderOffset.x, + borderOffset.x, + x * 32 + borderOffset.y, + mapGrid.getSize().getHeight() * 32 + borderOffset.y); } for (int y = 0; y <= mapGrid.getSize().getHeight(); y++) { grfx.drawLine( - borderOffset, - y * 32 + borderOffset, - mapGrid.getSize().getWidth() * 32 + borderOffset, - y * 32 + borderOffset); + borderOffset.x, + y * 32 + borderOffset.y, + mapGrid.getSize().getWidth() * 32 + borderOffset.x, + y * 32 + borderOffset.y); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-17 16:28:58
|
Revision: 1154 http://svn.sourceforge.net/gridarta/?rev=1154&view=rev Author: akirschbaum Date: 2006-12-17 08:28:59 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Remove redundant this qualifier. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 16:27:08 UTC (rev 1153) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 16:28:59 UTC (rev 1154) @@ -149,7 +149,7 @@ ((JComponent) e.getSource()).scrollRectToVisible(r); } }; - this.addMouseMotionListener(doScrollRectToVisible); + addMouseMotionListener(doScrollRectToVisible); } /** This method is called when the look and feel has changed. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-17 18:30:02
|
Revision: 1163 http://svn.sourceforge.net/gridarta/?rev=1163&view=rev Author: akirschbaum Date: 2006-12-17 10:29:59 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 18:07:43 UTC (rev 1162) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 18:29:59 UTC (rev 1163) @@ -170,15 +170,15 @@ /** {@inheritDoc} */ @Override public BufferedImage getFullImage() { - final int mapWidth = 32 * mapSize.getWidth(); - final int mapHeight = 32 * mapSize.getHeight(); + final int viewWidth = 32 * mapSize.getWidth(); + final int viewHeight = 32 * mapSize.getHeight(); // first create a storing place for the image - final BufferedImage bufImage = new BufferedImage(mapWidth, mapHeight, BufferedImage.TYPE_INT_ARGB); + final BufferedImage bufImage = new BufferedImage(viewWidth, viewHeight, BufferedImage.TYPE_INT_ARGB); final Graphics bufGrfx = bufImage.getGraphics(); bufGrfx.setColor(Color.white); bufGrfx.setColor(Color.white); - bufGrfx.fillRect(0, 0, mapWidth, mapHeight); + bufGrfx.fillRect(0, 0, viewWidth, viewHeight); // paint the mapview into the image final Point storeOffset = new Point(borderOffset); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-17 18:30:49
|
Revision: 1164 http://svn.sourceforge.net/gridarta/?rev=1164&view=rev Author: akirschbaum Date: 2006-12-17 10:30:49 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Remove redundant statement. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 18:29:59 UTC (rev 1163) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 18:30:49 UTC (rev 1164) @@ -177,7 +177,6 @@ final BufferedImage bufImage = new BufferedImage(viewWidth, viewHeight, BufferedImage.TYPE_INT_ARGB); final Graphics bufGrfx = bufImage.getGraphics(); bufGrfx.setColor(Color.white); - bufGrfx.setColor(Color.white); bufGrfx.fillRect(0, 0, viewWidth, viewHeight); // paint the mapview into the image This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-17 18:34:21
|
Revision: 1165 http://svn.sourceforge.net/gridarta/?rev=1165&view=rev Author: akirschbaum Date: 2006-12-17 10:34:18 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Remove code to scroll while dragging the mouse. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 18:30:49 UTC (rev 1164) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 18:34:18 UTC (rev 1165) @@ -142,14 +142,6 @@ new Color(0.0f, 1.0f, 0.0f, 0.33f), new Color(0.0f, 1.0f, 1.0f, 0.33f)}; resizeBackBuffer(); - /*taken from java doc, scroll while dragged*/ - final MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { - @Override public void mouseDragged(final MouseEvent e) { - final Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1); - ((JComponent) e.getSource()).scrollRectToVisible(r); - } - }; - addMouseMotionListener(doScrollRectToVisible); } /** This method is called when the look and feel has changed. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-17 20:05:15
|
Revision: 1167 http://svn.sourceforge.net/gridarta/?rev=1167&view=rev Author: akirschbaum Date: 2006-12-17 12:05:15 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Move code to paint one tile into a separate function. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 19:10:09 UTC (rev 1166) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 20:05:15 UTC (rev 1167) @@ -101,6 +101,12 @@ private final MapGrid mapGrid; + private final CFilterControl filter; + + private final ArchetypeSet archlist; + + private final Point offset = new Point(); + /** * Creates a DefaultLevelRenderer. * @param mapViewBasic MapView to render @@ -115,6 +121,8 @@ mapModel = mapControl.getMapModel(); mapSize = mapModel.getMapSize(); this.mapGrid = mapGrid; + filter = mainControl.getFilterControl(); + archlist = mainControl.getArchetypeSet(); final AttributeFilter af = new AttributeFilter(); af.addAttribute("no_pass", "1"); @@ -219,8 +227,6 @@ * "screenshot"-image, false for normal drawing */ public void paintComponent(final Graphics grfx, final boolean isSnapshot) { - final ArchetypeSet archlist = mainControl.getArchetypeSet(); - if (isPickmap) { // draw greenisch background for pickmaps grfx.setColor(IGUIConstants.BG_COLOR); @@ -228,65 +234,12 @@ grfx.setColor(mainControl.getMainView().getBackground()); // background color of window } grfx.fillRect(0, 0, getWidth(), getHeight()); - // ---------- draw rectangular map -------------- - // this vector contains all heads of multi-tiles with oversized images - final Vector<GameObject> oversizedMultiHeads = new Vector<GameObject>(); - final CFilterControl filter = mainControl.getFilterControl(); final Point point = new Point(); for (point.y = 0; point.y < mapGrid.getSize().getHeight(); point.y++) { for (point.x = 0; point.x < mapGrid.getSize().getWidth(); point.x++) { - filter.newSquare(); - if (!mapModel.containsArchObject(point)) { - // empty square - if (isPickmap) { - grfx.fillRect(point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y, 32, 32); - } else { - CMainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); - } - } else { - for (final GameObject node : mapModel.getMapSquare(point)) { - filter.objectInSquare(node); - if (!filter.canShow(node)) { - continue; - } - if (mainControl.isTileEdit(node) || isPickmap) { - if (node.getArchetypeName() == null) { - CMainControl.getNoarchTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); - } else if (node.getFaceFlag()) { - CMainControl.getNofaceTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); - } else { - if (node.getFaceNr() == -1) { - CMainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); - } else { - // draw object face - final ImageIcon img = archlist.getFace(node.getFaceNr()); - if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { - archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); - } else if (node.isHead()) { - oversizedMultiHeads.addElement(node); // store oversized arches for later - } - } - } - } - } - } - for (int i = 0; i < CFilterControl.MAX_HIGHLIGHT; i++) { - if (!filter.highLightedSquare(i)) { - continue; - } - final Color alpha = highLightMask[i]; - final Color c = grfx.getColor(); - grfx.setColor(alpha); - grfx.fillRect(point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y, 32, 32); - grfx.setColor(c); - } + paintTile(grfx, point); } } - // at the end, we have to draw the oversized multipart images on top of the rest - for (int i = 0; i < oversizedMultiHeads.size(); i++) { - final GameObject node = oversizedMultiHeads.elementAt(i); - archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, node.getMapX() * 32 + borderOffset.x, node.getMapY() * 32 + borderOffset.y); - } if (!isSnapshot) { paintGrid(grfx); @@ -310,59 +263,9 @@ } else { grfx = backBuffer.getGraphics(); } - final ArchetypeSet archlist = mainControl.getArchetypeSet(); // arch stack - // ---------- draw tile for rectangular view (non-iso) -------------- - final CFilterControl filter = mainControl.getFilterControl(); - filter.newSquare(); - // first, draw the object's faces: - if (!mapModel.containsArchObject(point)) { - // draw the empty-tile icon (direcly to the mapview) - if (isPickmap) { - grfx.setColor(IGUIConstants.BG_COLOR); - grfx.fillRect(point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y, 32, 32); - } else { - CMainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32, point.y * 32); - } - } else { - tmpGrfx.fillRect(0, 0, 32, 32); - // loop through all arches on that square and draw em - for (final GameObject node : mapModel.getMapSquare(point)) { - filter.objectInSquare(node); - if (!filter.canShow(node)) { - continue; - } - if (mainControl.isTileEdit(node)) { - if (node.getArchetypeName() == null) { - CMainControl.getNoarchTileIcon().paintIcon(this, tmpGrfx, 0, 0); - } else if (node.getFaceFlag()) { - CMainControl.getNofaceTileIcon().paintIcon(this, tmpGrfx, 0, 0); - } else { - if (node.getFaceNr() == -1) { - CMainControl.getUnknownTileIcon().paintIcon(this, tmpGrfx, 0, 0); - } else { - final ImageIcon img = archlist.getFace(node.getFaceNr()); - if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { - img.paintIcon(this, tmpGrfx, 0, 0); - } else { - // this is an oversized image, so it must be shifted - img.paintIcon(this, tmpGrfx, -32 * node.getMultiX(), -32 * node.getMultiY()); - } - } - } - } - } - } - for (int i = 0; i < CFilterControl.MAX_HIGHLIGHT; i++) { - if (!filter.highLightedSquare(i)) { - continue; - } - final Color alpha = highLightMask[i]; - final Color c = grfx.getColor(); - tmpGrfx.setColor(alpha); - tmpGrfx.fillRect(0, 0, 32, 32); - tmpGrfx.setColor(c); - } + paintTile(grfx, point); + // We have been drawing to the tmp. buffer, now convert it to // an ImageIcon and paint it into the mapview: if (mapModel.containsArchObject(point)) { @@ -526,4 +429,63 @@ tmpImage = null; } + public void paintTile(final Graphics grfx, final Point point) { + // ---------- draw tile for rectangular view (non-iso) -------------- + filter.newSquare(); + if (!mapModel.containsArchObject(point)) { + if (isPickmap) { + grfx.setColor(IGUIConstants.BG_COLOR); + grfx.fillRect(point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y, 32, 32); + } else { + CMainControl.getUnknownTileIcon().paintIcon(DefaultLevelRenderer.this, grfx, point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y); + } + } else { + grfx.fillRect(point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y, 32, 32); + for (final GameObject node : mapModel.getMapSquare(point)) { + filter.objectInSquare(node); + if (!filter.canShow(node)) { + continue; + } + if (mainControl.isTileEdit(node) || isPickmap) { + final ImageIcon img; + if (node.getArchetypeName() == null) { + img = CMainControl.getNoarchTileIcon(); + offset.x = 0; + offset.y = 0; + } else if (node.getFaceFlag()) { + img = CMainControl.getNofaceTileIcon(); + offset.x = 0; + offset.y = 0; + } else if (node.getFaceNr() == -1) { + img = CMainControl.getUnknownTileIcon(); + offset.x = 0; + offset.y = 0; + } else { + img = archlist.getFace(node.getFaceNr()); + if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { + offset.x = 0; + offset.y = 0; + } else { + // this is an oversized image, so it must be shifted + // XXX: it must also be clipped to not overwrite filter information + offset.x = -32 * node.getMultiX(); + offset.y = -32 * node.getMultiY(); + } + } + img.paintIcon(DefaultLevelRenderer.this, grfx, point.x * 32 + borderOffset.x + offset.x, point.y * 32 + borderOffset.y + offset.y); + } + } + } + for (int i = 0; i < CFilterControl.MAX_HIGHLIGHT; i++) { + if (!filter.highLightedSquare(i)) { + continue; + } + final Color alpha = highLightMask[i]; + final Color c = grfx.getColor(); + grfx.setColor(alpha); + grfx.fillRect(point.x * 32 + borderOffset.x, point.y * 32 + borderOffset.y, 32, 32); + grfx.setColor(c); + } + } + } // class DefaultLevelRenderer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-17 21:02:58
|
Revision: 1173 http://svn.sourceforge.net/gridarta/?rev=1173&view=rev Author: akirschbaum Date: 2006-12-17 13:02:58 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 20:58:40 UTC (rev 1172) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 21:02:58 UTC (rev 1173) @@ -28,7 +28,6 @@ import cfeditor.CMainControl; import cfeditor.CMapViewBasic; import cfeditor.IGUIConstants; -import cfeditor.filter.AttributeFilter; import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.map.MapControl; @@ -126,8 +125,6 @@ filter = mainControl.getFilterControl(); archlist = mainControl.getArchetypeSet(); - final AttributeFilter af = new AttributeFilter(); - af.addAttribute("no_pass", "1"); isPickmap = pickmap; // initialize the tmp. graphic buffer tmpImage = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-01-22 18:13:35
|
Revision: 1657 http://svn.sourceforge.net/gridarta/?rev=1657&view=rev Author: akirschbaum Date: 2007-01-22 10:13:27 -0800 (Mon, 22 Jan 2007) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-22 18:10:02 UTC (rev 1656) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-22 18:13:27 UTC (rev 1657) @@ -105,53 +105,53 @@ */ private final MapModelListener<GameObject, MapArchObject> mapModelListener = new MapModelListener<GameObject, MapArchObject>() { - /** {@inheritDoc} */ - public void mapSizeChanged(final MapModelEvent e) { - // ignore: will trigger an mapGridChanged() callback - } + /** {@inheritDoc} */ + public void mapSizeChanged(final MapModelEvent e) { + // ignore: will trigger an mapGridChanged() callback + } - /** {@inheritDoc} */ - public void mapSquaresChanged(final MapModelEvent<GameObject, MapArchObject> e) { - final MapSquare<GameObject, MapArchObject>[] squares = e.getSquares(); - int minX = bufferedSize.width; - int minY = bufferedSize.height; - int maxX = 0; - int maxY = 0; - if (squares != null) { - for (final MapSquare square : squares) { - final int x = square.getMapX(); - final int y = square.getMapY(); - paintTile(new Point(x, y)); + /** {@inheritDoc} */ + public void mapSquaresChanged(final MapModelEvent<GameObject, MapArchObject> e) { + final MapSquare<GameObject, MapArchObject>[] squares = e.getSquares(); + int minX = bufferedSize.width; + int minY = bufferedSize.height; + int maxX = 0; + int maxY = 0; + if (squares != null) { + for (final MapSquare square : squares) { + final int x = square.getMapX(); + final int y = square.getMapY(); + paintTile(new Point(x, y)); - if (minX > x) { - minX = x; - } - if (minY > y) { - minY = y; - } - if (maxX < x) { - maxX = x; - } - if (maxY < y) { - maxY = y; - } - } - } + if (minX > x) { + minX = x; + } + if (minY > y) { + minY = y; + } + if (maxX < x) { + maxX = x; + } + if (maxY < y) { + maxY = y; + } + } + } - if (!isPickmap && minX <= maxX && minY <= maxY) { - paintFromBackbuffer(getGraphics(), minX * 32, minY * 32, (maxX + 1 - minX) * 32, (maxY + 1 - minY) * 32); - } - } + if (!isPickmap && minX <= maxX && minY <= maxY) { + paintFromBackbuffer(getGraphics(), minX * 32, minY * 32, (maxX + 1 - minX) * 32, (maxY + 1 - minY) * 32); + } + } - /** {@inheritDoc} */ - public void mapObjectsChanged(final MapModelEvent e) { - modelChanged(); - } + /** {@inheritDoc} */ + public void mapObjectsChanged(final MapModelEvent e) { + modelChanged(); + } - /** {@inheritDoc} */ - public void mapMetaChanged(@NotNull final MapArchObject mapArchObject) { - // ignore - } + /** {@inheritDoc} */ + public void mapMetaChanged(@NotNull final MapArchObject mapArchObject) { + // ignore + } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-01-23 21:31:36
|
Revision: 1686 http://svn.sourceforge.net/gridarta/?rev=1686&view=rev Author: akirschbaum Date: 2007-01-23 13:31:35 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Inline expression. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 21:28:58 UTC (rev 1685) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 21:31:35 UTC (rev 1686) @@ -497,9 +497,8 @@ if (isPickmap || !filter.highLightedSquare(i)) { continue; } - final Color alpha = highLightMask[i]; final Color c = grfx.getColor(); - grfx.setColor(alpha); + grfx.setColor(highLightMask[i]); grfx.fillRect(point.x * 32, point.y * 32, 32, 32); grfx.setColor(c); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-01-23 21:36:04
|
Revision: 1687 http://svn.sourceforge.net/gridarta/?rev=1687&view=rev Author: akirschbaum Date: 2007-01-23 13:36:02 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Make functions 'private'. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 21:31:35 UTC (rev 1686) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 21:36:02 UTC (rev 1687) @@ -216,7 +216,7 @@ * Returns whether the rendered map is a pickmap. * @return <code>true</code> if the rendered map is a pickmap, otherwise <code>false</code> */ - public boolean isPickmap() { + private boolean isPickmap() { return isPickmap; } @@ -280,7 +280,7 @@ * @param isSnapshot true when this drawing is for a * "screenshot"-image, false for normal drawing */ - public void paintComponent(final Graphics grfx, final boolean isSnapshot) { + private void paintComponent(final Graphics grfx, final boolean isSnapshot) { setColor(grfx); grfx.fillRect(0, 0, getWidth(), getHeight()); final Point point = new Point(); @@ -333,7 +333,7 @@ * @param point Map coordinates of the square to highlight * @param grfx graphics context to draw in */ - public void paintHighlightTile(final Graphics grfx, final Point point) { + private void paintHighlightTile(final Graphics grfx, final Point point) { final int gridFlags = mapGrid.getFlags(point.x, point.y); if ((gridFlags & MapGrid.GRID_FLAG_SELECTING) != 0) { CMainControl.getMapSelIcon().paintIcon(this, grfx, point.x * 32, point.y * 32); @@ -445,7 +445,7 @@ backBuffer = null; } - public void paintTile(final Graphics grfx, final Point point) { + private void paintTile(final Graphics grfx, final Point point) { // ---------- draw tile for rectangular view (non-iso) -------------- filter.newSquare(); setColor(grfx); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-01-23 21:57:30
|
Revision: 1688 http://svn.sourceforge.net/gridarta/?rev=1688&view=rev Author: akirschbaum Date: 2007-01-23 13:57:28 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Accelerate pickmap painting. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 21:36:02 UTC (rev 1687) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 21:57:28 UTC (rev 1688) @@ -232,13 +232,13 @@ bufGrfx.fillRect(0, 0, viewWidth, viewHeight); // paint the mapview into the image - paintComponent(bufGrfx, true); + paintComponent(bufGrfx, true, false); return bufImage; } @Override public void paintComponent(final Graphics g) { if (isPickmap) { - paintComponent(g, false); + paintComponent(g, false, true); } else { paintFromBackbuffer(g, 0, 0, bufferedSize.width, bufferedSize.height); } @@ -254,7 +254,7 @@ @Override public void modelChanged() { if (!isPickmap) { - paintComponent(backBuffer.getGraphics(), false); + paintComponent(backBuffer.getGraphics(), false, false); } repaint(); } @@ -279,14 +279,18 @@ * @param grfx The graphics context to paint to * @param isSnapshot true when this drawing is for a * "screenshot"-image, false for normal drawing + * @param checkClip if set, omit tiles outside <code>grfx</code>'s clip + * area */ - private void paintComponent(final Graphics grfx, final boolean isSnapshot) { + private void paintComponent(final Graphics grfx, final boolean isSnapshot, final boolean checkClip) { setColor(grfx); grfx.fillRect(0, 0, getWidth(), getHeight()); final Point point = new Point(); for (point.y = 0; point.y < mapGrid.getSize().getHeight(); point.y++) { for (point.x = 0; point.x < mapGrid.getSize().getWidth(); point.x++) { - paintTile(grfx, point); + if (!checkClip || grfx.hitClip(point.x * 32, point.y * 32, 32, 32)) { + paintTile(grfx, point); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-01-23 22:17:18
|
Revision: 1689 http://svn.sourceforge.net/gridarta/?rev=1689&view=rev Author: akirschbaum Date: 2007-01-23 14:17:15 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Prevent overwriting of foreground windows. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 21:57:28 UTC (rev 1688) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 22:17:15 UTC (rev 1689) @@ -131,7 +131,7 @@ } if (!isPickmap && minX <= maxX && minY <= maxY) { - paintFromBackbuffer(getGraphics(), minX * 32, minY * 32, (maxX + 1 - minX) * 32, (maxY + 1 - minY) * 32); + repaint(0, borderOffset.x + minX * 32, borderOffset.y + minY * 32, (maxX + 1 - minX) * 32, (maxY + 1 - minY) * 32); } } @@ -162,7 +162,7 @@ } if (!isPickmap) { - paintFromBackbuffer(getGraphics(), recChange.x * 32, recChange.y * 32, recChange.width * 32, recChange.height * 32); + repaint(0, borderOffset.x + recChange.x * 32, borderOffset.y + recChange.y * 32, recChange.width * 32, recChange.height * 32); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-01-23 22:46:34
|
Revision: 1690 http://svn.sourceforge.net/gridarta/?rev=1690&view=rev Author: akirschbaum Date: 2007-01-23 14:46:35 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Prevent overwriting of foreground windows. Minimize area to redraw after changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 22:17:15 UTC (rev 1689) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 22:46:35 UTC (rev 1690) @@ -98,46 +98,45 @@ private final MapModelListener<GameObject, MapArchObject> mapModelListener = new MapModelListener<GameObject, MapArchObject>() { /** {@inheritDoc} */ - public void mapSizeChanged(final MapModelEvent e) { + public void mapSizeChanged(final MapModelEvent<GameObject, MapArchObject> e) { // ignore: will trigger an mapGridChanged() callback } /** {@inheritDoc} */ public void mapSquaresChanged(final MapModelEvent<GameObject, MapArchObject> e) { final MapSquare<GameObject, MapArchObject>[] squares = e.getSquares(); - int minX = bufferedSize.width; - int minY = bufferedSize.height; - int maxX = 0; - int maxY = 0; if (squares != null) { + final Point point = new Point(); for (final MapSquare square : squares) { - final int x = square.getMapX(); - final int y = square.getMapY(); - paintTile(new Point(x, y)); - - if (minX > x) { - minX = x; + if (!isPickmap) { + point.x = square.getMapX(); + point.y = square.getMapY(); + paintTile(point); } - if (minY > y) { - minY = y; - } - if (maxX < x) { - maxX = x; - } - if (maxY < y) { - maxY = y; - } + repaint(0, borderOffset.x + square.getMapX() * 32, borderOffset.y + square.getMapY() * 32, 32, 32); } } - - if (!isPickmap && minX <= maxX && minY <= maxY) { - repaint(0, borderOffset.x + minX * 32, borderOffset.y + minY * 32, (maxX + 1 - minX) * 32, (maxY + 1 - minY) * 32); - } } /** {@inheritDoc} */ - public void mapObjectsChanged(final MapModelEvent e) { - modelChanged(); + public void mapObjectsChanged(final MapModelEvent<GameObject, MapArchObject> e) { + final GameObject[] gameObjects = e.getGameObjects(); + if (gameObjects != null) { + final Point point = new Point(); + for (final GameObject gameObject : gameObjects) { + if (!gameObject.isInContainer()) { + final MapSquare square = gameObject.getMapSquare(); + if (square != null) { + if (!isPickmap) { + point.x = square.getMapX(); + point.y = square.getMapY(); + paintTile(point); + } + repaint(0, borderOffset.x + square.getMapX() * 32, borderOffset.y + square.getMapY() * 32, 32, 32); + } + } + } + } } /** {@inheritDoc} */ @@ -155,15 +154,15 @@ /** {@inheritDoc} */ public void mapGridChanged(@NotNull final MapGridEvent e) { final Rectangle recChange = mapGrid.getRecChange(); - for (int x = recChange.x; x < recChange.x + recChange.width; x++) { - for (int y = recChange.y; y < recChange.y + recChange.height; y++) { - paintTile(new Point(x, y)); + if (!isPickmap) { + final Point point = new Point(); + for (point.x = recChange.x; point.x < recChange.x + recChange.width; point.x++) { + for (point.y = recChange.y; point.y < recChange.y + recChange.height; point.y++) { + paintTile(point); + } } } - - if (!isPickmap) { - repaint(0, borderOffset.x + recChange.x * 32, borderOffset.y + recChange.y * 32, recChange.width * 32, recChange.height * 32); - } + repaint(0, borderOffset.x + recChange.x * 32, borderOffset.y + recChange.y * 32, recChange.width * 32, recChange.height * 32); } /** {@inheritDoc} */ @@ -310,13 +309,8 @@ * @param point Map coordinates for the tile to draw */ private void paintTile(final Point point) { - final Graphics grfx; - if (isPickmap) { - grfx = getGraphics(); // graphics context for drawing in the mapview - } else { - grfx = backBuffer.getGraphics(); - } - + assert !isPickmap; + final Graphics grfx = backBuffer.getGraphics(); paintTile(grfx, point); // if grid is active, draw grid lines (right and bottom) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-01-23 23:03:57
|
Revision: 1691 http://svn.sourceforge.net/gridarta/?rev=1691&view=rev Author: akirschbaum Date: 2007-01-23 15:03:58 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Cleanup code. No functional changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 22:46:35 UTC (rev 1690) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-23 23:03:58 UTC (rev 1691) @@ -276,62 +276,52 @@ /** * Paints this component. * @param grfx The graphics context to paint to - * @param isSnapshot true when this drawing is for a - * "screenshot"-image, false for normal drawing - * @param checkClip if set, omit tiles outside <code>grfx</code>'s clip - * area + * @param isSnapshot true when this drawing is for a "screenshot"-image, false for normal drawing + * @param checkClip if set, omit tiles outside <code>grfx</code>'s clip area */ private void paintComponent(final Graphics grfx, final boolean isSnapshot, final boolean checkClip) { setColor(grfx); grfx.fillRect(0, 0, getWidth(), getHeight()); - final Point point = new Point(); - for (point.y = 0; point.y < mapGrid.getSize().getHeight(); point.y++) { - for (point.x = 0; point.x < mapGrid.getSize().getWidth(); point.x++) { - if (!checkClip || grfx.hitClip(point.x * 32, point.y * 32, 32, 32)) { - paintTile(grfx, point); - } - } - } - + paintMap(grfx, checkClip); if (!isSnapshot) { - paintGrid(grfx); - paintSelection(grfx); + paintMapGrid(grfx); + paintMapSelection(grfx); } } /** - * Paints only one tile of the map. This is an incredible time-saver - * for insert/select/delete tile actions. - * <p/> - * Important: This method currently works only for standard - * (rectangular) view. Iso has overlapping tiles which makes this a lot - * more difficult. :( - * @param point Map coordinates for the tile to draw + * Paint one square of the map. + * @param point the map coordinates of the square to draw */ private void paintTile(final Point point) { assert !isPickmap; final Graphics grfx = backBuffer.getGraphics(); paintTile(grfx, point); + paintTileGrid(grfx, point); + paintTileSelection(grfx, point); + } - // if grid is active, draw grid lines (right and bottom) + /** + * Paint the grid for one square. The grid is not painted if it is + * disabled. + * @param grfx the graphics context to draw in + * @param point the map coordinates of the square to draw + */ + private void paintTileGrid(final Graphics grfx, final Point point) { if (mapViewBasic.isGridVisible()) { // horizontal: grfx.drawLine(point.x * 32, point.y * 32, point.x * 32, point.y * 32 + 32); // vertical: grfx.drawLine(point.x * 32, point.y * 32, point.x * 32 + 32, point.y * 32); } - - // if tile is highlighted, draw the highlight icon - paintHighlightTile(grfx, point); } /** - * If the given map-square is highlighted, the highligh-icon is drawn - * on that square. - * @param point Map coordinates of the square to highlight - * @param grfx graphics context to draw in + * Paint the selection for one square. + * @param grfx the graphics context to draw in + * @param point map coordinates of the square to highlight */ - private void paintHighlightTile(final Graphics grfx, final Point point) { + private void paintTileSelection(final Graphics grfx, final Point point) { final int gridFlags = mapGrid.getFlags(point.x, point.y); if ((gridFlags & MapGrid.GRID_FLAG_SELECTING) != 0) { CMainControl.getMapSelIcon().paintIcon(this, grfx, point.x * 32, point.y * 32); @@ -345,11 +335,26 @@ } /** - * Paints the selection. - * It's recommended to paint the complete selection after the map itself, otherwise map elements actually might hide selections. - * @param grfx Graphics for painting + * Paint the whole map. + * @param grfx the graphics context to draw in + * @param checkClip if set, omit tiles outside <code>grfx</code>'s clip area */ - private void paintSelection(final Graphics grfx) { + private void paintMap(final Graphics grfx, final boolean checkClip) { + final Point point = new Point(); + for (point.y = 0; point.y < mapGrid.getSize().getHeight(); point.y++) { + for (point.x = 0; point.x < mapGrid.getSize().getWidth(); point.x++) { + if (!checkClip || grfx.hitClip(point.x * 32, point.y * 32, 32, 32)) { + paintTile(grfx, point); + } + } + } + } + + /** + * Paint the selection for the whole map. + * @param grfx the graphics context to draw in + */ + private void paintMapSelection(final Graphics grfx) { for (int y = 0; y < mapSize.getHeight(); y++) { for (int x = 0; x < mapSize.getWidth(); x++) { if (grfx.hitClip(x * 32, y * 32, 32, 32)) { @@ -369,12 +374,11 @@ } /** - * Paints the grid if desired. - * The grid is not painted if <code><var>gridVisibility</var></code> is <code>false</code>. - * It's recommended to paint the complete grid after the map itself, otherwise map elements actually might hide parts of the grid. - * @param grfx Graphics for painting + * Paint the grid of the whole map. The grid is not painted if it is + * disabled. + * @param grfx the graphics context to draw in */ - private void paintGrid(final Graphics grfx) { + private void paintMapGrid(final Graphics grfx) { // grid lines if (mapViewBasic.isGridVisible()) { for (int x = 0; x <= mapGrid.getSize().getWidth(); x++) { @@ -444,7 +448,6 @@ } private void paintTile(final Graphics grfx, final Point point) { - // ---------- draw tile for rectangular view (non-iso) -------------- filter.newSquare(); setColor(grfx); if (!mapModel.containsArchObject(point)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-01-25 01:35:32
|
Revision: 1697 http://svn.sourceforge.net/gridarta/?rev=1697&view=rev Author: akirschbaum Date: 2007-01-24 12:51:11 -0800 (Wed, 24 Jan 2007) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-24 20:46:12 UTC (rev 1696) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-01-24 20:51:11 UTC (rev 1697) @@ -88,7 +88,7 @@ private final CFilterControl filter; - private final ArchetypeSet archlist; + private final ArchetypeSet archetypeSet; private final Point offset = new Point(); @@ -187,7 +187,7 @@ mapSize = mapModel.getMapSize(); this.mapGrid = mapGrid; filter = mainControl.getFilterControl(); - archlist = mainControl.getArchetypeSet(); + archetypeSet = mainControl.getArchetypeSet(); isPickmap = pickmap; @@ -466,7 +466,7 @@ if (!isPickmap && !mainControl.isTileEdit(node)) { continue; } - final ImageIcon img = archlist.getFace(node); + final ImageIcon img = archetypeSet.getFace(node); if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { offset.x = 0; offset.y = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-02-13 20:29:00
|
Revision: 1902 http://svn.sourceforge.net/gridarta/?rev=1902&view=rev Author: akirschbaum Date: 2007-02-13 12:28:01 -0800 (Tue, 13 Feb 2007) Log Message: ----------- Update comment. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-02-13 20:25:57 UTC (rev 1901) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-02-13 20:28:01 UTC (rev 1902) @@ -49,7 +49,7 @@ /** * The component that does the actual rendering of tiles in the palette. - * Flat version. + * * @author unknown * @author Andreas Kirschbaum */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-02-23 07:53:59
|
Revision: 1918 http://svn.sourceforge.net/gridarta/?rev=1918&view=rev Author: akirschbaum Date: 2007-02-22 23:53:35 -0800 (Thu, 22 Feb 2007) Log Message: ----------- Remove isPickmap() method. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-02-23 07:51:58 UTC (rev 1917) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-02-23 07:53:35 UTC (rev 1918) @@ -213,14 +213,6 @@ mapGrid.removeMapGridListener(mapGridListener); } - /** - * Returns whether the rendered map is a pickmap. - * @return <code>true</code> if the rendered map is a pickmap, otherwise <code>false</code> - */ - private boolean isPickmap() { - return isPickmap; - } - /** {@inheritDoc} */ public BufferedImage getFullImage() { final int viewWidth = 32 * mapSize.getWidth(); @@ -495,7 +487,7 @@ private void resizeMapGrid() { // define how much drawing space we need for the map mapSize = mapGrid.getSize(); - final Dimension forcedSize = new Dimension(mapSize.getWidth() * 32 + (isPickmap() ? 0 : 64), mapSize.getHeight() * 32 + (isPickmap() ? 0 : 64)); + final Dimension forcedSize = new Dimension(mapSize.getWidth() * 32 + (isPickmap ? 0 : 64), mapSize.getHeight() * 32 + (isPickmap ? 0 : 64)); setPreferredSize(forcedSize); setMinimumSize(forcedSize); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-02-23 08:11:39
|
Revision: 1920 http://svn.sourceforge.net/gridarta/?rev=1920&view=rev Author: akirschbaum Date: 2007-02-23 00:11:38 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Simplify expression. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-02-23 07:57:51 UTC (rev 1919) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-02-23 08:11:38 UTC (rev 1920) @@ -487,7 +487,7 @@ private void resizeMapGrid() { // define how much drawing space we need for the map mapSize = mapGrid.getSize(); - final Dimension forcedSize = new Dimension(mapSize.getWidth() * 32 + (isPickmap ? 0 : 64), mapSize.getHeight() * 32 + (isPickmap ? 0 : 64)); + final Dimension forcedSize = new Dimension(mapSize.getWidth() * 32 + 2 * borderOffset.x, mapSize.getHeight() * 32 + 2 * borderOffset.y); setPreferredSize(forcedSize); setMinimumSize(forcedSize); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-03-20 06:17:31
|
Revision: 1930 http://svn.sourceforge.net/gridarta/?rev=1930&view=rev Author: akirschbaum Date: 2007-03-19 23:17:28 -0700 (Mon, 19 Mar 2007) Log Message: ----------- Move field initialization to declaration. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-03-20 06:15:34 UTC (rev 1929) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-03-20 06:17:28 UTC (rev 1930) @@ -73,7 +73,11 @@ /** offset to map borders (32 for std. rect. maps, 0 for pickmaps). */ private final Point borderOffset = new Point(); - private final Color[] highLightMask; + private final Color[] highLightMask = new Color[] { + new Color(1.0f, 0.0f, 0.0f, 0.33f), + new Color(0.0f, 1.0f, 0.0f, 0.33f), + new Color(0.0f, 1.0f, 1.0f, 0.33f), + }; private BufferedImage backBuffer; @@ -193,10 +197,6 @@ setFocusable(true); borderOffset.setLocation(pickmap ? 0 : 32, pickmap ? 0 : 32); - highLightMask = new Color[]{ - new Color(1.0f, 0.0f, 0.0f, 0.33f), - new Color(0.0f, 1.0f, 0.0f, 0.33f), - new Color(0.0f, 1.0f, 1.0f, 0.33f)}; resizeMapGrid(); mapModel.addMapModelListener(mapModelListener); mapGrid.addMapGridListener(mapGridListener); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-03-20 07:24:23
|
Revision: 1928 http://svn.sourceforge.net/gridarta/?rev=1928&view=rev Author: akirschbaum Date: 2007-03-19 23:08:35 -0700 (Mon, 19 Mar 2007) Log Message: ----------- Remove redundant variable. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-03-20 06:01:16 UTC (rev 1927) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-03-20 06:08:35 UTC (rev 1928) @@ -77,9 +77,6 @@ private BufferedImage backBuffer; - /** Current size of {@link #backBuffer} image. */ - private final Dimension bufferedSize = new Dimension(); - private final MapModel mapModel; private final CMainControl mainControl; @@ -233,7 +230,7 @@ if (isPickmap) { paintComponent(g, false, true); } else { - paintFromBackbuffer(g, 0, 0, bufferedSize.width, bufferedSize.height); + paintFromBackbuffer(g, 0, 0, backBuffer.getWidth(), backBuffer.getHeight()); } } @@ -417,10 +414,9 @@ } final Dimension size = new Dimension(mapSize.getWidth() * 32, mapSize.getHeight() * 32); - if (bufferedSize.equals(size)) { + if (backBuffer != null && backBuffer.getWidth() == size.width && backBuffer.getHeight() == size.height) { return true; } - bufferedSize.setSize(size); if (log.isDebugEnabled()) { log.debug("Creating a backbuffer of size " + size.width + "x" + size.height + "."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2007-03-20 08:54:11
|
Revision: 1929 http://svn.sourceforge.net/gridarta/?rev=1929&view=rev Author: akirschbaum Date: 2007-03-19 23:15:34 -0700 (Mon, 19 Mar 2007) Log Message: ----------- Rename method name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-03-20 06:08:35 UTC (rev 1928) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2007-03-20 06:15:34 UTC (rev 1929) @@ -110,7 +110,7 @@ if (!isPickmap) { point.x = square.getMapX(); point.y = square.getMapY(); - paintTile(point); + paintBackBufferTile(point); } repaint(0, borderOffset.x + square.getMapX() * 32, borderOffset.y + square.getMapY() * 32, 32, 32); } @@ -129,7 +129,7 @@ if (!isPickmap) { point.x = square.getMapX(); point.y = square.getMapY(); - paintTile(point); + paintBackBufferTile(point); } repaint(0, borderOffset.x + square.getMapX() * 32, borderOffset.y + square.getMapY() * 32, 32, 32); } @@ -157,7 +157,7 @@ final Point point = new Point(); for (point.x = recChange.x; point.x < recChange.x + recChange.width; point.x++) { for (point.y = recChange.y; point.y < recChange.y + recChange.height; point.y++) { - paintTile(point); + paintBackBufferTile(point); } } } @@ -281,11 +281,11 @@ } /** - * Paint one square of the map. + * Paint one square of the map to the {@link #backBuffer}. * @param point the map coordinates of the square to draw */ - private void paintTile(final Point point) { - assert !isPickmap; + private void paintBackBufferTile(final Point point) { + assert backBuffer != null; final Graphics grfx = backBuffer.getGraphics(); paintTile(grfx, point); paintTileGrid(grfx, point); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |