-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- much better behaviour in memory consumption
- fix for PaletteData using negative color shifts - more flexibility in defining the sizes of the used grid and image size
- Loading branch information
Stephan Schwiebert
committed
Feb 5, 2012
1 parent
de22871
commit eabe119
Showing
5 changed files
with
147 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
org.eclipse.zest.cloudio/src/main/java/org/eclipse/zest/cloudio/util/CloudMatrix.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2011 Stephan Schwiebert. All rights reserved. This program and | ||
* the accompanying materials are made available under the terms of the Eclipse | ||
* Public License v1.0 which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.zest.cloudio.util; | ||
|
||
import org.eclipse.zest.cloudio.util.RectTree.RectNode; | ||
|
||
/** | ||
* This class contains all global information about the drawable area | ||
* and the layouted words in form of a {@link RectTree}. | ||
* | ||
* @author sschwieb | ||
* | ||
*/ | ||
public class CloudMatrix { | ||
|
||
private RectTree tree; | ||
|
||
private final int max; | ||
|
||
private final int minResolution; | ||
|
||
public CloudMatrix(int maxSize, int minResolution) { | ||
this.max = maxSize; | ||
this.minResolution = minResolution; | ||
reset(); | ||
} | ||
|
||
public short get(int x, int y) { | ||
return tree.getRoot().getWordId(x*minResolution,y*minResolution); | ||
} | ||
|
||
public boolean isEmpty(int x, int y) { | ||
short id = tree.getRoot().getWordId(x*minResolution, y*minResolution); | ||
return id == -1 || id == 0; | ||
} | ||
|
||
public void reset() { | ||
SmallRect root = new SmallRect(0, 0, max, max); | ||
tree = new RectTree(root, minResolution); | ||
} | ||
|
||
public void set(RectNode node, short id, short xOffset, short yOffset, int minResolution) { | ||
int cleanX = (xOffset + node.rect.x) / minResolution; | ||
int cleanY = (yOffset + node.rect.y) / minResolution; | ||
SmallRect rect = new SmallRect(cleanX* minResolution, cleanY* minResolution, minResolution, minResolution); | ||
tree.insert(rect, id); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters