Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 3959 invoked from network); 4 Dec 2006 20:27:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Dec 2006 20:27:19 -0000 Received: (qmail 27617 invoked by uid 500); 4 Dec 2006 20:27:28 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 27587 invoked by uid 500); 4 Dec 2006 20:27:28 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 27578 invoked by uid 99); 4 Dec 2006 20:27:28 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Dec 2006 12:27:28 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Dec 2006 12:27:14 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 96AC31A984A; Mon, 4 Dec 2006 12:26:33 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r482341 [1/2] - in /harmony/enhanced/classlib/trunk/modules: awt/ awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/ awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/ awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/... Date: Mon, 04 Dec 2006 20:26:31 -0000 To: commits@harmony.apache.org From: apetrenko@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061204202633.96AC31A984A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: apetrenko Date: Mon Dec 4 12:26:28 2006 New Revision: 482341 URL: http://svn.apache.org/viewvc?view=rev&rev=482341 Log: Patch for HARMONY-2374 "[classlib][awt] Missing java2d code for OpenGL pipeline." Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/GLXGraphicsConfiguration.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/GLX.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WGLGraphicsConfiguration.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGLDefs.java harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/shared/ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/shared/nativelib_common.h harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/shared/org_apache_harmony_awt_gl_opengl_GL.cpp harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/shared/org_apache_harmony_awt_gl_opengl_GL.h harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/unix/ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/unix/liboglwrapper.exp harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/unix/makefile harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/windows/ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/windows/makefile harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/windows/oglwrapper.RES (with props) harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/windows/oglwrapper.def harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/windows/oglwrapper.rc harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/nativelib_common.cpp harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_WGL.cpp harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_WGL.h Modified: harmony/enhanced/classlib/trunk/modules/awt/build.xml harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLContextManager.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLGraphics2D.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLVolatileImage.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphicsDevice.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphics2DFactory.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsDevice.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WindowProcHandler.java harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/libgl.exp harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/makefile harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/nativelib_common.h harmony/enhanced/classlib/trunk/modules/swing/build.xml Modified: harmony/enhanced/classlib/trunk/modules/awt/build.xml URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/build.xml?view=diff&rev=482341&r1=482340&r2=482341 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/build.xml (original) +++ harmony/enhanced/classlib/trunk/modules/awt/build.xml Mon Dec 4 12:26:28 2006 @@ -164,6 +164,13 @@ + + + + + + + @@ -210,6 +217,8 @@ target="clean"/> + @@ -294,6 +303,7 @@ + Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLContextManager.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLContextManager.java?view=diff&rev=482341&r1=482340&r2=482341 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLContextManager.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLContextManager.java Mon Dec 4 12:26:28 2006 @@ -20,24 +20,102 @@ */ package org.apache.harmony.awt.gl.opengl; +import java.util.ArrayList; + public interface OGLContextManager { public static class OffscreenBufferObject { + private static final int MAX_CACHED_BUFFERS = 10; + private static final ArrayList availableBuffers = new ArrayList(); + public final long id; public final int width; public final int height; + public final OGLContextManager config; + public final long hdc; - public OffscreenBufferObject(long id, int width, int height) { + public OffscreenBufferObject(long id, long hdc, int width, int height, OGLContextManager config) { this.id = id; + this.hdc = hdc; this.width = width; this.height = height; + this.config = config; + } + + public static final OffscreenBufferObject getCachedBuffer(int w, int h, OGLContextManager config) { + for (int i = 0; i < availableBuffers.size(); i++) { // First try to find cached pbuffer + OffscreenBufferObject pbuffer = (OffscreenBufferObject) availableBuffers.get(i); + if (pbuffer.width >= w && pbuffer.height >= h && pbuffer.config == config) { + availableBuffers.remove(i); + return pbuffer; + } + } + + return null; + } + + public static final OffscreenBufferObject freeCachedBuffer(OffscreenBufferObject pbuffer) { + if (availableBuffers.size() <= MAX_CACHED_BUFFERS) { + availableBuffers.add(pbuffer); + return null; + } + + // Try to find smaller pbuffer in the cache and replace it + for (int i=0; i FORMATTED_DRAWABLES_CACHE_SIZE) { + formattedDrawables.clear(); + } + formattedDrawables.add(new Long(drawable)); + } + + oglContext = wgl.wglCreateContext(hdc); + + if(oshdc == 0) { + w32.ReleaseDC(drawable, hdc); + } + + // Share display lists if there are othe contexts + if (existingContexts.size() > 0) { + wgl.wglShareLists(((Long)existingContexts.get(0)).longValue(), oglContext); + } + + existingContexts.add(new Long(oglContext)); + oglContextThreadLocal.set(new Long(oglContext)); + } + + return oglContext; + } + + public void destroyOGLContext(long oglContext) { + if (oglContext == currentOGLContext) { + currentOGLContext = 0; + } + + wgl.wglDeleteContext(oglContext); + existingContexts.remove(new Long(oglContext)); + } + + public boolean makeCurrent(long oglContext, long drawable, long oshdc) { + if (oglContext != currentOGLContext || drawable != currentDrawable) { + + long hdc = (oshdc == 0) ? w32.GetDC(drawable) : oshdc; + + if (oshdc == 0 && !formattedDrawables.contains(new Long(drawable))) { // Need to set pixel format + int pixelFormat = choosePixelFormatARB(hdc); + w32.SetPixelFormat(hdc, pixelFormat, w32.createPIXELFORMATDESCRIPTOR(false)); + if (formattedDrawables.size() > FORMATTED_DRAWABLES_CACHE_SIZE) { + formattedDrawables.clear(); + } + formattedDrawables.add(new Long(drawable)); + } + + if (wgl.wglMakeCurrent(hdc, oglContext) == 0) { + w32.ReleaseDC(drawable, hdc); + throw new IllegalStateException("Cannot make opengl context current"); + } + + if(oshdc == 0) { + w32.ReleaseDC(drawable, hdc); + } + + currentOGLContext = oglContext; + currentDrawable = drawable; + + return true; + } + + return false; + } + + public boolean makeContextCurrent( + long oglContext, + long draw, long read, + long drawHDC, long readHDC + ) { + return makeCurrent(oglContext, draw, drawHDC); // XXX - todo - implement + } + + public void swapBuffers(long drawable, long oshdc) { + long hdc = (oshdc == 0) ? w32.GetDC(drawable) : oshdc; + wgl.SwapBuffers(hdc); + if(oshdc == 0) { + w32.ReleaseDC(drawable, hdc); + } + } + + public OffscreenBufferObject createOffscreenBuffer(int w, int h) { + // Try to get pbuffer from cache + OffscreenBufferObject pbuffer = OffscreenBufferObject.getCachedBuffer(w, h, this); + if (pbuffer != null) { + return pbuffer; + } + + long hwnd = getHWND(); + long hdc = w32.GetDC(hwnd); + + int pixelFormat = choosePixelFormatARB(hdc); + + Int32Pointer attribList = NativeBridge.getInstance().createInt32Pointer(1, true); + attribList.set(0,0); + long id = wgl.wglCreatePbufferARB(hdc, pixelFormat, w, h, attribList.lock()); + attribList.unlock(); + attribList.free(); + + long buffHdc = wgl.wglGetPbufferDCARB(id); + + w32.ReleaseDC(hwnd, hdc); + w32.DestroyWindow(hwnd); + + return new OffscreenBufferObject(id, buffHdc, w, h, this); + } + + public void freeOffscreenBuffer(OffscreenBufferObject pbuffer) { + pbuffer = OffscreenBufferObject.freeCachedBuffer(pbuffer); + + if (pbuffer != null) { + wgl.wglReleasePbufferDCARB(pbuffer.id, pbuffer.hdc); + wgl.wglDestroyPbufferARB(pbuffer.id); + } + } + + public void freeOffscreenBuffer(long id, long hdc) { + wgl.wglReleasePbufferDCARB(id, hdc); + wgl.wglDestroyPbufferARB(id); + } + + public VolatileImage createCompatibleVolatileImage(int width, int height) { + return new OGLVolatileImage(this, width, height); + } +} Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphics2DFactory.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphics2DFactory.java?view=diff&rev=482341&r1=482340&r2=482341 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphics2DFactory.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphics2DFactory.java Mon Dec 4 12:26:28 2006 @@ -24,6 +24,7 @@ import org.apache.harmony.awt.gl.CommonGraphics2DFactory; import org.apache.harmony.awt.gl.MultiRectArea; +import org.apache.harmony.awt.gl.opengl.OGLGraphics2D; import org.apache.harmony.awt.gl.font.FontManager; import org.apache.harmony.awt.gl.font.WinFontManager; import org.apache.harmony.awt.gl.font.WindowsFont; @@ -44,12 +45,20 @@ @Deprecated public Graphics2D getGraphics2D(NativeWindow nw, int tx, int ty, MultiRectArea clip) { Insets ins = nw.getInsets(); - return new WinGDIPGraphics2D(nw, tx - ins.left, ty - ins.top, clip); + if (WinGraphicsDevice.useOpenGL) { + return new OGLGraphics2D(nw, tx - ins.left, ty - ins.top, clip); + } else { + return new WinGDIPGraphics2D(nw, tx - ins.left, ty - ins.top, clip); + } } public Graphics2D getGraphics2D(NativeWindow nw, int tx, int ty, int width, int height) { Insets ins = nw.getInsets(); - return new WinGDIPGraphics2D(nw, tx - ins.left, ty - ins.top, width, height); + if (WinGraphicsDevice.useOpenGL) { + return new OGLGraphics2D(nw, tx - ins.left, ty - ins.top, width, height); + } else { + return new WinGDIPGraphics2D(nw, tx - ins.left, ty - ins.top, width, height); + } } public GraphicsEnvironment createGraphicsEnvironment(WindowFactory wf) { Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsDevice.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsDevice.java?view=diff&rev=482341&r1=482340&r2=482341 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsDevice.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsDevice.java Mon Dec 4 12:26:28 2006 @@ -52,6 +52,12 @@ private byte []idBytes = null; + static boolean useOpenGL; + static { + String opengl = System.getProperty("java2d.opengl"); //$NON-NLS-1$ + useOpenGL = opengl != null && opengl.equals("true"); //$NON-NLS-1$ + }; + public WinGraphicsDevice(int left, int top, int right, int bottom, String id, boolean primary) { type = TYPE_RASTER_SCREEN; bounds = new Rectangle(left, top, right-left, bottom-top); @@ -100,7 +106,9 @@ int dci = win32.GetPixelFormat(hdc); Win32.PIXELFORMATDESCRIPTOR pfd = win32.createPIXELFORMATDESCRIPTOR(false); if (win32.DescribePixelFormat(hdc, dci, pfd.size(), pfd) > 0) { - defaultConfig = new WinGraphicsConfiguration(this, dci, pfd); + defaultConfig = useOpenGL ? + new WGLGraphicsConfiguration(this, dci, pfd): + new WinGraphicsConfiguration(this, dci, pfd); } else { getConfigurations(); } @@ -138,7 +146,9 @@ Vector gcv = new Vector(100); int i = 1; while (win32.DescribePixelFormat(hdc, i, pfd.size(), pfd) > 0) { - WinGraphicsConfiguration gc = new WinGraphicsConfiguration(this, i, pfd); + WinGraphicsConfiguration gc = useOpenGL ? + new WGLGraphicsConfiguration(this, i, pfd): + new WinGraphicsConfiguration(this, i, pfd); if (!gcv.contains(gc)) { gcv.add(gc); Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java?view=auto&rev=482341 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java Mon Dec 4 12:26:28 2006 @@ -0,0 +1,256 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Oleg V. Khaschansky + * @version $Revision$ + */ +/** + * This file is based on WGL headers and has been generated by the nativebridge tool. + */ + +package org.apache.harmony.awt.nativebridge.windows; + +import org.apache.harmony.awt.nativebridge.*; + +/** + * This file is based on WGL headers and has been generated by the nativebridge tool. + */ +public class WGL extends BasicLibWrapper { + static WGL instance; + + public static synchronized WGL getInstance() { + if (instance == null) { + instance = new WGL(); + } + return instance; + } + + private WGL() { + System.loadLibrary("Win32Wrapper"); + init(); + } + + private static native void init(); + + public final long wglGetProcAddress(String param_0) { + Int8Pointer _param_0 = null == param_0? null : nb.createInt8Pointer(param_0, false); + long tmp_0 = _param_0 == null ? 0 : _param_0.longLockPointer(); + long tmp_ret = wglGetProcAddress(tmp_0); + if (_param_0 != null) { + _param_0.unlock(); + _param_0.free(); + } + return tmp_ret; + } + public final long wglGetProcAddress(Int8Pointer param_0) { + long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer(); + long tmp_ret = wglGetProcAddress(tmp_0); + if (param_0 != null) { + param_0.unlock(); + } + return tmp_ret; + } + public final native long wglGetProcAddress(long param_0); + + public final native long wglCreateContext(long param_0); + + + public static class HGLRC__ extends CommonStructWrapper { + + public static final int sizeof = 4; + + HGLRC__(boolean direct) { + super(sizeof, direct); + } + HGLRC__(VoidPointer base) { + super(base); + } + HGLRC__(long addr) { + super(addr); + } + public final void set_unused(int val) { + byteBase.setInt32(0, val); + } + public final int get_unused() { + return byteBase.getInt32(0); + } + public int size() { + return sizeof; + } + } + + public final HGLRC__ createHGLRC__(boolean direct) { + return new HGLRC__(direct); + } + public final HGLRC__ createHGLRC__(VoidPointer base) { + return new HGLRC__(base); + } + public final HGLRC__ createHGLRC__(long addr) { + return new HGLRC__(addr); + } + + public final int wglMakeCurrent(long param_0, WGL.HGLRC__ param_1) { + long tmp_0 = param_1 == null ? 0 : param_1.longLockPointer(); + int tmp_ret = wglMakeCurrent(param_0, tmp_0); + if (param_1 != null) { + param_1.unlock(); + } + return tmp_ret; + } + public final native int wglMakeCurrent(long param_0, long param_1); + + public final int wglDestroyPbufferARB(HPBUFFERARB__ param_0) { + long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer(); + int tmp_ret = wglDestroyPbufferARB(tmp_0); + if (param_0 != null) { + param_0.unlock(); + } + return tmp_ret; + } + public final native int wglDestroyPbufferARB(long param_0); + + + public static class HPBUFFERARB__ extends CommonStructWrapper { + + public static final int sizeof = 4; + + HPBUFFERARB__(boolean direct) { + super(sizeof, direct); + } + HPBUFFERARB__(VoidPointer base) { + super(base); + } + HPBUFFERARB__(long addr) { + super(addr); + } + public final void set_unused(int val) { + byteBase.setInt32(0, val); + } + public final int get_unused() { + return byteBase.getInt32(0); + } + public int size() { + return sizeof; + } + } + + public final HPBUFFERARB__ createHPBUFFERARB__(boolean direct) { + return new HPBUFFERARB__(direct); + } + public final HPBUFFERARB__ createHPBUFFERARB__(VoidPointer base) { + return new HPBUFFERARB__(base); + } + public final HPBUFFERARB__ createHPBUFFERARB__(long addr) { + return new HPBUFFERARB__(addr); + } + + public final native int SwapBuffers(long param_0); + + public final int wglReleasePbufferDCARB(WGL.HPBUFFERARB__ param_0, long param_1) { + long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer(); + int tmp_ret = wglReleasePbufferDCARB(tmp_0, param_1); + if (param_0 != null) { + param_0.unlock(); + } + return tmp_ret; + } + public final native int wglReleasePbufferDCARB(long param_0, long param_1); + + public final WGL.HPBUFFERARB__ wglCreatePbufferARB(long param_0, int param_1, int param_2, int param_3, Int32Pointer param_4) { + long tmp_0 = param_4 == null ? 0 : param_4.longLockPointer(); + long tmp_ret = wglCreatePbufferARB(param_0, param_1, param_2, param_3, tmp_0); + if (param_4 != null) { + param_4.unlock(); + } + return WGL.instance.createHPBUFFERARB__(tmp_ret); + } + public final native long wglCreatePbufferARB(long param_0, int param_1, int param_2, int param_3, long param_4); + + public final int wglQueryPbufferARB(WGL.HPBUFFERARB__ param_0, int param_1, Int32Pointer param_2) { + long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer(); + long tmp_1 = param_2 == null ? 0 : param_2.longLockPointer(); + int tmp_ret = wglQueryPbufferARB(tmp_0, param_1, tmp_1); + if (param_0 != null) { + param_0.unlock(); + } + if (param_2 != null) { + param_2.unlock(); + } + return tmp_ret; + } + public final native int wglQueryPbufferARB(long param_0, int param_1, long param_2); + + public final int wglDeleteContext(WGL.HGLRC__ param_0) { + long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer(); + int tmp_ret = wglDeleteContext(tmp_0); + if (param_0 != null) { + param_0.unlock(); + } + return tmp_ret; + } + public final native int wglDeleteContext(long param_0); + + public final native long wglGetExtensionsStringARB(long param_0); + + public final int wglChoosePixelFormatARB(long param_0, Int32Pointer param_1, FloatPointer param_2, int param_3, Int32Pointer param_4, Int32Pointer param_5) { + long tmp_0 = param_1 == null ? 0 : param_1.longLockPointer(); + long tmp_1 = param_2 == null ? 0 : param_2.longLockPointer(); + long tmp_2 = param_4 == null ? 0 : param_4.longLockPointer(); + long tmp_3 = param_5 == null ? 0 : param_5.longLockPointer(); + int tmp_ret = wglChoosePixelFormatARB(param_0, tmp_0, tmp_1, param_3, tmp_2, tmp_3); + if (param_1 != null) { + param_1.unlock(); + } + if (param_2 != null) { + param_2.unlock(); + } + if (param_4 != null) { + param_4.unlock(); + } + if (param_5 != null) { + param_5.unlock(); + } + return tmp_ret; + } + public final native int wglChoosePixelFormatARB(long param_0, long param_1, long param_2, int param_3, long param_4, long param_5); + + public final int wglShareLists(WGL.HGLRC__ param_0, WGL.HGLRC__ param_1) { + long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer(); + long tmp_1 = param_1 == null ? 0 : param_1.longLockPointer(); + int tmp_ret = wglShareLists(tmp_0, tmp_1); + if (param_0 != null) { + param_0.unlock(); + } + if (param_1 != null) { + param_1.unlock(); + } + return tmp_ret; + } + public final native int wglShareLists(long param_0, long param_1); + + public final long wglGetPbufferDCARB(WGL.HPBUFFERARB__ param_0) { + long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer(); + long tmp_ret = wglGetPbufferDCARB(tmp_0); + if (param_0 != null) { + param_0.unlock(); + } + return tmp_ret; + } + public final native long wglGetPbufferDCARB(long param_0); + +} + Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGLDefs.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGLDefs.java?view=auto&rev=482341 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGLDefs.java (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGLDefs.java Mon Dec 4 12:26:28 2006 @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Oleg V. Khaschansky + * @version $Revision$ + */ +/** + * This file is based on WGL headers. + */ + +package org.apache.harmony.awt.nativebridge.windows; + +public interface WGLDefs { + public static final int WGL_DRAW_TO_WINDOW_ARB = 0x2001; + public static final int WGL_PIXEL_TYPE_ARB = 0x2013; + public static final int WGL_TYPE_RGBA_ARB = 0x202B; + public static final int WGL_DRAW_TO_PBUFFER_ARB = 0x202D; + public static final int WGL_STENCIL_BITS_ARB = 0x2023; + public static final int WGL_ALPHA_BITS_ARB = 0x201B; + public static final int WGL_DOUBLE_BUFFER_ARB = 0x2011; + public static final int WGL_ACCELERATION_ARB = 0x2003; + public static final int WGL_FULL_ACCELERATION_ARB = 0x2027; +} Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WindowProcHandler.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WindowProcHandler.java?view=diff&rev=482341&r1=482340&r2=482341 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WindowProcHandler.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WindowProcHandler.java Mon Dec 4 12:26:28 2006 @@ -89,4 +89,9 @@ className, winError)); } } + + public static void registerWindowClass(String className) { + registerCallback(); + registerWindowClass(className, instance.windowProcPtr); + } } Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/libgl.exp URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/libgl.exp?view=diff&rev=482341&r1=482340&r2=482341 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/libgl.exp (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/libgl.exp Mon Dec 4 12:26:28 2006 @@ -16,6 +16,7 @@ Java_org_apache_harmony_awt_gl_render_NativeImageBlitter_bltBG; Java_org_apache_harmony_awt_gl_render_NativeImageBlitter_blt; Java_org_apache_harmony_awt_gl_render_NativeImageBlitter_xor; + Java_org_apache_harmony_awt_gl_ImageSurface_updateCache; Java_org_apache_harmony_awt_gl_Surface_initIDs; local : *; }; Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/shared/nativelib_common.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/shared/nativelib_common.h?view=auto&rev=482341 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/shared/nativelib_common.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/oglwrapper/shared/nativelib_common.h Mon Dec 4 12:26:28 2006 @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** + * @author Oleg V. Khaschansky + * @version $Revision$ + */ +#ifndef NATIVELIB_COMMON_H +#define NATIVELIB_COMMON_H + +#ifdef __linux__ +// common linux section-------------------------------- +#include +#include + +#define mkstr(x) #x + + +#define LOAD_LIB(res, name) res = dlopen(mkstr(lib##name.so), RTLD_LAZY) + +#define FindFunction(lib, name) (void *)dlsym(lib, name) + +#define INIT_GL_GET_PROC_ADDRESS + +#ifndef __INTEL_COMPILER + typedef long long __int64; +#endif + +typedef void* libHandler; + +#define __stdcall + +// END common linux section---------------------------- +#ifdef __i386__ +// ia32 linux section---------------------------------- + + + +// END ia32 linux section------------------------------ +#else +// ipf linux section---------------------------------- + +// END ipf linux section------------------------------ +#endif +#else //WINDOWS +// common windows section------------------------------ +#include + +#define mkstr(x) #x +#define GL Opengl32 +#define GLU Glu32 + +typedef HMODULE libHandler; + +#define LOAD_LIB(res, name) res =::LoadLibraryA(mkstr(name)) + +//#define FindFunction(lib, name) ::GetProcAddress(lib, name) + +void * (__stdcall * p_nbridge_wglGetProcAddress) (void *); + +#undef FindFunction +void *findFunctionRes = NULL; +#define FindFunction(lib, name) ((findFunctionRes = (void *)::GetProcAddress(lib, name)) ? findFunctionRes : (*p_nbridge_wglGetProcAddress)(name)) + +#define INIT_GL_GET_PROC_ADDRESS p_nbridge_wglGetProcAddress = (void * (__stdcall *) (void *)) ::GetProcAddress(libGL, "wglGetProcAddress"); + +// END common windows section-------------------------- +#ifdef _WIN32 +// ia32 windows section-------------------------------- + +// END ia32 windows section---------------------------- +#else //ITANIUM +// ipf windows section-------------------------------- + +// END ipf windows section---------------------------- +#endif +#endif + + +#endif