[cairo-commit] CairoJava/jni CairoX.cpp, NONE, 1.1 Makefile, 1.6, 1.7 Cairo.cpp, 1.5, 1.6

Charles Tuckey commit at pdx.freedesktop.org
Wed Dec 8 20:11:04 PST 2004


Committed by: ctuckey

Update of /cvs/cairo/CairoJava/jni
In directory gabe:/tmp/cvs-serv24142

Modified Files:
	Makefile Cairo.cpp 
Added Files:
	CairoX.cpp 
Log Message:
Moved public functions that are not part of the cairo API out of Cairo.cpp
and put them into CairoX.cpp (a new file).
Adjusted Makefile to include the new CairoX.o in the JNI library.


--- NEW FILE: CairoX.cpp ---
/*
 * Copyright (C) 2003, 2004 Verano
 *
 * This library is free software; you can redistribute it and/or
 * modify it either under the terms of the GNU Lesser General Public
 * License version 2.1 as published by the Free Software Foundation
 * (the "LGPL") or, at your option, under the terms of the Mozilla
 * Public License Version 1.1 (the "MPL"). If you do not alter this
 * notice, a recipient may use your version of this file under either
 * the MPL or the LGPL.
 *
 * You should have received a copy of the LGPL along with this library
 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 * You should have received a copy of the MPL along with this library
 * in the file COPYING-MPL-1.1
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
 * the specific language governing rights and limitations.
 *
 * The Original Code is the cairo java library.
 *
 * The Initial Developer of the Original Code is Verano, Inc.
 *
 * Contributor(s):
 *      Soorya Kuloor (skuloor at verano.com)
 *      Charles Tuckey (ctuckey at verano.com)
 *
 *
 * VERANO MAKES NO REPRESENTATIONS OR WARRANTIES OR COVENANTS, EITHER EXPRESS OR
 * IMPLIED, WITH RESPECT TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION,
 * STATUTORY OR IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR
 * A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, OR ARISING FROM CUSTOM, COURSE
 * OF DEALING, USAGE OF TRADE OR COURSE OF PERFORMANCE, ALL OF WHICH ARE
 * EXPRESSLY DISCLAIMED TO THE FULLEST EXTENT ALLOWABLE BY APPLICABLE LAW. IN NO
 * EVENT SHALL VERANO BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 * SOFTWARE.
 */
 
#include <cairo.h>
#include "Cairo.h"
#include "utils.h"

/*
 * Class:     org_cairographics_cairo_Cairo
 * Method:    cairo_hline_to
 * Signature: (JD)V
 */
JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1hline_1to
  (JNIEnv *env, jclass me, jlong crp, jdouble x)
{
    double curx, cury;
#ifdef CAIROJAVA_TRACE
    fprintf(stderr, "cairo_current_point (%p, %p, %p)\n", TO_PTR(cairo_t, crp), &curx, &cury);
#endif
    cairo_current_point(TO_PTR(cairo_t, crp), &curx, &cury);
    
#ifdef CAIROJAVA_TRACE
    fprintf(stderr, "cairo_line_to (%p, %f, %f)\n", TO_PTR(cairo_t, crp), x, cury);
#endif
    cairo_line_to(TO_PTR(cairo_t, crp), x, cury);
}

/*
 * Class:     org_cairographics_cairo_Cairo
 * Method:    cairo_vline_to
 * Signature: (JD)V
 */
JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1vline_1to
  (JNIEnv *env, jclass me, jlong crp, jdouble y)
{
    double curx, cury;
#ifdef CAIROJAVA_TRACE
    fprintf(stderr, "cairo_current_point (%p, %p, %p)\n", TO_PTR(cairo_t, crp), &curx, &cury);
#endif
    cairo_current_point(TO_PTR(cairo_t, crp), &curx, &cury);
    
#ifdef CAIROJAVA_TRACE
    fprintf(stderr, "cairo_line_to (%p, %f, %f)\n", TO_PTR(cairo_t, crp), curx, y);
#endif
    cairo_line_to(TO_PTR(cairo_t, crp), curx, y);
}

/*
 * Class:     org_cairographics_cairo_Cairo
 * Method:    cairo_quad_to
 * Signature: (JDDDD)V
 */
JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1quad_1to
  (JNIEnv *env, jclass me, jlong crp,
    jdouble x1, jdouble y1, jdouble x2, jdouble y2)
{
    double curx, cury;
    double controlx0, controly0;
    double controlx1, controly1;

#ifdef CAIROJAVA_TRACE
    fprintf(stderr, "cairo_current_point (%p, %p, %p)\n", TO_PTR(cairo_t, crp), &curx, &cury);
#endif
    cairo_current_point(TO_PTR(cairo_t, crp), &curx, &cury);

    controlx0 = curx + 2.0 / 3.0 * (x1 - curx);
    controly0 = cury + 2.0 / 3.0 * (y1 - cury);

    controlx1 = x2 + 2.0 / 3.0 * (x1 - x2);
    controly1 = y2 + 2.0 / 3.0 * (y1 - y2);

#ifdef CAIROJAVA_TRACE
    fprintf(stderr, "cairo_curve_to (%p, %f, %f, %f, %f, %f, %f)\n", TO_PTR(cairo_t, crp), 
                     controlx0, controly0,
                     controlx1, controly1,
                     x2, y2);
#endif
    cairo_curve_to(TO_PTR(cairo_t, crp),
              controlx0, controly0,
              controlx1, controly1,
              x2, y2);
}

/*
 * Class:     org_cairographics_cairo_Cairo
 * Method:    cairo_rel_hline_to
 * Signature: (JD)V
 */
JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1rel_1hline_1to
  (JNIEnv *env, jclass me, jlong crp, jdouble dx)
{
#ifdef CAIROJAVA_TRACE
    fprintf(stderr, "cairo_rel_line_to (%p, %f, %f)\n", TO_PTR(cairo_t, crp), dx, 0.0);
#endif
    cairo_rel_line_to(TO_PTR(cairo_t, crp), dx, 0.0);
}

/*
 * Class:     org_cairographics_cairo_Cairo
 * Method:    cairo_rel_vline_to
 * Signature: (JD)V
 */
JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1rel_1vline_1to
  (JNIEnv *env, jclass me, jlong crp, jdouble dy)
{
#ifdef CAIROJAVA_TRACE
    fprintf(stderr, "cairo_rel_line_to (%p, %f, %f)\n", TO_PTR(cairo_t, crp), 0.0, dy);
#endif
    cairo_rel_line_to(TO_PTR(cairo_t, crp), 0.0, dy);
}

/*
 * Class:     org_cairographics_cairo_Cairo
 * Method:    cairo_rel_quad_to
 * Signature: (JDDDD)V
 */
JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1rel_1quad_1to
  (JNIEnv *env, jclass me, jlong crp,
    jdouble dx1, jdouble dy1, jdouble dx2, jdouble dy2)
{
    double curx, cury;
    
#ifdef CAIROJAVA_TRACE
    fprintf(stderr, "cairo_current_point (%p, %p, %p)\n", TO_PTR(cairo_t, crp), &curx, &cury);
#endif
    cairo_current_point(TO_PTR(cairo_t, crp), &curx, &cury);
    Java_org_cairographics_cairo_Cairo_cairo_1quad_1to(
        env, me, crp,
        curx + dx1, cury + dy1,
        curx + dx2, cury + dy2);
}


Index: Makefile
===================================================================
RCS file: /cvs/cairo/CairoJava/jni/Makefile,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile	9 Dec 2004 03:38:40 -0000	1.6
+++ Makefile	9 Dec 2004 04:11:02 -0000	1.7
@@ -24,7 +24,11 @@
 	CairoGlitzSurface.cpp \
 	utils.cpp
 
-OBJS = $(patsubst %.cpp,%.o,$(SRCS)) 
+SRCS_NO_HEADERS = CairoX.cpp
+
+OBJS = $(patsubst %.cpp,%.o,$(SRCS))  \
+       $(patsubst %.cpp,%.o,$(SRCS_NO_HEADERS)) 
+
 HEADERS = $(patsubst %.cpp,%.h,$(SRCS))
 
 all:	$(LIBDIR)/libcairoJni.so

Index: Cairo.cpp
===================================================================
RCS file: /cvs/cairo/CairoJava/jni/Cairo.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Cairo.cpp	6 Dec 2004 03:44:53 -0000	1.5
+++ Cairo.cpp	9 Dec 2004 04:11:02 -0000	1.6
@@ -690,46 +690,6 @@
 
 /*
  * Class:     org_cairographics_cairo_Cairo
- * Method:    cairo_hline_to
- * Signature: (JD)V
- */
-JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1hline_1to
-  (JNIEnv *env, jclass me, jlong crp, jdouble x)
-{
-    double curx, cury;
-#ifdef CAIROJAVA_TRACE
-    fprintf(stderr, "cairo_current_point (%p, %p, %p)\n", TO_PTR(cairo_t, crp), &curx, &cury);
-#endif
-    cairo_current_point(TO_PTR(cairo_t, crp), &curx, &cury);
-    
-#ifdef CAIROJAVA_TRACE
-    fprintf(stderr, "cairo_line_to (%p, %f, %f)\n", TO_PTR(cairo_t, crp), x, cury);
-#endif
-    cairo_line_to(TO_PTR(cairo_t, crp), x, cury);
-}
-
-/*
- * Class:     org_cairographics_cairo_Cairo
- * Method:    cairo_vline_to
- * Signature: (JD)V
- */
-JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1vline_1to
-  (JNIEnv *env, jclass me, jlong crp, jdouble y)
-{
-    double curx, cury;
-#ifdef CAIROJAVA_TRACE
-    fprintf(stderr, "cairo_current_point (%p, %p, %p)\n", TO_PTR(cairo_t, crp), &curx, &cury);
-#endif
-    cairo_current_point(TO_PTR(cairo_t, crp), &curx, &cury);
-    
-#ifdef CAIROJAVA_TRACE
-    fprintf(stderr, "cairo_line_to (%p, %f, %f)\n", TO_PTR(cairo_t, crp), curx, y);
-#endif
-    cairo_line_to(TO_PTR(cairo_t, crp), curx, y);
-}
-
-/*
- * Class:     org_cairographics_cairo_Cairo
  * Method:    cairo_curve_to
  * Signature: (JDDDDDD)V
  */
@@ -747,42 +707,6 @@
 
 /*
  * Class:     org_cairographics_cairo_Cairo
- * Method:    cairo_quad_to
- * Signature: (JDDDD)V
- */
-JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1quad_1to
-  (JNIEnv *env, jclass me, jlong crp,
-    jdouble x1, jdouble y1, jdouble x2, jdouble y2)
-{
-    double curx, cury;
-    double controlx0, controly0;
-    double controlx1, controly1;
-
-#ifdef CAIROJAVA_TRACE
-    fprintf(stderr, "cairo_current_point (%p, %p, %p)\n", TO_PTR(cairo_t, crp), &curx, &cury);
-#endif
-    cairo_current_point(TO_PTR(cairo_t, crp), &curx, &cury);
-
-    controlx0 = curx + 2.0 / 3.0 * (x1 - curx);
-    controly0 = cury + 2.0 / 3.0 * (y1 - cury);
-
-    controlx1 = x2 + 2.0 / 3.0 * (x1 - x2);
-    controly1 = y2 + 2.0 / 3.0 * (y1 - y2);
-
-#ifdef CAIROJAVA_TRACE
-    fprintf(stderr, "cairo_curve_to (%p, %f, %f, %f, %f, %f, %f)\n", TO_PTR(cairo_t, crp), 
-                     controlx0, controly0,
-                     controlx1, controly1,
-                     x2, y2);
-#endif
-    cairo_curve_to(TO_PTR(cairo_t, crp),
-              controlx0, controly0,
-              controlx1, controly1,
-              x2, y2);
-}
-
-/*
- * Class:     org_cairographics_cairo_Cairo
  * Method:    cairo_arc_to
  * Signature: (JDDDIIDD)V
  */
@@ -827,34 +751,6 @@
 
 /*
  * Class:     org_cairographics_cairo_Cairo
- * Method:    cairo_rel_hline_to
- * Signature: (JD)V
- */
-JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1rel_1hline_1to
-  (JNIEnv *env, jclass me, jlong crp, jdouble dx)
-{
-#ifdef CAIROJAVA_TRACE
-    fprintf(stderr, "cairo_rel_line_to (%p, %f, %f)\n", TO_PTR(cairo_t, crp), dx, 0.0);
-#endif
-    cairo_rel_line_to(TO_PTR(cairo_t, crp), dx, 0.0);
-}
-
-/*
- * Class:     org_cairographics_cairo_Cairo
- * Method:    cairo_rel_vline_to
- * Signature: (JD)V
- */
-JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1rel_1vline_1to
-  (JNIEnv *env, jclass me, jlong crp, jdouble dy)
-{
-#ifdef CAIROJAVA_TRACE
-    fprintf(stderr, "cairo_rel_line_to (%p, %f, %f)\n", TO_PTR(cairo_t, crp), 0.0, dy);
-#endif
-    cairo_rel_line_to(TO_PTR(cairo_t, crp), 0.0, dy);
-}
-
-/*
- * Class:     org_cairographics_cairo_Cairo
  * Method:    cairo_rel_curve_to
  * Signature: (JDDDDDD)V
  */
@@ -872,27 +768,6 @@
 
 /*
  * Class:     org_cairographics_cairo_Cairo
- * Method:    cairo_rel_quad_to
- * Signature: (JDDDD)V
- */
-JNIEXPORT void JNICALL Java_org_cairographics_cairo_Cairo_cairo_1rel_1quad_1to
-  (JNIEnv *env, jclass me, jlong crp,
-    jdouble dx1, jdouble dy1, jdouble dx2, jdouble dy2)
-{
-    double curx, cury;
-    
-#ifdef CAIROJAVA_TRACE
-    fprintf(stderr, "cairo_current_point (%p, %p, %p)\n", TO_PTR(cairo_t, crp), &curx, &cury);
-#endif
-    cairo_current_point(TO_PTR(cairo_t, crp), &curx, &cury);
-    Java_org_cairographics_cairo_Cairo_cairo_1quad_1to(
-        env, me, crp,
-        curx + dx1, cury + dy1,
-        curx + dx2, cury + dy2);
-}
-
-/*
- * Class:     org_cairographics_cairo_Cairo
  * Method:    cairo_rel_arc_to
  * Signature: (JDDDIIDD)V
  */




More information about the cairo-commit mailing list