projects
/
org.ibex.core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2003/09/24 07:33:32
[org.ibex.core.git]
/
src
/
org
/
xwt
/
Surface.java
diff --git
a/src/org/xwt/Surface.java
b/src/org/xwt/Surface.java
index
922f2e3
..
089480e
100644
(file)
--- a/
src/org/xwt/Surface.java
+++ b/
src/org/xwt/Surface.java
@@
-17,6
+17,7
@@
import java.util.*;
* MessageQueue-time (the size/position/state at the time that the
* now-executing message was enqueued). This distinction is important.
*/
* MessageQueue-time (the size/position/state at the time that the
* now-executing message was enqueued). This distinction is important.
*/
+// FIXME: put the scar box back in
public abstract class Surface extends PixelBuffer {
public int getWidth() { return root == null ? 0 : root.width; }
public abstract class Surface extends PixelBuffer {
public int getWidth() { return root == null ? 0 : root.width; }
@@
-33,9
+34,6
@@
public abstract class Surface extends PixelBuffer {
/** When set to true, render() should abort as soon as possible and restart the rendering process */
static volatile boolean abort = false;
/** When set to true, render() should abort as soon as possible and restart the rendering process */
static volatile boolean abort = false;
- /** the scar image drawn on the bottom right hand corner */
- static Box scarBox = null;
-
public static boolean alt = false; ///< true iff the alt button is pressed down, in real time
public static boolean control = false; ///< true iff the control button is pressed down, in real time
public static boolean shift = false; ///< true iff the shift button is pressed down, in real time
public static boolean alt = false; ///< true iff the alt button is pressed down, in real time
public static boolean control = false; ///< true iff the control button is pressed down, in real time
public static boolean shift = false; ///< true iff the shift button is pressed down, in real time
@@
-224,9
+222,8
@@
public abstract class Surface extends PixelBuffer {
protected final void SizeChange(final int width, final int height) {
Message.Q.add(new Message() { public void perform() {
if (width == root.width && height == root.height) return;
protected final void SizeChange(final int width, final int height) {
Message.Q.add(new Message() { public void perform() {
if (width == root.width && height == root.height) return;
- root.width = width;
- root.height = height;
root.needs_reflow = true;
root.needs_reflow = true;
+ root.reflow(width, height);
}});
abort = true;
}
}});
abort = true;
}
@@
-252,12
+249,9
@@
public abstract class Surface extends PixelBuffer {
/** wrapper for setSize() which makes sure to dirty the place where the scar used to be */
void setSize() {
/** wrapper for setSize() which makes sure to dirty the place where the scar used to be */
void setSize() {
- scarBox.dirty();
- root.width = Math.max(root.width, scarBox.minwidth);
- root.height = Math.max(root.height, scarBox.minheight);
+ root.width = Math.max(root.width, 10);
+ root.height = Math.max(root.height, 10);
setSize(root.width, root.height);
setSize(root.width, root.height);
- scarBox.x = 0;
- scarBox.y = root.height - scarBox.minheight;
}
/** Indicates that the Surface is no longer needed */
}
/** Indicates that the Surface is no longer needed */
@@
-277,14
+271,8
@@
public abstract class Surface extends PixelBuffer {
}
public Surface(Box root) {
}
public Surface(Box root) {
+
this.root = root;
this.root = root;
- scarBox = new Box();
- try {
- scarBox.put("image", ((Res)Main.builtin.get("org/xwt/builtin/scar.png")).getInputStream());
- } catch (Exception e) {
- Log.log(this, e);
- }
- scarBox.surface = this;
if (root.surface != null && root.surface.root == root) root.surface.dispose(false);
else root.remove();
root.surface = this;
if (root.surface != null && root.surface.root == root) root.surface.dispose(false);
else root.remove();
root.surface = this;
@@
-296,11
+284,6
@@
public abstract class Surface extends PixelBuffer {
Refresh();
}
Refresh();
}
- public void paintRegion(int x, int y, int w, int h) {
- root.render(0, 0, x, y, w, h, this);
- scarBox.render(0, 0, x, y, w, h, this);
- }
-
/** runs the prerender() and render() pipelines in the root Box to regenerate the backbuffer, then blits it to the screen */
public synchronized void render() {
/** runs the prerender() and render() pipelines in the root Box to regenerate the backbuffer, then blits it to the screen */
public synchronized void render() {
@@
-326,7
+309,7
@@
public abstract class Surface extends PixelBuffer {
if (y+h > root.height) h = root.height - y;
if (w <= 0 || h <= 0) continue;
if (y+h > root.height) h = root.height - y;
if (w <= 0 || h <= 0) continue;
- paintRegion(x, y, w, h);
+ root.render(0, 0, x, y, w, h, this);
if (abort) {
if (abort) {
@@
-370,29
+353,17
@@
public abstract class Surface extends PixelBuffer {
public static abstract class DoubleBufferedSurface extends Surface {
public static abstract class DoubleBufferedSurface extends Surface {
- public DoubleBufferedSurface(Box root) {
- super(root);
-
- // this is a bit dangerous since we're passing ourselves to another method before subclasses' ctors have run...
- backbuffer = Platform.createPixelBuffer(Platform.getScreenWidth(), Platform.getScreenHeight(), this);
- }
-
- /** The automatic double buffer for the root box */
- PixelBuffer backbuffer = null;
-
- /** Dirty regions on the screen which need to be rebuilt using Surface.blit() */
+ public DoubleBufferedSurface(Box root) { super(root); }
+ PixelBuffer backbuffer = Platform.createPixelBuffer(Platform.getScreenWidth(), Platform.getScreenHeight(), this);
DirtyList screenDirtyRegions = new DirtyList();
public void drawPicture(Picture source, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {
DirtyList screenDirtyRegions = new DirtyList();
public void drawPicture(Picture source, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {
+ screenDirtyRegions.dirty(dx1, dy1, dx2 - dx1, dy2 - dy1);
backbuffer.drawPicture(source, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2); }
public void fillRect(int x1, int y1, int x2, int y2, int color) {
backbuffer.drawPicture(source, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2); }
public void fillRect(int x1, int y1, int x2, int y2, int color) {
+ screenDirtyRegions.dirty(x1, y1, x2 - x1, y2 - y1);
backbuffer.fillRect(x1, y1, x2, y2, color); }
backbuffer.fillRect(x1, y1, x2, y2, color); }
-
- public void paintRegion(int x, int y, int w, int h) {
- super.paintRegion(x, y, w, h);
- screenDirtyRegions.dirty(x, y, w, h);
- }
public void render() {
super.render();
public void render() {
super.render();