[cairo-commit] CairoJava/src/org/cairographics/cairo CairoSurface.java, 1.7, 1.8 Cairo.java, 1.7, 1.8 CairoFont.java, 1.2, 1.3 CairoMatrix.java, 1.5, 1.6 CairoException.java, 1.3, 1.4 CairoImageBuffer.java, 1.1, 1.2 CairoPattern.java, 1.1, 1.2 CairoGlitzSurface.java, 1.1, 1.2

Soorya Kuloor commit at pdx.freedesktop.org
Thu May 13 09:46:26 PDT 2004


Committed by: skuloor

Update of /cvs/cairo/CairoJava/src/org/cairographics/cairo
In directory pdx:/tmp/cvs-serv26183/src/org/cairographics/cairo

Modified Files:
	CairoSurface.java Cairo.java CairoFont.java CairoMatrix.java 
	CairoException.java CairoImageBuffer.java CairoPattern.java 
	CairoGlitzSurface.java 
Log Message:
Cleanup of JNI library loading code

Index: CairoSurface.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoSurface.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/CairoSurface.java	10 May 2004 23:03:53 -0000	1.7
--- b/CairoSurface.java	13 May 2004 16:46:23 -0000	1.8
***************
*** 33,36 ****
--- 33,40 ----
  public class CairoSurface {
  
+     static {
+         System.loadLibrary(Cairo.JNI_LIB);
+     }
+     
      /** Native handle for the drawing surface */
      long handle = 0;

Index: Cairo.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/Cairo.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/Cairo.java	10 May 2004 23:20:20 -0000	1.7
--- b/Cairo.java	13 May 2004 16:46:23 -0000	1.8
***************
*** 34,37 ****
--- 34,40 ----
   */
  public class Cairo {
+     
+     /** Cairo JNI library name */
+     final static String JNI_LIB = "cairoJni";
  
      /*
***************
*** 1004,1008 ****
       */
      static {
!         System.loadLibrary("cairoJni");
      }
      
--- 1007,1011 ----
       */
      static {
!         System.loadLibrary(JNI_LIB);
      }
      
***************
*** 1212,1214 ****
--- 1215,1218 ----
  
      native static void cairo_current_path_flat(long cr, FlatPathTracer tracer);
+ 
  }
\ No newline at end of file

Index: CairoFont.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoFont.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/CairoFont.java	30 Apr 2004 17:53:54 -0000	1.2
--- b/CairoFont.java	13 May 2004 16:46:23 -0000	1.3
***************
*** 36,39 ****
--- 36,43 ----
  public class CairoFont {
  
+     static {
+         System.loadLibrary(Cairo.JNI_LIB);
+     }
+     
      /*
       * Font weight options.

Index: CairoMatrix.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoMatrix.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/CairoMatrix.java	30 Apr 2004 17:53:54 -0000	1.5
--- b/CairoMatrix.java	13 May 2004 16:46:23 -0000	1.6
***************
*** 35,38 ****
--- 35,42 ----
  public class CairoMatrix {
      
+     static {
+         System.loadLibrary(Cairo.JNI_LIB);
+     }
+     
      /**
       * Native matrix handle.

Index: CairoException.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoException.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/CairoException.java	11 May 2004 19:53:31 -0000	1.3
--- b/CairoException.java	13 May 2004 16:46:23 -0000	1.4
***************
*** 35,38 ****
--- 35,42 ----
  public class CairoException extends RuntimeException {
  
+     static {
+         System.loadLibrary(Cairo.JNI_LIB);
+     }
+     
      /*
       * Cairo function call status constants

Index: CairoImageBuffer.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoImageBuffer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/CairoImageBuffer.java	30 Apr 2004 17:49:24 -0000	1.1
--- b/CairoImageBuffer.java	13 May 2004 16:46:24 -0000	1.2
***************
*** 28,31 ****
--- 28,32 ----
  
  import org.eclipse.swt.graphics.GC;
+ import org.eclipse.swt.graphics.Image;
  import org.eclipse.swt.widgets.Widget;
  
***************
*** 154,162 ****
      }
  
!     /*
!      * Native methods
       */
      static {
!         System.loadLibrary("cairoJni");
      }
      
--- 155,177 ----
      }
  
!     /**
!      * Draws the image on a pixmap object at the given location
!      * 
!      * @param pixmap
!      *            The pixmap to draw on
!      * @param gc
!      *            The graphics context
!      * @param dest_x
!      *            The x co-ordinate of the location to draw the image
!      * @param dest_y
!      *            The y co-ordinate of the location to draw the image
       */
+     public void drawOn(Image pixmap, GC gc, int dest_x, int dest_y) {
+         image_buffer_draw_on_pixmap(handle, pixmap.pixmap, gc.handle, dest_x, dest_y,
+                 this.width, this.height);
+     }
+ 
      static {
!         System.loadLibrary(Cairo.JNI_LIB);
      }
      
***************
*** 167,169 ****
--- 182,187 ----
      native static void image_buffer_draw(long handle, int widget, int gc,
              int src_x, int src_y, int dst_x, int dst_y, int width, int height);
+ 
+     native static void image_buffer_draw_on_pixmap(long handle, long pixmap, long gcp,  int dst_x, int dst_y, int width, int height);
+ 
  }
\ No newline at end of file

Index: CairoPattern.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoPattern.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/CairoPattern.java	30 Apr 2004 17:49:24 -0000	1.1
--- b/CairoPattern.java	13 May 2004 16:46:24 -0000	1.2
***************
*** 29,32 ****
--- 29,36 ----
  public class CairoPattern {
  
+     static {
+         System.loadLibrary(Cairo.JNI_LIB);
+     }
+     
      /* Pattern extend constants */
      public static final short EXTEND_NONE = 0;

Index: CairoGlitzSurface.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoGlitzSurface.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/CairoGlitzSurface.java	30 Apr 2004 17:49:24 -0000	1.1
--- b/CairoGlitzSurface.java	13 May 2004 16:46:24 -0000	1.2
***************
*** 31,34 ****
--- 31,42 ----
  public class CairoGlitzSurface extends CairoSurface {
  
+     private final static String GLLIB = "libGL.so.1";
+     private final static String GLLIB_PROPERTY = "org.cairographics.cairo.gllib";
+ 
+     static {
+         cairo_glitz_init(System.getProperty(GLLIB_PROPERTY, GLLIB));
+         System.out.println("DEBUG: " + System.getProperty(GLLIB_PROPERTY, GLLIB));
+     }
+     
      public CairoGlitzSurface(Widget w) {
          this.handle = glitz_glx_surface_create_for_window(w.handle);
***************
*** 48,58 ****
      }
      
-     /*
-      * Native methods
-      */
-     static {
-         System.loadLibrary("cairoJni");
-     }
- 
      native static void cairo_set_target_gl(long cr, long surface);
  
--- 56,59 ----
***************
*** 66,68 ****
--- 67,72 ----
      native static void glitz_glx_surface_flush(long surface, int x, int y,
              int width, int height);
+ 
+     native static void cairo_glitz_init(String openglLibname);
+ 
  }
\ No newline at end of file





More information about the cairo-commit mailing list