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. |