[libbluray-devel] BDComponentPeer: Implement PaintEvent handling. Fixes painting some HScenes in J2SE.

hpi1 git at videolan.org
Wed Mar 6 14:03:45 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Mar  6 14:43:04 2013 +0200| [4b61c1827b706e842c2e479ccbed18fc2522e59a] | committer: hpi1

BDComponentPeer: Implement PaintEvent handling. Fixes painting some HScenes in J2SE.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=4b61c1827b706e842c2e479ccbed18fc2522e59a
---

 .../java-j2se/java/awt/peer/BDComponentPeer.java   |   26 +++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdj/java-j2se/java/awt/peer/BDComponentPeer.java b/src/libbluray/bdj/java-j2se/java/awt/peer/BDComponentPeer.java
index 6b7f37e..2902d21 100644
--- a/src/libbluray/bdj/java-j2se/java/awt/peer/BDComponentPeer.java
+++ b/src/libbluray/bdj/java-j2se/java/awt/peer/BDComponentPeer.java
@@ -48,6 +48,7 @@ public abstract class BDComponentPeer implements ComponentPeer
     }
 
     public void createBuffers(int x, BufferCapabilities bufferCapabilities) {
+        logger.unimplemented("createBuffers");
     }
 
     public Image createImage(ImageProducer producer) {
@@ -66,7 +67,7 @@ public abstract class BDComponentPeer implements ComponentPeer
 
     public VolatileImage createVolatileImage(int width, int height) {
         logger.unimplemented("createVolatileImage");
-        throw new Error();
+        return null;
     }
 
     public void destroyBuffers() {
@@ -145,6 +146,26 @@ public abstract class BDComponentPeer implements ComponentPeer
     }
 
     public void handleEvent(AWTEvent e) {
+        int id = e.getID();
+
+        if (e instanceof PaintEvent) {
+            Graphics g = null;
+            Rectangle r = ((PaintEvent)e).getUpdateRect();
+            try {
+                g = component.getGraphics();
+                if (g == null)
+                    return;
+                g.clipRect(r.x, r.y, r.width, r.height);
+                if (id == PaintEvent.PAINT)
+                    component.paint(g);
+                else
+                    component.update(g);
+                toolkit.sync();
+            } finally {
+                if (g != null)
+                    g.dispose();
+            }
+        }
     }
 
     public boolean handlesWheelScrolling() {
@@ -177,6 +198,7 @@ public abstract class BDComponentPeer implements ComponentPeer
     }
 
     public void paint(Graphics g) {
+        component.paint(g);
     }
 
     /* java 1.6 only */
@@ -193,6 +215,7 @@ public abstract class BDComponentPeer implements ComponentPeer
 
     /* java 1.6 only */
     public void repaint(long tm, int x, int y, int width, int height) {
+        logger.unimplemented("repaint");
     }
 
     public void reparent(ContainerPeer p) {
@@ -219,6 +242,7 @@ public abstract class BDComponentPeer implements ComponentPeer
     }
 
     public void setEnabled(boolean b) {
+        logger.unimplemented("setEnabled");
     }
 
     public void setFont(Font f) {



More information about the libbluray-devel mailing list