harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r440748 [14/25] - in /incubator/harmony/enhanced/classlib/trunk/modules: accessibility/src/main/java/javax/accessibility/ awt/ awt/make/ awt/src/main/java/common/java/awt/ awt/src/main/java/common/java/awt/datatransfer/ awt/src/main/java/co...
Date Wed, 06 Sep 2006 16:06:30 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWindow.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWindow.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWindow.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWindow.java Wed Sep  6 09:06:15 2006
@@ -104,8 +104,8 @@
     }
 
     public void setVisible(final boolean visible) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 int cmd;
                 if (visible) {
                     cmd = iconified ? WindowsDefs.SW_SHOWMINNOACTIVE : WindowsDefs.SW_SHOW;
@@ -116,12 +116,12 @@
                 win32.ShowWindow(hwnd, cmd);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     public void setBounds(final int x, final int y, final int w, final int h, final int boundsMask) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 if (iconified || maximized) {
                     setNotNormalBounds(x, y, w, h, boundsMask);
                 } else {
@@ -129,7 +129,7 @@
                 }
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     private void setNotNormalBounds(int x, int y, int w, int h, int boundsMask) {
@@ -198,86 +198,86 @@
     }
 
     public void setEnabled(final boolean value) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 win32.EnableWindow(hwnd, value ? 1 : 0);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     public void dispose() {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 factory.remove(WinWindow.this);
                 win32.DestroyWindow(hwnd);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     /**
      * @see org.apache.harmony.awt.wtk.NativeWindow#placeAfter(org.apache.harmony.awt.wtk.NativeWindow)
      */
     public void placeAfter(final NativeWindow w) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 long hwndPrev = (w == null ? WindowsDefs.HWND_TOP : w.getId());
                 int flags = WindowsDefs.SWP_NOMOVE | WindowsDefs.SWP_NOSIZE;
                 win32.SetWindowPos(hwnd, hwndPrev, 0, 0, 0, 0, flags);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     public void toFront() {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 int flags = WindowsDefs.SWP_NOMOVE | WindowsDefs.SWP_NOSIZE;
                 win32.SetWindowPos(hwnd, WindowsDefs.HWND_TOP, 0, 0, 0, 0, flags);
                 win32.SetForegroundWindow(hwnd);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     public void toBack() {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 int flags = WindowsDefs.SWP_NOMOVE | WindowsDefs.SWP_NOSIZE;
                 win32.SetWindowPos(hwnd, WindowsDefs.HWND_BOTTOM, 0, 0, 0, 0, flags);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     public boolean setFocus(final boolean focus) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 long res = win32.SetFocus(focus ? hwnd : 0);
                 returnValue = new Boolean(res != 0);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
-        return ((Boolean) callback.returnValue).booleanValue();
+        factory.eventQueue.performTask(task);
+        return ((Boolean) task.returnValue).booleanValue();
     }
 
     public void setTitle(final String title) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 win32.SetWindowTextW(hwnd, title);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     public void setResizable(final boolean value) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 modifyStyle(WindowsDefs.WS_SIZEBOX|WindowsDefs.WS_MAXIMIZEBOX, value);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     public void grabMouse() {
@@ -353,8 +353,8 @@
     }
 
     public void setState(final int state) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 if (state == Frame.NORMAL) {
                     win32.ShowWindow(hwnd, WindowsDefs.SW_SHOWNORMAL);
                 } else if (state == Frame.MAXIMIZED_BOTH) {
@@ -377,15 +377,15 @@
                 }
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     /**
      * @see org.apache.harmony.awt.wtk.NativeWindow#setIconImage(java.awt.Image)
      */
     public void setIconImage(final Image image) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 long hIcon = 0;
                 if (image != null) {
                     hIcon = WinIcons.createIcon(true, image, 0, 0);
@@ -394,7 +394,7 @@
                 win32.SendMessageW(hwnd, WindowsDefs.WM_SETICON, WindowsDefs.ICON_SMALL, hIcon);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
 
     }
 
@@ -423,15 +423,15 @@
      * @see org.apache.harmony.awt.wtk.NativeWindow#setAlwaysOnTop(boolean)
      */
     public void setAlwaysOnTop(final boolean value) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 int hwndInsertAfter = (value ? WindowsDefs.HWND_TOPMOST : WindowsDefs.HWND_NOTOPMOST);
                 int flags = WindowsDefs.SWP_NOMOVE | WindowsDefs.SWP_NOSIZE |
                         WindowsDefs.SWP_NOACTIVATE;
                 win32.SetWindowPos(hwnd, hwndInsertAfter, 0, 0, 0, 0, flags);
             }
         };
-        factory.nativeServer.invokeAndWait(callback);
+        factory.eventQueue.performTask(task);
     }
 
     public void setPacked(boolean packed) {
@@ -440,5 +440,12 @@
 
     public MultiRectArea getObscuredRegion(Rectangle part) {
         return WinManagement.getObscuredRegion(hwnd, part);
+    }
+
+    public void setIMStyle() {
+        // set small title bar:
+        factory.setWindowExStyle(getId(), WindowsDefs.WS_EX_PALETTEWINDOW);
+        // remove system menu & buttons:
+        modifyStyle(WindowsDefs.WS_SYSMENU, false);        
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWindowFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWindowFactory.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWindowFactory.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWindowFactory.java Wed Sep  6 09:06:15 2006
@@ -42,7 +42,6 @@
     private final HashMap hwnd2winMap = new HashMap();
     private CreationParams creationParams = null;
 
-    final NativeServer nativeServer;
     final WinEventQueue eventQueue;
 
     // for WinEvent
@@ -51,14 +50,13 @@
     final MouseGrab mouseGrab = new MouseGrab();
 
     WinWindowFactory(WinEventQueue eq) {
-        nativeServer = eq.getNativeServer();
         eventQueue = eq;
         eventQueue.addPreprocessor(mouseGrab);
     }
 
     public NativeWindow createWindow(final CreationParams p) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-            void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+            public void perform() {
                 String title = (p.name != null) ? p.name : "";
                 Rectangle rect = new Rectangle(p.x, p.y, p.w, p.h);
                 int style = getStyle(p);
@@ -86,8 +84,8 @@
                 returnValue = win;
             }
         };
-        nativeServer.invokeAndWait(callback);
-        return (WinWindow) callback.returnValue;
+        eventQueue.performTask(task);
+        return (WinWindow) task.returnValue;
     }
 
     public NativeWindow getWindowById(long id) {
@@ -361,12 +359,12 @@
      * @see org.apache.harmony.awt.wtk.WindowFactory#setCaretPosition(int, int)
      */
     public void setCaretPosition(final int x, final int y) {
-        NativeServer.Callback callback = new NativeServer.Callback () {
-           void body() {
+        WinEventQueue.Task task = new WinEventQueue.Task () {
+           public void perform() {
                 win32.SetCaretPos(x, y);
             }
         };
-        nativeServer.invokeAndWait(callback);
+        eventQueue.performTask(task);
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WindowProcHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WindowProcHandler.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WindowProcHandler.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WindowProcHandler.java Wed Sep  6 09:06:15 2006
@@ -23,7 +23,7 @@
 import org.apache.harmony.awt.nativebridge.windows.Callback;
 import org.apache.harmony.awt.nativebridge.windows.Win32;
 import org.apache.harmony.awt.nativebridge.windows.WindowsDefs;
-import org.apache.harmony.awt.wtk.NativeEventListener;
+import org.apache.harmony.awt.wtk.NativeEventThread;
 
 
 
@@ -52,11 +52,11 @@
 
     private WindowProcHandler() {
         windowProcPtr = Callback.registerCallback(this);
-        registerWindowClass();
+        registerWindowClass(windowClassName, windowProcPtr);
     }
 
     public long windowProc(long hwnd, int msg, long wParam, long lParam) {
-        NativeEventListener thread = (NativeEventListener)Thread.currentThread();
+        NativeEventThread thread = (NativeEventThread)Thread.currentThread();
         WinWTK wtk = (WinWTK)thread.getWTK();
         if (wtk == null || wtk.getWinEventQueue() == null) {
             return win32.DefWindowProcW(hwnd, msg, wParam, lParam);
@@ -64,17 +64,17 @@
         return wtk.getWinEventQueue().windowProc(hwnd, msg, wParam, lParam);
     }
 
-    private void registerWindowClass() {
+    public static void registerWindowClass(String className, long windowProc) {
 
         Int16Pointer namePtr = WinEventQueue.bridge.createInt16Pointer(
-                windowClassName, false);
+                className, false);
 
         Win32.WNDCLASSEXW wndCls = win32.createWNDCLASSEXW(false);
 
         wndCls.set_cbSize(wndCls.size());
         wndCls.set_style(WindowsDefs.CS_OWNDC);
-        wndCls.set_lpfnWndProc(windowProcPtr);
-        wndCls.set_hCursor(win32.LoadCursorW(0, WindowsDefs.IDC_CROSS));
+        wndCls.set_lpfnWndProc(windowProc);
+        wndCls.set_hCursor(0);
         wndCls.set_lpszClassName(namePtr);
 
         short classAtom = win32.RegisterClassExW(wndCls);
@@ -83,7 +83,7 @@
 
         if (classAtom == 0) {
             throw new InternalError("Failed to register window class "
-                    + windowClassName + " GetLastError returned " + winError);
+                    + className + " GetLastError returned " + winError);
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp Wed Sep  6 09:06:15 2006
@@ -25,6 +25,7 @@
 
 #include "SurfaceDataStructure.h"
 #include "org_apache_harmony_awt_gl_ImageSurface.h"
+#include "LUTTables.h"
 
 #ifdef _WIN32
 
@@ -54,210 +55,910 @@
 }
 
 
-JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_createStructDCM
-  (JNIEnv * env, jobject obj, jint surfDataType, jint dataType, jint csType, 
-  jint redMask, jint greenMask, jint blueMask, jint alphaMask, jint pixelStride, 
-  jint scanlineStride, jint width, jint height, jint transparancy, jboolean isAlphaPre){
+int getShift(unsigned int mask){
+    int shift = 0;
+    if (mask != 0) {
+        while ((mask & 1) == 0) {
+            mask >>= 1;
+            shift++;
+        }
+    }
+    return shift;
+}
 
-      SURFACE_STRUCTURE *surf = (SURFACE_STRUCTURE *)calloc(sizeof(SURFACE_STRUCTURE), 1);
-      if(surf != NULL){
-          surf->ss_type = surfDataType;
-          surf->cm_type = DIRECT_CM;
-          surf->cs_type = csType;
-          surf->data_type = dataType;
-          surf->red_mask = redMask;
-          surf->green_mask = greenMask;
-          surf->blue_mask = blueMask;
-          surf->alpha_mask = alphaMask;
-          surf->scanline_stride = scanlineStride;
-          switch(surf->ss_type){
-              case INT_RGB:
-              case INT_ARGB:
-              case INT_ARGB_PRE:
-              case INT_BGR:
-                  surf->scanline_stride_byte = scanlineStride << 2;
-                  break;
-              case USHORT_555:
-              case USHORT_565:
-                  surf->scanline_stride_byte = scanlineStride << 1;
-                  break;
-              //default:
-                  // TODO
-          }
-          surf->pixel_stride = pixelStride;
-          surf->width = width;
-          surf->height = height;
-          surf->transparency = transparancy;
-          surf->alpha_pre = isAlphaPre;
-          surf->num_components = (alphaMask == 0 ? 3 : 4);
-
-          surf->bits = (int *)malloc(surf->num_components * sizeof(int));
-          surf->bits[0] = parseMask(redMask, &surf->red_sht, &surf->max_red);
-          surf->bits[1] = parseMask(greenMask, &surf->green_sht, &surf->max_green);
-          surf->bits[2] = parseMask(blueMask, &surf->blue_sht, &surf->max_blue);
-          if(alphaMask != 0){
-            surf->bits[3] = parseMask(alphaMask, &(surf->alpha_sht), &(surf->max_alpha));
-            surf->has_alpha = 1;
-          }
+inline void updateCache
+(SURFACE_STRUCTURE *srcSurf, JNIEnv *env, jobject srcData, bool alphaPre){
 
-#ifdef _WIN32
-          GLBITMAPINFO glbmpInfo;
-          memset(&glbmpInfo, 0, sizeof(GLBITMAPINFO));
-          UINT stride;
-          glbmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-          glbmpInfo.bmiHeader.biWidth = surf->width;
-          glbmpInfo.bmiHeader.biHeight = -surf->height;
-          glbmpInfo.bmiHeader.biPlanes = 1;
-          glbmpInfo.bmiHeader.biBitCount = 32;
-          stride = surf->width << 2;
-          glbmpInfo.bmiHeader.biSizeImage = stride * surf->height;
-          glbmpInfo.bmiHeader.biCompression = BI_BITFIELDS;
-          DWORD *colors = (DWORD *)glbmpInfo.bmiColors;
-          colors[0] = 0xff0000;
-          colors[1] = 0xff00;
-          colors[2] = 0xff;
-          surf->srcDC = CreateCompatibleDC(NULL);
-          surf->bitmap = CreateDIBSection(NULL, (BITMAPINFO *)&glbmpInfo, DIB_RGB_COLORS, &surf->bmpData, NULL, 0);
-          if(surf->srcDC != NULL && surf->bitmap != NULL){
-              SelectObject(surf->srcDC, surf->bitmap);
-          }
-          surf->invalidated = true;
-          surf->isAlphaPre = true;
-#endif
-      }
-      return (jlong)surf;
-  }
+       unsigned int srcstride, dststride, offset;
+       unsigned int h = srcSurf->height;
+       unsigned int w = srcSurf->width;
+
+    void *bmpDataPtr = srcSurf->bmpData;
+    void *srcDataPtr = env->GetPrimitiveArrayCritical((jarray)srcData, 0);
+
+    switch(srcSurf->ss_type){
+
+        case INT_RGB:
+                       {
+                               //if(!srcSurf->invalidated) return false;
+
+                               srcstride = srcSurf->scanline_stride;
+                               dststride = w;
+                               /*
+                               if(srcstride == dststride){
+                                       memcpy(bmpDataPtr, srcDataPtr, (w << 2) * h);
+                               }else{
+                */
+                                       unsigned int *src, *s, *dst, *d;
+
+                                       offset = w - 1;
+                                       src = (unsigned int *)srcDataPtr + offset;
+                                       dst = (unsigned int *)bmpDataPtr + offset;
+
+                                       for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0 ; x--){
+                                                       *d-- = 0xff000000 | *s--;
+                                               }
+                                       }
+                               //}
+                       }
+            break;
+
+        case INT_ARGB:
+                       {
+                               //if(!srcSurf->invalidated && srcSurf->isAlphaPre && alphaPre) return false;
+                               //if(!srcSurf->invalidated && !srcSurf->isAlphaPre && !alphaPre) return false;
+
+                               unsigned char *src, *s, *dst, *d, sa;
+
+                               offset = (w << 2) - 1;
+                               src = (unsigned char *)srcDataPtr + offset;
+                               dst = (unsigned char *)bmpDataPtr + offset;
+
+                               srcstride = srcSurf->scanline_stride_byte;
+                               dststride = w << 2;
+
+                               if(alphaPre){
+                                       for(int y = h; y > 0 ; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0 ; x--){
+                                                       sa = *s--;
+                                                       *d-- = sa;
+                                                       if(sa != 255){
+                                                               *d-- = MUL(sa, *s--);
+                                                               *d-- = MUL(sa, *s--);
+                                                               *d-- = MUL(sa, *s--);
+                                                               srcSurf->hasRealAlpha = true;
+                                                       }else{
+                                                               *d-- = *s--;
+                                                               *d-- = *s--;
+                                                               *d-- = *s--;
+                                                       }
+                                               }
+                                       }
+                                       srcSurf->isAlphaPre = true;
+                               }else{
+                                       for(int y = h; y > 0 ; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0 ; x--){
+                                                       sa = *s--;
+                                                       if(sa == 0){
+                                                               *d-- = 0;
+                                                               *d-- = 0;
+                                                               *d-- = 0;
+                                                               *d-- = 0;
+                                                               s -= 3;
+                                                       }else{
+                                                               *d-- = sa;
+                                                               *d-- = MUL(sa, *s--);
+                                                               *d-- = MUL(sa, *s--);
+                                                               *d-- = MUL(sa, *s--);
+                                                       }
+                                               }
+                                       }
+                                       srcSurf->isAlphaPre = false;
+                               }
+                       }
+            break;
+
+        case INT_ARGB_PRE:
+                       {
+                               //if(!srcSurf->invalidated && srcSurf->isAlphaPre && alphaPre) return false;
+                               //if(!srcSurf->invalidated && !srcSurf->isAlphaPre && !alphaPre) return false;
+
+                               unsigned char *src, *s, *dst, *d, sa;
+
+                               offset = (w << 2) - 1;
+                               src = (unsigned char *)srcDataPtr + offset;
+                               dst = (unsigned char *)bmpDataPtr + offset;
+
+                               srcstride = srcSurf->scanline_stride_byte;
+                               dststride = w << 2;
+
+                               if(alphaPre){
+                                       for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0 ; x--){
+                                                       sa = *s--;
+                                                       *d-- = sa;
+                                                       *d-- = *s--;
+                                                       *d-- = *s--;
+                                                       *d-- = *s--;
+                                                       if(sa != 255){
+                                                               srcSurf->hasRealAlpha = true;
+                                                       }
+                                               }
+                                       }
+                                       srcSurf->isAlphaPre = true;
+                               }else{
+                                       for(int y = h; y > 0 ; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0 ; x--){
+                                                       sa = *s--;
+                                                       *d-- = sa;
+                                                       *d-- = DIV(sa, *s--);
+                                                       *d-- = DIV(sa, *s--);
+                                                       *d-- = DIV(sa, *s--);
+                                               }
+                                       }
+                                       srcSurf->isAlphaPre = false;
+                               }
+                       }
+            break;
+
+        case INT_BGR:
+                       {
+                               //if(!srcSurf->invalidated) return false;
+
+                               unsigned char *src, *s, *dst, *d;
+
+                               offset = (w << 2) - 1;
+                               src = (unsigned char *)srcDataPtr + offset;
+                               dst = (unsigned char *)bmpDataPtr + offset;
+
+                               srcstride = srcSurf->scanline_stride_byte;
+                               dststride = w << 2;
+
+                               for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                       s = src;
+                                       d = dst;
+
+                                       for(int x = w; x > 0 ; x--){
+                                               *d = 255;
+                                               *s--;
+                                               *(d - 3) = *s--;
+                                               *(d - 2) = *s--;
+                                               *(d - 1) = *s--;
+                                               d -= 4;
+                                       }
+                               }
+                       }
+            break;
+
+        case BYTE_BGR:
+                       {
+                               //if(!srcSurf->invalidated) return false;
+
+                               unsigned char *src, *s, *dst, *d;
+
+                               offset = (w << 2) - 1;
+                               unsigned int srcOffset = w * 3 - 1;
+                               src = (unsigned char *)srcDataPtr + srcOffset;
+                               dst = (unsigned char *)bmpDataPtr + offset;
+
+                               srcstride = srcSurf->scanline_stride_byte;
+                               dststride = w << 2;
+
+                               for(int y = srcSurf->height; y > 0; y--, src += srcstride, dst += dststride){
+                                       s = src;
+                                       d = dst;
+
+                                       for(int x = w; x > 0 ; x--){
+                                               *d-- = 255;
+                                               *d-- = *s--;
+                                               *d-- = *s--;
+                                               *d-- = *s--;
+                                       }
+                               }
+                       }
+            break;
+
+        case BYTE_ABGR:
+                       {
+                               //if(!srcSurf->invalidated && srcSurf->isAlphaPre && alphaPre) return false;
+                               //if(!srcSurf->invalidated && !srcSurf->isAlphaPre && !alphaPre) return false;
+
+                               unsigned char *src, *s, *dst, *d, a, r, g, b;
+
+                               offset = (w << 2) - 1;
+                               src = (unsigned char *)srcDataPtr + offset;
+                               dst = (unsigned char *)bmpDataPtr + offset;
+
+                               srcstride = srcSurf->scanline_stride_byte;
+                               dststride = w << 2;
+
+                               if(alphaPre){
+                                       for(int y = h; y > 0 ; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0 ; x--){
+                                                       r = *s--;
+                                                       g = *s--;
+                                                       b = *s--;
+                                                       a = *s--;
+                                                       *d-- = a;
+                                                       if(a != 255){
+                                                               *d-- = MUL(a, r);
+                                                               *d-- = MUL(a, g);
+                                                               *d-- = MUL(a, b);
+                                                               srcSurf->hasRealAlpha = true;
+                                                       }else{
+                                                               *d-- = r;
+                                                               *d-- = g;
+                                                               *d-- = b;
+                                                       }
+                                               }
+                                       }
+                                       srcSurf->isAlphaPre = true;
+                               }else{
+                                       for(int y = h; y > 0 ; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0 ; x--){
+                                                       r = *s--;
+                                                       g = *s--;
+                                                       b = *s--;
+                                                       a = *s--;
+                                                       if(a == 0){
+                                                               *d-- = 0;
+                                                               *d-- = 0;
+                                                               *d-- = 0;
+                                                               *d-- = 0;
+                                                       }else{
+                                                               *d-- = a;
+                                                               *d-- = r;
+                                                               *d-- = g;
+                                                               *d-- = b;
+                                                       }
+                                               }
+                                       }
+                                       srcSurf->isAlphaPre = false;
+                               }
+                       }
+            break;
+
+        case BYTE_ABGR_PRE:
+                       {
+                               //if(!srcSurf->invalidated && srcSurf->isAlphaPre && alphaPre) return false;
+                               //if(!srcSurf->invalidated && !srcSurf->isAlphaPre && !alphaPre) return false;
+
+                               unsigned char *src, *s, *dst, *d, a, r, g, b;
+
+                               offset = (w << 2) - 1;
+                               src = (unsigned char *)srcDataPtr + offset;
+                               dst = (unsigned char *)bmpDataPtr + offset;
+
+                               srcstride = srcSurf->scanline_stride_byte;
+                               dststride = w << 2;
+
+                               if(alphaPre){
+                                       for(int y = h; y > 0 ; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0 ; x--){
+                                                       r = *s--;
+                                                       g = *s--;
+                                                       b = *s--;
+                                                       a = *s--;
+                                                       if(a != 255){
+                                                               srcSurf->hasRealAlpha = true;
+                                                       }
+                                                       *d-- = a;
+                                                       *d-- = r;
+                                                       *d-- = g;
+                                                       *d-- = b;
+                                               }
+                                       }
+                                       srcSurf->isAlphaPre = true;
+                               }else{
+                                       for(int y = h; y > 0 ; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0 ; x--){
+                                                       r = *s--;
+                                                       g = *s--;
+                                                       b = *s--;
+                                                       a = *s--;
+                                                       *d-- = a;
+                                                       if(a != 255){
+                                                               *d-- = DIV(a, r);
+                                                               *d-- = DIV(a, g);
+                                                               *d-- = DIV(a, b);
+                                                       }else{
+                                                               *d-- = r;
+                                                               *d-- = g;
+                                                               *d-- = b;
+                                                       }
+                                               }
+                                       }
+                                       srcSurf->isAlphaPre = false;
+                               }
+                       }
+            break;
+
+        case USHORT_555:
+        case USHORT_565:
+                       {
+                               //if(!srcSurf->invalidated) return false;
+
+                               unsigned char *dst, *d;
+                               unsigned short *src, *s, pixel;
+
+                               offset = (w << 2) - 1;
+                               unsigned int srcOffset = w - 1;
+                               src = (unsigned short *)srcDataPtr + srcOffset;
+                               dst = (unsigned char *)bmpDataPtr + offset;
+
+                               srcstride = srcSurf->scanline_stride;
+                               dststride = w << 2;
+
+                               unsigned int mr = srcSurf->max_red;
+                               unsigned int mg = srcSurf->max_green;
+                               unsigned int mb = srcSurf->max_red;
+                               unsigned int rm = srcSurf->red_mask;
+                               unsigned int gm = srcSurf->green_mask;
+                               unsigned int bm = srcSurf->blue_mask;
+                               unsigned int rs = srcSurf->red_sht;
+                               unsigned int gs = srcSurf->green_sht;
+                               unsigned int bs = srcSurf->blue_sht;
+
+                               for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                       d = dst;
+                                       s = src;
+                                       for(int x = w; x > 0; x--){
+                                               pixel = *s--;
+                                               *d-- = 255;
+                                               *d-- = DIV(mb, ((pixel & rm) >> rs));
+                                               *d-- = DIV(mg, ((pixel & gm) >> gs));
+                                               *d-- = DIV(mr, ((pixel & bm) >> bs));
+                                       }
+                               }
+                       }
+            break;
+
+        case USHORT_GRAY:
+                       {
+                               //if(!srcSurf->invalidated) return false;
+
+                               unsigned char *dst, *d, pixel;
+                               unsigned short *src, *s;
+                               src = (unsigned short *)srcDataPtr;
+                               dst = (unsigned char *)bmpDataPtr;
+
+                               srcstride = srcSurf->scanline_stride;
+                               dststride = w << 2;
+
+                               for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                       s = src;
+                                       d = dst;
+                                       for(int x = w; x > 0; x--){
+                                               pixel = (unsigned char)(*s++ / 257);
+                                               *d++ = pixel;
+                                               *d++ = pixel;
+                                               *d++ = pixel;
+                                               *d++ = 255;
+                                       }
+                               }
+                       }
+            break;
+
+        case BYTE_BINARY:
+                       {
+                               //if(!srcSurf->invalidated) return false;
+
+                               unsigned char *src, *s;
+                               unsigned int *dst, *d, pixel, bitnum, elem, shift, bitMask;
+                               src = (unsigned char *)srcDataPtr;
+                               dst = (unsigned int *)bmpDataPtr;
+
+                               srcstride = srcSurf->scanline_stride;
+                               dststride = w;
+                               unsigned int pixelBits = srcSurf->pixel_stride;
+                               int *cm = srcSurf->colormap;
+
+                               for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                       d = dst;
+
+                                       for(int x = 0; x < w; x++){
+                                               bitnum = x * pixelBits;
+                                               s = src + bitnum / 8;
+                                               elem = *s;
+                                               shift = 8 - (bitnum & 7) - pixelBits;
+                                               bitMask = (1 << pixelBits) - 1;
+                                               pixel = (elem >> shift) & bitMask;
+                                               *d++ = 0xff000000 | *(cm + pixel);
+                                       }
+                               }
+                       }
+            break;
+
+        case BYTE_INDEXED:
+                       {
+                               int transparency = srcSurf->transparency;
+
+                               //if(!srcSurf->invalidated && transparency != GL_TRANSLUCENT) return false;
+                               //if(!srcSurf->invalidated && transparency == GL_TRANSLUCENT &&
+                               //      srcSurf->isAlphaPre && alphaPre) return false;
+                               //if(!srcSurf->invalidated && transparency == GL_TRANSLUCENT &&
+                               //      !srcSurf->isAlphaPre && !alphaPre) return false;
+
+                               unsigned char *src, *s;
+                               unsigned int *dst, *d, pixel, r, g, b, a;
+
+                               unsigned int offset = w - 1;
+                               src = (unsigned char *)srcDataPtr + offset;
+                               dst = (unsigned int *)bmpDataPtr + offset;
+
+                               srcstride = srcSurf->scanline_stride;
+                               dststride = w;
+                               int *cm = srcSurf->colormap;
+                               int tp = srcSurf->transparent_pixel;
+                               if(transparency == GL_OPAQUE){
+                                       for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0; x--){
+                                                       *d-- = 0xff000000 | *(cm + *s--);
+                                               }
+                                       }
+                               }else if(transparency == GL_BITMASK){
+                                       for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0; x--){
+                                                       pixel = *s--;
+                                                       if(pixel != tp){
+                                                               *d-- = 0xff000000 | *(cm + pixel);
+                                                       }else{
+                                                               srcSurf->hasRealAlpha = true;
+                                                               *d-- = 0;
+                                                       }
+                                               }
+                                       }
+                               }else{
+                                       for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                               s = src;
+                                               d = dst;
+
+                                               for(int x = w; x > 0; x--){
+                                                       pixel = *(cm + *s--);
+                                                       a = (pixel >> 24) & 0xff;
+                                                       if(alphaPre){
+                                                               if(a == 255){
+                                                                       *d-- = pixel;
+                                                               }else{
+                                                                       r = (pixel >> 16) & 0xff;
+                                                                       g = (pixel >> 8) & 0xff;
+                                                                       b = pixel & 0xff;
+                                                                       r = MUL(a, r);
+                                                                       g = MUL(a, g);
+                                                                       b = MUL(a, b);
+                                                                       *d-- = (a << 24) | (r << 16) | (g << 8) | b;
+                                                                       srcSurf->hasRealAlpha = true;
+                                                               }
+                                                               srcSurf->isAlphaPre = true;
+                                                       }else{
+                                                               if(a == 0) *d-- = 0;
+                                                               else *d-- = pixel;
+                                                               srcSurf->isAlphaPre = false;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+            break;
+
+        case BYTE_GRAY:
+                       {
+                               //if(!srcSurf->invalidated) return false;
+                               unsigned char *src, *s, *dst, *d, pixel;
+                               src = (unsigned char *)srcDataPtr;
+                               dst = (unsigned char *)bmpDataPtr;
+
+                               srcstride = srcSurf->scanline_stride;
+                               dststride = w << 2;
+
+                               for(int y = h; y > 0; y--, src += srcstride, dst += dststride){
+                                       s = src;
+                                       d = dst;
+
+                                       for(int x = srcSurf->width; x > 0; x--){
+                                               pixel = *s++;
+                                               *d++ = pixel;
+                                               *d++ = pixel;
+                                               *d++ = pixel;
+                                               *d++ = 255;
+                                       }
+                               }
+                       }
+            break;
+    }
+    env->ReleasePrimitiveArrayCritical((jarray)srcData, srcDataPtr, 0);
+}
 
-JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_createStructICM
-  (JNIEnv *env, jobject obj, jint surfDataType, jint dataType, jint pixelStride, 
-  jint scanlineStride, jint width, jint height, jint mapSize, jintArray colorMap, 
-  jboolean isGrayPallete, jint transparency, jint trans, jint smType){
+/*
+ * Class:     org_apache_harmony_awt_gl_ImageSurface
+ * Method:    createSurfStruct
+ * Signature: (IIIIIIIIII[I[II[IIZ[I[IIZZI)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_createSurfStruct
+  (JNIEnv * env, jobject obj, jint surfType, jint width, jint height, jint cmType, 
+  jint csType, jint smType, jint dataType, jint numComponents, jint pixelStride, 
+  jint scanlineStride, jintArray bits, jintArray masks, jint colorMapSize, 
+  jintArray colorMap, jint transpPixel, jboolean isGrayPalette, jintArray bankIndeces, 
+  jintArray bandOffsets, jint offset, jboolean hasAlpha, jboolean isAlphaPre, 
+  jint transparency){
 
       SURFACE_STRUCTURE *surf = (SURFACE_STRUCTURE *)calloc(sizeof(SURFACE_STRUCTURE), 1);
       if(surf != NULL){
-          surf->ss_type = surfDataType;
-          surf->cm_type = INDEX_CM;
-          surf->cs_type = sRGB_CS;
-          surf->pixel_stride = pixelStride;
-          surf->scanline_stride = scanlineStride;
-          surf->scanline_stride_byte = scanlineStride;
+          surf->ss_type = surfType;
           surf->width = width;
           surf->height = height;
-          surf->colormap_size = mapSize;
-          surf->transparency = transparency;
-          surf->transparent_pixel = trans;
-          surf->sm_type = smType;
-          surf->has_alpha = (transparency == GL_OPAQUE ? 0 : 1);
-          surf->isGrayPallete = isGrayPallete;
-          surf->colormap = (int *)malloc(mapSize * sizeof(int));
-          void *p = env->GetPrimitiveArrayCritical(colorMap, 0);
-          memcpy((void *)surf->colormap, p, mapSize << 2);
-          env->ReleasePrimitiveArrayCritical(colorMap, p, 0);
+          surf->cm_type = cmType;
+          surf->cs_type = csType;
+          surf->data_type = dataType;
+          surf->num_components = numComponents;
+          surf->pixel_stride = pixelStride;
+          surf->scanline_stride = scanlineStride;
+                 surf->offset = offset;
+                 surf->has_alpha = hasAlpha;
+                 surf->isAlphaPre = isAlphaPre;
+                 surf->transparency = transparency;
+                 if(dataType == TYPE_BYTE){
+                         surf->scanline_stride_byte = scanlineStride;
+                 }else if(dataType == TYPE_USHORT){
+                         surf->scanline_stride_byte = scanlineStride << 1;
+                 }else if(dataType == TYPE_INT){
+                         surf->scanline_stride_byte = scanlineStride << 2;
+                 }
+
+                 void *p;
+                 int *s, *d;
+                 switch(cmType){
+                         case DIRECT_CM:
+                                 surf->bits = (int *)malloc(surf->num_components * sizeof(int));
+                                 p = env->GetPrimitiveArrayCritical(bits, 0);
+                                 d = surf->bits;
+                                 s = (int *)p;
+                                 for(int i = 0; i < numComponents; i++){
+                                         *d++ = *s++;
+                                 }
+                                 env->ReleasePrimitiveArrayCritical(bits, p, 0);
+                                 p = env->GetPrimitiveArrayCritical(masks, 0);
+                                 s = (int *)p;
+                                 
+                                 surf->red_mask = *s++;
+                                 surf->green_mask = *s++;
+                                 surf->blue_mask = *s++;
+                                 if(hasAlpha){
+                                         surf->alpha_mask = *s;
+                                 }
+                                 env->ReleasePrimitiveArrayCritical(masks, p, 0);
+
+                                 surf->red_sht = getShift(surf->red_mask);
+                                 surf->max_red = (1 << surf->bits[0]) - 1;
+                                 surf->green_sht = getShift(surf->green_mask);
+                                 surf->max_green = (1 << surf->bits[1]) - 1;
+                                 surf->blue_sht = getShift(surf->blue_mask);
+                                 surf->max_blue = (1 << surf->bits[2]) - 1;
+                                 if(hasAlpha){
+                                         surf->alpha_sht = getShift(surf->alpha_mask);
+                                         surf->max_alpha = ( 1 << surf->bits[3]) - 1;
+                                 }
+                                 break;
+
+                         case INDEX_CM:
+                                 surf->colormap_size = colorMapSize;
+                                 surf->transparent_pixel = transpPixel;
+                                 surf->isGrayPallete = isGrayPalette;
+                                 surf->colormap = (int *)malloc(colorMapSize * sizeof(int));
+                                 p = env->GetPrimitiveArrayCritical(colorMap, 0);
+                                 memcpy(surf->colormap, p, colorMapSize * sizeof(int));
+                                 env->ReleasePrimitiveArrayCritical(colorMap, p, 0);
+                                 break;
+
+                         case COMPONENT_CM:
+                                 surf->bank_indexes = (int *)malloc(numComponents * sizeof(int));
+                                 surf->band_offsets = (int *)malloc(numComponents * sizeof(int));
+
+                                 p = env->GetPrimitiveArrayCritical(bankIndeces, 0);
+                                 memcpy((void *)surf->bank_indexes, p, numComponents * sizeof(int));
+                                 env->ReleasePrimitiveArrayCritical(bankIndeces, p, 0);
+
+                                 p = env->GetPrimitiveArrayCritical(bandOffsets, 0);
+                                 memcpy((void *)surf->band_offsets, p, numComponents * sizeof(int));
+                                 env->ReleasePrimitiveArrayCritical(bandOffsets, p, 0);
+                                 break;
+                 }
+                 surf->bmp_byte_stride = surf->width << 2;
+                 surf->bmpData = malloc(surf->bmp_byte_stride  * surf->height);
+          surf->invalidated = true;
+
 #ifdef _WIN32
-          GLBITMAPINFO glbmpInfo;
-          memset(&glbmpInfo, 0, sizeof(GLBITMAPINFO));
-          UINT stride;
-          glbmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-          glbmpInfo.bmiHeader.biWidth = surf->width;
-          glbmpInfo.bmiHeader.biHeight = -surf->height;
-          glbmpInfo.bmiHeader.biPlanes = 1;
-          glbmpInfo.bmiHeader.biBitCount = 32;
-          stride = surf->width << 2;
-          glbmpInfo.bmiHeader.biSizeImage = stride * surf->height;
-          glbmpInfo.bmiHeader.biCompression = BI_BITFIELDS;
-          DWORD *colors = (DWORD *)glbmpInfo.bmiColors;
+                 surf->bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+          surf->bmpInfo.bmiHeader.biWidth = surf->width;
+          surf->bmpInfo.bmiHeader.biHeight = -surf->height;
+          surf->bmpInfo.bmiHeader.biPlanes = 1;
+          surf->bmpInfo.bmiHeader.biBitCount = 32;
+          surf->bmpInfo.bmiHeader.biSizeImage = surf->bmp_byte_stride * surf->height;
+          surf->bmpInfo.bmiHeader.biCompression = BI_BITFIELDS;
+          DWORD *colors = (DWORD *)surf->bmpInfo.bmiColors;
           colors[0] = 0xff0000;
           colors[1] = 0xff00;
           colors[2] = 0xff;
 
-          surf->srcDC = CreateCompatibleDC(NULL);
-          surf->bitmap = CreateDIBSection(NULL, (BITMAPINFO *)&glbmpInfo, DIB_RGB_COLORS, &surf->bmpData, NULL, 0);
+          HDC dc = GetDC(NULL);
+          surf->srcDC = CreateCompatibleDC(dc);
+                 surf->bitmap = CreateCompatibleBitmap(dc, surf->width, surf->height);
+                 ReleaseDC(NULL, dc);
           if(surf->srcDC != NULL && surf->bitmap != NULL){
               SelectObject(surf->srcDC, surf->bitmap);
           }
-          surf->invalidated = true;
           surf->isAlphaPre = true;
+                 //surf->bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    //      surf->bmpInfo.bmiHeader.biWidth = surf->width;
+    //      surf->bmpInfo.bmiHeader.biHeight = -surf->height;
+    //      surf->bmpInfo.bmiHeader.biPlanes = 1;
+    //      surf->bmpInfo.bmiHeader.biBitCount = 16;
+                 //surf->bmp_byte_stride = surf->width << 1;
+    //      surf->bmpInfo.bmiHeader.biCompression = BI_BITFIELDS;
+    //      DWORD *colors = (DWORD *)surf->bmpInfo.bmiColors;
+                 //colors[0] = redMask;
+                 //colors[1] = greenMask;
+    //      colors[2] = blueMask;
+    //      surf->bitmap = CreateDIBSection(NULL, (BITMAPINFO *)&surf->bmpInfo, DIB_RGB_COLORS, &surf->bmpData, NULL, 0);
+
+    //      surf->invalidated = true;
+    //      surf->isAlphaPre = true;
 #endif
       }
-
       return (jlong)surf;
+  
   }
 
-JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_createStructCCM
-  (JNIEnv *env, jobject obj, jint surfDataType, jint dataType, jint csType, 
-  jint numComponents, jint pixelStride, jint scanlineStride, jint width, jint height, jintArray bits,
-  jintArray bankIndeces, jintArray bandOffsets, jint transparency, jboolean isAlphaPre){
+//JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_createStructDCM
+//  (JNIEnv * env, jobject obj, jint surfDataType, jint dataType, jint csType, 
+//  jint redMask, jint greenMask, jint blueMask, jint alphaMask, jint pixelStride, 
+//  jint scanlineStride, jint width, jint height, jint transparancy, jboolean isAlphaPre){
+//
+//      SURFACE_STRUCTURE *surf = (SURFACE_STRUCTURE *)calloc(sizeof(SURFACE_STRUCTURE), 1);
+//      if(surf != NULL){
+//          surf->ss_type = surfDataType;
+//          surf->cm_type = DIRECT_CM;
+//          surf->cs_type = csType;
+//          surf->data_type = dataType;
+//          surf->red_mask = redMask;
+//          surf->green_mask = greenMask;
+//          surf->blue_mask = blueMask;
+//          surf->alpha_mask = alphaMask;
+//          surf->scanline_stride = scanlineStride;
+//          switch(surf->ss_type){
+//              case INT_RGB:
+//              case INT_ARGB:
+//              case INT_ARGB_PRE:
+//              case INT_BGR:
+//                  surf->scanline_stride_byte = scanlineStride << 2;
+//                  break;
+//              case USHORT_555:
+//              case USHORT_565:
+//                  surf->scanline_stride_byte = scanlineStride << 1;
+//                  break;
+//              //default:
+//                  // TODO
+//          }
+//          surf->pixel_stride = pixelStride;
+//          surf->width = width;
+//          surf->height = height;
+//          surf->transparency = transparancy;
+//          surf->alpha_pre = isAlphaPre;
+//          surf->num_components = (alphaMask == 0 ? 3 : 4);
+//
+//          surf->bits = (int *)malloc(surf->num_components * sizeof(int));
+//          surf->bits[0] = parseMask(redMask, &surf->red_sht, &surf->max_red);
+//          surf->bits[1] = parseMask(greenMask, &surf->green_sht, &surf->max_green);
+//          surf->bits[2] = parseMask(blueMask, &surf->blue_sht, &surf->max_blue);
+//          if(alphaMask != 0){
+//            surf->bits[3] = parseMask(alphaMask, &(surf->alpha_sht), &(surf->max_alpha));
+//            surf->has_alpha = 1;
+//          }
+//
+//#ifdef _WIN32
+//          GLBITMAPINFO glbmpInfo;
+//          memset(&glbmpInfo, 0, sizeof(GLBITMAPINFO));
+//          UINT stride;
+//          glbmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+//          glbmpInfo.bmiHeader.biWidth = surf->width;
+//          glbmpInfo.bmiHeader.biHeight = -surf->height;
+//          glbmpInfo.bmiHeader.biPlanes = 1;
+//          glbmpInfo.bmiHeader.biBitCount = 32;
+//          stride = surf->width << 2;
+//          glbmpInfo.bmiHeader.biSizeImage = stride * surf->height;
+//          glbmpInfo.bmiHeader.biCompression = BI_BITFIELDS;
+//          DWORD *colors = (DWORD *)glbmpInfo.bmiColors;
+//          colors[0] = 0xff0000;
+//          colors[1] = 0xff00;
+//          colors[2] = 0xff;
+//          surf->srcDC = CreateCompatibleDC(NULL);
+//          surf->bitmap = CreateDIBSection(NULL, (BITMAPINFO *)&glbmpInfo, DIB_RGB_COLORS, &surf->bmpData, NULL, 0);
+//          if(surf->srcDC != NULL && surf->bitmap != NULL){
+//              SelectObject(surf->srcDC, surf->bitmap);
+//          }
+//          surf->invalidated = true;
+//          surf->isAlphaPre = true;
+//#endif
+//      }
+//      return (jlong)surf;
+//  }
+//
+//JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_createStructICM
+//  (JNIEnv *env, jobject obj, jint surfDataType, jint dataType, jint pixelStride, 
+//  jint scanlineStride, jint width, jint height, jint mapSize, jintArray colorMap, 
+//  jboolean isGrayPallete, jint transparency, jint trans, jint smType){
+//
+//      SURFACE_STRUCTURE *surf = (SURFACE_STRUCTURE *)calloc(sizeof(SURFACE_STRUCTURE), 1);
+//      if(surf != NULL){
+//          surf->ss_type = surfDataType;
+//          surf->cm_type = INDEX_CM;
+//          surf->cs_type = sRGB_CS;
+//          surf->pixel_stride = pixelStride;
+//          surf->scanline_stride = scanlineStride;
+//          surf->scanline_stride_byte = scanlineStride;
+//          surf->width = width;
+//          surf->height = height;
+//          surf->colormap_size = mapSize;
+//          surf->transparency = transparency;
+//          surf->transparent_pixel = trans;
+//          surf->sm_type = smType;
+//          surf->has_alpha = (transparency == GL_OPAQUE ? 0 : 1);
+//          surf->isGrayPallete = isGrayPallete;
+//          surf->colormap = (int *)malloc(mapSize * sizeof(int));
+//          void *p = env->GetPrimitiveArrayCritical(colorMap, 0);
+//          memcpy((void *)surf->colormap, p, mapSize << 2);
+//          env->ReleasePrimitiveArrayCritical(colorMap, p, 0);
+//#ifdef _WIN32
+//          GLBITMAPINFO glbmpInfo;
+//          memset(&glbmpInfo, 0, sizeof(GLBITMAPINFO));
+//          UINT stride;
+//          glbmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+//          glbmpInfo.bmiHeader.biWidth = surf->width;
+//          glbmpInfo.bmiHeader.biHeight = -surf->height;
+//          glbmpInfo.bmiHeader.biPlanes = 1;
+//          glbmpInfo.bmiHeader.biBitCount = 32;
+//          stride = surf->width << 2;
+//          glbmpInfo.bmiHeader.biSizeImage = stride * surf->height;
+//          glbmpInfo.bmiHeader.biCompression = BI_BITFIELDS;
+//          DWORD *colors = (DWORD *)glbmpInfo.bmiColors;
+//          colors[0] = 0xff0000;
+//          colors[1] = 0xff00;
+//          colors[2] = 0xff;
+//
+//          surf->srcDC = CreateCompatibleDC(NULL);
+//          surf->bitmap = CreateDIBSection(NULL, (BITMAPINFO *)&glbmpInfo, DIB_RGB_COLORS, &surf->bmpData, NULL, 0);
+//          if(surf->srcDC != NULL && surf->bitmap != NULL){
+//              SelectObject(surf->srcDC, surf->bitmap);
+//          }
+//          surf->invalidated = true;
+//          surf->isAlphaPre = true;
+//#endif
+//      }
+//
+//      return (jlong)surf;
+//  }
+//
+//JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_createStructCCM
+//  (JNIEnv *env, jobject obj, jint surfDataType, jint dataType, jint csType, 
+//  jint numComponents, jint pixelStride, jint scanlineStride, jint width, jint height, jintArray bits,
+//  jintArray bankIndeces, jintArray bandOffsets, jint transparency, jboolean isAlphaPre){
+//
+//      SURFACE_STRUCTURE *surf = (SURFACE_STRUCTURE *)calloc(sizeof(SURFACE_STRUCTURE), 1);
+//      if(surf != NULL){
+//          surf->ss_type = surfDataType;
+//          surf->cm_type = COMPONENT_CM;
+//          surf->cs_type = csType;
+//          surf->num_components = numComponents;
+//          surf->pixel_stride = pixelStride;
+//          surf->scanline_stride = scanlineStride;
+//          switch(surf->ss_type){
+//              case BYTE_BGR:
+//              case BYTE_ABGR:
+//              case BYTE_ABGR_PRE:
+//              case BYTE_GRAY:
+//                  surf->scanline_stride_byte = scanlineStride;
+//                  break;
+//              case USHORT_GRAY:
+//                  surf->scanline_stride_byte = scanlineStride << 1;
+//                  break;
+//              //default:
+//                  // TODO
+//          }
+//          surf->width = width;
+//          surf->height = height;
+//          surf->transparency = transparency;
+//          surf->has_alpha = (transparency == GL_OPAQUE ? 0 : 1);
+//          surf->alpha_pre = isAlphaPre;
+//
+//          surf->bits = (int *)malloc(numComponents * sizeof(int));
+//          surf->bank_indexes = (int *)malloc(numComponents * sizeof(int));
+//          surf->band_offsets = (int *)malloc(numComponents * sizeof(int));
+//
+//          void *p = env->GetPrimitiveArrayCritical(bits, 0);
+//          memcpy((void *)surf->bits, p, numComponents << 2);
+//          env->ReleasePrimitiveArrayCritical(bits, p, 0);
+//
+//          p = env->GetPrimitiveArrayCritical(bankIndeces, 0);
+//          memcpy((void *)surf->bank_indexes, p, numComponents << 2);
+//          env->ReleasePrimitiveArrayCritical(bankIndeces, p, 0);
+//
+//          p = env->GetPrimitiveArrayCritical(bandOffsets, 0);
+//          memcpy((void *)surf->band_offsets, p, numComponents << 2);
+//          env->ReleasePrimitiveArrayCritical(bandOffsets, p, 0);
+//      }
+//#ifdef _WIN32
+//          GLBITMAPINFO glbmpInfo;
+//          memset(&glbmpInfo, 0, sizeof(GLBITMAPINFO));
+//          UINT stride;
+//          glbmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+//          glbmpInfo.bmiHeader.biWidth = surf->width;
+//          glbmpInfo.bmiHeader.biHeight = -surf->height;
+//          glbmpInfo.bmiHeader.biPlanes = 1;
+//          glbmpInfo.bmiHeader.biBitCount = 32;
+//          stride = surf->width << 2;
+//          glbmpInfo.bmiHeader.biSizeImage = stride * surf->height;
+//          glbmpInfo.bmiHeader.biCompression = BI_BITFIELDS;
+//          DWORD *colors = (DWORD *)glbmpInfo.bmiColors;
+//          colors[0] = 0xff0000;
+//          colors[1] = 0xff00;
+//          colors[2] = 0xff;
+//          surf->srcDC = CreateCompatibleDC(NULL);
+//          surf->bitmap = CreateDIBSection(NULL, (BITMAPINFO *)&glbmpInfo, DIB_RGB_COLORS, &surf->bmpData, NULL, 0);
+//          if(surf->srcDC != NULL && surf->bitmap != NULL){
+//              SelectObject(surf->srcDC, surf->bitmap);
+//          }
+//          surf->invalidated = true;
+//          surf->isAlphaPre = true;
+//#endif
+//
+//      return (jlong)surf;
+//  }
 
-      SURFACE_STRUCTURE *surf = (SURFACE_STRUCTURE *)calloc(sizeof(SURFACE_STRUCTURE), 1);
-      if(surf != NULL){
-          surf->ss_type = surfDataType;
-          surf->cm_type = COMPONENT_CM;
-          surf->cs_type = csType;
-          surf->num_components = numComponents;
-          surf->pixel_stride = pixelStride;
-          surf->scanline_stride = scanlineStride;
-          switch(surf->ss_type){
-              case BYTE_BGR:
-              case BYTE_ABGR:
-              case BYTE_ABGR_PRE:
-              case BYTE_GRAY:
-                  surf->scanline_stride_byte = scanlineStride;
-                  break;
-              case USHORT_GRAY:
-                  surf->scanline_stride_byte = scanlineStride << 1;
-                  break;
-              //default:
-                  // TODO
-          }
-          surf->width = width;
-          surf->height = height;
-          surf->transparency = transparency;
-          surf->has_alpha = (transparency == GL_OPAQUE ? 0 : 1);
-          surf->alpha_pre = isAlphaPre;
-
-          surf->bits = (int *)malloc(numComponents * sizeof(int));
-          surf->bank_indexes = (int *)malloc(numComponents * sizeof(int));
-          surf->band_offsets = (int *)malloc(numComponents * sizeof(int));
-
-          void *p = env->GetPrimitiveArrayCritical(bits, 0);
-          memcpy((void *)surf->bits, p, numComponents << 2);
-          env->ReleasePrimitiveArrayCritical(bits, p, 0);
-
-          p = env->GetPrimitiveArrayCritical(bankIndeces, 0);
-          memcpy((void *)surf->bank_indexes, p, numComponents << 2);
-          env->ReleasePrimitiveArrayCritical(bankIndeces, p, 0);
-
-          p = env->GetPrimitiveArrayCritical(bandOffsets, 0);
-          memcpy((void *)surf->band_offsets, p, numComponents << 2);
-          env->ReleasePrimitiveArrayCritical(bandOffsets, p, 0);
-      }
-#ifdef _WIN32
-          GLBITMAPINFO glbmpInfo;
-          memset(&glbmpInfo, 0, sizeof(GLBITMAPINFO));
-          UINT stride;
-          glbmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-          glbmpInfo.bmiHeader.biWidth = surf->width;
-          glbmpInfo.bmiHeader.biHeight = -surf->height;
-          glbmpInfo.bmiHeader.biPlanes = 1;
-          glbmpInfo.bmiHeader.biBitCount = 32;
-          stride = surf->width << 2;
-          glbmpInfo.bmiHeader.biSizeImage = stride * surf->height;
-          glbmpInfo.bmiHeader.biCompression = BI_BITFIELDS;
-          DWORD *colors = (DWORD *)glbmpInfo.bmiColors;
-          colors[0] = 0xff0000;
-          colors[1] = 0xff00;
-          colors[2] = 0xff;
-          surf->srcDC = CreateCompatibleDC(NULL);
-          surf->bitmap = CreateDIBSection(NULL, (BITMAPINFO *)&glbmpInfo, DIB_RGB_COLORS, &surf->bmpData, NULL, 0);
-          if(surf->srcDC != NULL && surf->bitmap != NULL){
-              SelectObject(surf->srcDC, surf->bitmap);
-          }
-          surf->invalidated = true;
-          surf->isAlphaPre = true;
-#endif
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_updateCache
+(JNIEnv *env, jobject obj, jlong ptr, jobject data, jboolean alphaPre){
 
-      return (jlong)surf;
-  }
+    SURFACE_STRUCTURE *surf = (SURFACE_STRUCTURE *)ptr;
+       jlong cachePtr = 0;
+       if(surf != NULL){
+               updateCache(surf, env, data, (bool)alphaPre);
+               cachePtr = (jlong)surf->bmpData;
+       }
+       return cachePtr;
+}
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_dispose
   (JNIEnv *env, jobject obj, jlong ptr){
@@ -269,8 +970,8 @@
         if(surf->colormap) free(surf->colormap);
         if(surf->bank_indexes) free(surf->bank_indexes);
         if(surf->band_offsets) free(surf->band_offsets);
+               if(surf->bmpData) free(surf->bmpData);
 #ifdef _WIN32
-        //if(surf->bitmap != NULL) delete surf->bitmap;
         if(surf->bitmap) DeleteObject(surf->bitmap);
         if(surf->srcDC) DeleteDC(surf->srcDC);
 #endif

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.h?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.h Wed Sep  6 09:06:15 2006
@@ -23,6 +23,7 @@
 #define __SURFACE_STRUCTURE__
 
 #include <stdio.h>
+#include <jni.h>
 
 #ifdef _WIN32
 
@@ -108,7 +109,7 @@
 
     int *bits;           // An array of the number of bits per color/alpha component
 
-    long dataPtr;        // Pointer to the Volotile Image Surface Data
+    int offset;          // Offset in the data elements from the beginig of data array
 
     // Direct Color Model
     int red_mask;
@@ -136,6 +137,13 @@
     int *bank_indexes;
     int *band_offsets;
 
+       // Cached Data
+       long bmp_byte_stride;
+    void *bmpData;
+       bool hasRealAlpha;
+    bool invalidated;
+    bool isAlphaPre;
+
 #ifdef _WIN32
     // VolataileImage
     GraphicsInfo *gi;
@@ -143,9 +151,6 @@
 
     HBITMAP bitmap;
     HDC srcDC;
-    void *bmpData;
-    bool invalidated;
-    bool isAlphaPre;
     DWORD rtc;
 #endif
 
@@ -153,5 +158,8 @@
 }SURFACE_STRUCTURE;
 
 int parseMask(unsigned int, int *, int *);
+int getShift(unsigned int);
+
+extern inline void updateCache(SURFACE_STRUCTURE *, JNIEnv *, jobject, bool);
 
 #endif

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/blitter.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/blitter.cpp?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/blitter.cpp (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/blitter.cpp Wed Sep  6 09:06:15 2006
@@ -562,14 +562,14 @@
                   sstride = srcStruct->scanline_stride;
                   dstride = dstStruct->scanline_stride;
 
-                  srcPtr += srcY * sstride + srcX;
-                  dstPtr += dstY * dstride + dstX;
+                  srcPtr += srcY * sstride + width + srcX - 1;
+                  dstPtr += dstY * dstride + width + dstX - 1;
 
-                  for(int y = 0; y < height; y++, srcPtr += sstride, dstPtr += dstride){
+                  for(int y = height; y > 0; y--, srcPtr += sstride, dstPtr += dstride){
                           sp = srcPtr;
                           dp = dstPtr;
-                          for(int x = 0; x < width; x++){
-                                  *dp++ = 0xff000000 | *sp++;
+                          for(int x = width; x > 0; x--){
+                                  *dp-- = 0xff000000 | *sp--;
                           }
                   }
           }else{
@@ -653,39 +653,44 @@
       int sstride = srcStruct->scanline_stride << 2;
       int dstride = dstStruct->scanline_stride << 2;
 
-      srcPtr += srcY * sstride + (srcX << 2);
-      dstPtr += dstY * dstride + (dstX << 2);
+      srcPtr += srcY * sstride + ((width + srcX) << 2) - 1;
+      dstPtr += dstY * dstride + ((width + dstX) << 2) - 1;
 
       int x, y;
       unsigned char sr, sg, sb, sa, dr, dg, db, da, fs = 255, fd;
-      for(y = 0; y < height; y++, srcPtr += sstride, dstPtr += dstride){
+      for(y = height; y > 0 ; y--, srcPtr += sstride, dstPtr += dstride){
           sp = srcPtr;
-          dp = dstPtr;
-          _dp = dp;
+          dp = _dp = dstPtr;
 
-          for(x = 0; x < width; x++){
-              sb = *sp++;
-              sg = *sp++;
-              sr = *sp++;
-              sa = *sp++;
+          for(x = width; x > 0; x--){
+              sa = *sp--;
+              sr = *sp--;
+              sg = *sp--;
+              sb = *sp--;
               sa = MUL(alpha, sa);
-              sb = MUL(sa, sb);
-              sg = MUL(sa, sg);
-              sr = MUL(sa, sr);
-              db = *dp++;
-              dg = *dp++;
-              dr = *dp++;
+                         if(sa != 255){
+                                 sb = MUL(sa, sb);
+                                 sg = MUL(sa, sg);
+                                 sr = MUL(sa, sr);
+                         }
+              dp--;
               da = 255;
-              dp++;
+              dr = *dp--;
+              dg = *dp--;
+              db = *dp--;
               fd = 255 - sa;
               COMPOSE(sa, sr, sg, sb, fs, da, dr, dg, db, fd);
-              db = DIV(da, db);
-              dg = DIV(da, dg);
-              dr = DIV(da, dr);
-              *_dp++ = db;
-              *_dp++ = dg;
-              *_dp++ = dr;
-              *_dp++ = 255;
+                         if(da != 255){
+                                 *_dp-- = 255;
+                                 *_dp-- = DIV(da, dr);
+                                 *_dp-- = DIV(da, dg);
+                                 *_dp-- = DIV(da, db);
+                         }else{
+                                 *_dp-- = 255;
+                                 *_dp-- = dr;
+                                 *_dp-- = dg;
+                                 *_dp-- = db;
+                         }
           }
       }
   }
@@ -699,44 +704,50 @@
       unsigned char *dstPtr = (unsigned char *)dstData;
       unsigned char *sp, *dp, *_dp;
 
-      int sstride = srcStruct->scanline_stride << 2;
-      int dstride = dstStruct->scanline_stride << 2;
+      int sstride = srcStruct->scanline_stride_byte;
+      int dstride = dstStruct->scanline_stride_byte;
 
-      srcPtr += srcY * sstride;
-      dstPtr += dstY * dstride;
+      srcPtr += srcY * sstride + ((width + srcX) << 2) - 1;
+      dstPtr += dstY * dstride + ((width + dstX) << 2) - 1;
 
       int x, y;
       unsigned char sr, sg, sb, sa, dr, dg, db, da, fs = 255, fd;
-      for(y = 0; y < height; y++, srcPtr += sstride, dstPtr += dstride){
-          sp = srcPtr + (srcX << 2);
-          dp = dstPtr + (dstX << 2);
-          _dp = dp;
-
-          for(x = 0; x < width; x++){
-              sb = *sp++;
-              sg = *sp++;
-              sr = *sp++;
-              sa = *sp++;
+      for(y = height; y > 0; y--, srcPtr += sstride, dstPtr += dstride){
+          sp = srcPtr;
+          dp = _dp = dstPtr;
+
+          for(x = width; x > 0; x--){
+              sa = *sp--;
+              sr = *sp--;
+              sg = *sp--;
+              sb = *sp--;
               sa = MUL(alpha, sa);
-              sb = MUL(sa, sb);
-              sg = MUL(sa, sg);
-              sr = MUL(sa, sr);
-              db = *dp++;
-              dg = *dp++;
-              dr = *dp++;
-              da = *dp++;
-              db = MUL(da, db);
-              dg = MUL(da, dg);
-              dr = MUL(da, dr);
+                         if(sa != 255){
+                                 sb = MUL(sa, sb);
+                                 sg = MUL(sa, sg);
+                                 sr = MUL(sa, sr);
+                         }
+              da = *dp--;
+              dr = *dp--;
+              dg = *dp--;
+              db = *dp--;
+                         if(da != 255){
+                                 db = MUL(da, db);
+                                 dg = MUL(da, dg);
+                                 dr = MUL(da, dr);
+                         }
               fd = 255 - sa;
               COMPOSE(sa, sr, sg, sb, fs, da, dr, dg, db, fd);
-              db = DIV(da, db);
-              dg = DIV(da, dg);
-              dr = DIV(da, dr);
-              *_dp++ = db;
-              *_dp++ = dg;
-              *_dp++ = dr;
-              *_dp++ = da;
+              *_dp-- = da;
+                         if(da != 255){
+                                 *_dp-- = DIV(da, dr);
+                                 *_dp-- = DIV(da, dg);
+                                 *_dp-- = DIV(da, db);
+                         }else{
+                                 *_dp-- = dr;
+                                 *_dp-- = dg;
+                                 *_dp-- = db;
+                         }
           }
       }
   }
@@ -1226,7 +1237,7 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_render_NativeImageBlitter_bltBG
   (JNIEnv *env, jobject obj, jint srcX, jint srcY, jlong srcSurfStruct, jobject srcData, 
   jint dstX, jint dstY, jlong dstSurfStruct, jobject dstData, jint width, jint height, 
-  jint bgcolor, jint compType, jfloat alpha, jintArray clip){
+  jint bgcolor, jint compType, jfloat alpha, jintArray clip, jboolean invalidated){
 
       if(compType == COMPOSITE_DST) return;
 
@@ -1399,7 +1410,7 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_render_NativeImageBlitter_blt
   (JNIEnv *env, jobject obj, jint srcX, jint srcY, jlong srcSurfStruct, jobject srcData, 
   jint dstX, jint dstY, jlong dstSurfStruct, jobject dstData, jint width, jint height, 
-  jint compType, jfloat alpha, jintArray clip){
+  jint compType, jfloat alpha, jintArray clip, jboolean invalidated){
 
       if(compType == COMPOSITE_DST) return;
 
@@ -1478,7 +1489,7 @@
       if(dstY < 0){
           height += srcY;
           srcY -= dstY;
-          srcY = 0;
+          dstY = 0;
       }
 
       if(srcX + width > srcX2) width = srcX2 - srcX + 1;
@@ -1590,7 +1601,7 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_render_NativeImageBlitter_xor
   (JNIEnv *env, jobject obj, jint srcX, jint srcY, jlong srcSurfStruct, jobject srcData, 
   jint dstX, jint dstY, jlong dstSurfStruct, jobject dstData, jint width, jint heigth, 
-  jint xorcolor, jintArray clip){
+  jint xorcolor, jintArray clip, jboolean invalidated){
 
   }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/include/org_apache_harmony_awt_gl_ImageSurface.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/include/org_apache_harmony_awt_gl_ImageSurface.h?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/include/org_apache_harmony_awt_gl_ImageSurface.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/include/org_apache_harmony_awt_gl_ImageSurface.h Wed Sep  6 09:06:15 2006
@@ -121,27 +121,38 @@
 Java_org_apache_harmony_awt_gl_ImageSurface_dispose(JNIEnv *, jobject, 
     jlong);
 
-/*
- * Method: org.apache.harmony.awt.gl.ImageSurface.createStructCCM(IIIIIIII[I[I[IIZ)J
- */
-JNIEXPORT jlong JNICALL
-Java_org_apache_harmony_awt_gl_ImageSurface_createStructCCM(JNIEnv *, jobject, 
-    jint, jint, jint, jint, jint, jint, jint, jint, jintArray, jintArray, jintArray, jint, jboolean);
+///*
+// * Method: org.apache.harmony.awt.gl.ImageSurface.createStructCCM(IIIIIIII[I[I[IIZ)J
+// */
+//JNIEXPORT jlong JNICALL
+//Java_org_apache_harmony_awt_gl_ImageSurface_createStructCCM(JNIEnv *, jobject, 
+//    jint, jint, jint, jint, jint, jint, jint, jint, jintArray, jintArray, jintArray, jint, jboolean);
+//
+///*
+// * Method: org.apache.harmony.awt.gl.ImageSurface.createStructICM(IIIIIII[IZIII)J
+// */
+//JNIEXPORT jlong JNICALL
+//Java_org_apache_harmony_awt_gl_ImageSurface_createStructICM(JNIEnv *, jobject, 
+//    jint, jint, jint, jint, jint, jint, jint, jintArray, jboolean, jint, jint, jint);
+//
+///*
+// * Method: org.apache.harmony.awt.gl.ImageSurface.createStructDCM(IIIIIIIIIIIIZ)J
+// */
+//JNIEXPORT jlong JNICALL
+//Java_org_apache_harmony_awt_gl_ImageSurface_createStructDCM(JNIEnv *, jobject, 
+//    jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
 
-/*
- * Method: org.apache.harmony.awt.gl.ImageSurface.createStructICM(IIIIIII[IZIII)J
- */
-JNIEXPORT jlong JNICALL
-Java_org_apache_harmony_awt_gl_ImageSurface_createStructICM(JNIEnv *, jobject, 
-    jint, jint, jint, jint, jint, jint, jint, jintArray, jboolean, jint, jint, jint);
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_createSurfStruct
+  (JNIEnv *, jobject, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jintArray, 
+  jintArray, jint, jintArray, jint, jboolean, jintArray, jintArray, jint, jboolean, jboolean, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.ImageSurface.createStructDCM(IIIIIIIIIIIIZ)J
+ * Class:     org_apache_harmony_awt_gl_ImageSurface
+ * Method:    updateCache
+ * Signature: (JLjava/lang/Object;Z)J
  */
-JNIEXPORT jlong JNICALL
-Java_org_apache_harmony_awt_gl_ImageSurface_createStructDCM(JNIEnv *, jobject, 
-    jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
-
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_ImageSurface_updateCache
+  (JNIEnv *, jobject, jlong, jobject, jboolean);
 
 #ifdef __cplusplus
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/include/org_apache_harmony_awt_gl_render_NativeImageBlitter.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/include/org_apache_harmony_awt_gl_render_NativeImageBlitter.h?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/include/org_apache_harmony_awt_gl_render_NativeImageBlitter.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/include/org_apache_harmony_awt_gl_render_NativeImageBlitter.h Wed Sep  6 09:06:15 2006
@@ -39,25 +39,25 @@
 /* Native methods */
 
 /*
- * Method: org.apache.harmony.awt.gl.render.NativeImageBlitter.xor(IIJLjava/lang/Object;IIJLjava/lang/Object;III[I)V
+ * Method: org.apache.harmony.awt.gl.render.NativeImageBlitter.xor(IIJLjava/lang/Object;IIJLjava/lang/Object;III[IZ)V
  */
 JNIEXPORT void JNICALL
 Java_org_apache_harmony_awt_gl_render_NativeImageBlitter_xor(JNIEnv *, jobject, 
-    jint, jint, jlong, jobject, jint, jint, jlong, jobject, jint, jint, jint, jintArray);
+    jint, jint, jlong, jobject, jint, jint, jlong, jobject, jint, jint, jint, jintArray, jboolean);
 
 /*
- * Method: org.apache.harmony.awt.gl.render.NativeImageBlitter.blt(IIJLjava/lang/Object;IIJLjava/lang/Object;IIIF[I)V
+ * Method: org.apache.harmony.awt.gl.render.NativeImageBlitter.blt(IIJLjava/lang/Object;IIJLjava/lang/Object;IIIF[IZ)V
  */
 JNIEXPORT void JNICALL
 Java_org_apache_harmony_awt_gl_render_NativeImageBlitter_blt(JNIEnv *, jobject, 
-    jint, jint, jlong, jobject, jint, jint, jlong, jobject, jint, jint, jint, jfloat, jintArray);
+    jint, jint, jlong, jobject, jint, jint, jlong, jobject, jint, jint, jint, jfloat, jintArray, jboolean);
 
 /*
- * Method: org.apache.harmony.awt.gl.render.NativeImageBlitter.bltBG(IIJLjava/lang/Object;IIJLjava/lang/Object;IIIIF[I)V
+ * Method: org.apache.harmony.awt.gl.render.NativeImageBlitter.bltBG(IIJLjava/lang/Object;IIJLjava/lang/Object;IIIIF[IZ)V
  */
 JNIEXPORT void JNICALL
 Java_org_apache_harmony_awt_gl_render_NativeImageBlitter_bltBG(JNIEnv *, jobject, 
-    jint, jint, jlong, jobject, jint, jint, jlong, jobject, jint, jint, jint, jint, jfloat, jintArray);
+    jint, jint, jlong, jobject, jint, jint, jlong, jobject, jint, jint, jint, jint, jfloat, jintArray, jboolean);
 
 
 #ifdef __cplusplus



Mime
View raw message