From 14c79b82aa525bab500334fac875b4d2b2685926 Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:35:48 +0000 Subject: [PATCH] 2003/09/19 05:01:36 darcs-hash:20040130073548-2ba56-5cb1cb36f9b08eb4e438e80434b8ec655830d052.gz --- Makefile | 6 +++--- src/org/xwt/Box.java.pp | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index c011be4..47cfc3f 100644 --- a/Makefile +++ b/Makefile @@ -177,7 +177,7 @@ build/mips/%.c.o: src/%.c echo -e "\n\033[1mcompiling $< -> $@ (mips)\033[0m" upstream/install/bin/mips-unknown-elf-gcc -march=r3000 -I upstream/freetype-2.1.4/src/include -c -o $@ $< -build/mips/freetype.mips: build/mips/org/xwt/imp/Freetype.c.o build/mips/org/xwt/imp/crt0.c.o build/mips/org/xwt/imp/syscalls.c.o +build/mips/freetype.mips: build/mips/org/xwt/translators/Freetype.c.o build/mips/org/xwt/mips/crt0.c.o build/mips/org/xwt/mips/syscalls.c.o make .install_freetype-2.1.4_mips-unknown-elf target=mips-unknown-elf @echo -e "\n\033[1mlinking .o -> .mips: $@\033[0m" mkdir -p build/mips @@ -185,11 +185,11 @@ build/mips/freetype.mips: build/mips/org/xwt/imp/Freetype.c.o build/mips/org/xwt -nostdlib \ --static \ -march=mips1 \ - -T src/org/xwt/imp/linker.ld \ + -T src/org/xwt/mips/linker.ld \ -Lbuild/mips \ -Lupstream/freetype-2.1.4/src/objs \ -o $@ \ - build/mips/org/xwt/imp/Freetype.c.o \ + build/mips/org/xwt/translators/Freetype.c.o \ --strip \ -lfreetype diff --git a/src/org/xwt/Box.java.pp b/src/org/xwt/Box.java.pp index f48835d..2b3a305 100644 --- a/src/org/xwt/Box.java.pp +++ b/src/org/xwt/Box.java.pp @@ -19,7 +19,7 @@ import java.net.*; import java.util.*; import org.xwt.js.*; import org.xwt.util.*; -import org.xwt.imp.*; +import org.xwt.translators.*; /** *

@@ -165,6 +165,7 @@ public final class Box extends JS.Scope { /** Adds the intersection of (x,y,w,h) and the node's current actual geometry to the Surface's dirty list */ public final void dirty() { dirty(0, 0, width, height); } public final void dirty(int x, int y, int w, int h) { + /* for(Box cur = this; cur != null; cur = cur.parent) { w = min(x + w, cur.width) - max(x, 0); h = min(y + h, cur.height) - max(y, 0); @@ -175,6 +176,10 @@ public final class Box extends JS.Scope { x += cur.x; y += cur.y; } + */ + Box cur; + for(cur = this; cur.parent != null; cur = cur.parent); + if (cur.surface != null) cur.surface.dirty(0, 0, cur.width, cur.height); } /** @@ -352,8 +357,8 @@ public final class Box extends JS.Scope { // --- Phase 3 ---------------------------------------------------------------------- // hand out the slack int slack; - //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows - slack = width; + //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows hpad/vpad + slack = width - 2 * hpad; for(int i=0; i 0) while(slack > 0) { @@ -435,13 +440,13 @@ public final class Box extends JS.Scope { b.render(globalx, globaly, clipx, clipy, clipw, cliph, buf); } - void renderStretchedImage(int globalx, int globaly, int x, int y, int w, int h, DoubleBuffer buf) { - buf.setClip(x, y, w + x, h + y); + void renderStretchedImage(int globalx, int globaly, int clipx, int clipy, int clipw, int cliph, DoubleBuffer buf) { + //buf.setClip(x, y, w + x, h + y); + System.out.println("draw " + clipx + " " + clipy + " " + (clipx + clipw) + " " + (clipy + cliph)); buf.drawPicture(image, - globalx, globaly, - globalx + width, globaly + height, + clipx, clipy, clipx + clipw, clipy + cliph, 0, 0, image.getWidth(), image.getHeight()); - buf.setClip(0, 0, buf.getWidth(), buf.getHeight()); + //buf.setClip(0, 0, buf.getWidth(), buf.getHeight()); } void renderTiledImage(int globalx, int globaly, int x, int y, int w, int h, DoubleBuffer buf) { @@ -467,8 +472,19 @@ public final class Box extends JS.Scope { } void renderText(int x, int y, int clipx, int clipy, int clipw, int cliph, DoubleBuffer buf) { + /* + // hack because (believe it or not) libgcj doesn't support UTF16. + byte[] b = new byte[text.length() * 2 + 2]; + for(int i=0; i> 8); + b[i * 2 + 1] = (byte)(((short)text.charAt(i)) & 0xff); + } + b[text.length()] = 0; + b[text.length() + 1] = 0; + */ + /* try { - ImageDecoder id = org.xwt.imp.Font.render(new FileInputStream("COMIC.TTF"), 24, text, false); + ImageDecoder id = org.xwt.translators.Font.render(new FileInputStream("COMIC.TTF"), 24, text, false); Picture p = Platform.createPicture(id); // FIXME: clipping (don't use setClip) buf.drawPicture(p, @@ -479,6 +495,7 @@ public final class Box extends JS.Scope { } catch (Exception e) { Log.log(this, e); } + */ } @@ -989,7 +1006,7 @@ public final class Box extends JS.Scope { b.textwidth = b.textheight = 0; } else { try { - ImageDecoder id = org.xwt.imp.Font.render(new FileInputStream("COMIC.TTF"), 24, b.text, true); + ImageDecoder id = org.xwt.translators.Font.render(new FileInputStream("COMIC.TTF"), 24, b.text, true); if (id.getWidth() != b.textwidth || id.getHeight() != b.textheight) MARK_FOR_REFLOW_b; b.textwidth = id.getWidth(); b.textheight = id.getHeight(); @@ -1182,8 +1199,8 @@ public final class Box extends JS.Scope { if ((b.image = ImageDecoder.getPicture(s)) == null) { if (Log.on) Log.logJS(Box.class, "unable to load image " + s); } else { - b.minwidth = b.maxwidth = b.image.getWidth(); - b.minheight = b.maxheight = b.image.getHeight(); + b.minwidth = b.image.getWidth(); + b.minheight = b.image.getHeight(); MARK_FOR_REFLOW_b; } } -- 1.7.10.4