Windows: Made WindowsPeerInfo.choosePixelFormat static and let WindowsPeerInfo.setPixelFormat be called seperately

This commit is contained in:
Elias Naur 2008-05-01 09:44:19 +00:00
parent ef5bf0361b
commit bf4b5a5890
3 changed files with 7 additions and 6 deletions

View File

@ -58,7 +58,8 @@ final class WindowsAWTGLCanvasPeerInfo extends WindowsPeerInfo {
nInitHandle(awt_surface.lockAndGetHandle(component), getHandle());
if (!has_pixel_format && pixel_format != null) {
// If we haven't applied a pixel format yet, do it now
choosePixelFormat(component.getX(), component.getY(), pixel_format, null, true, true, false, true);
int format = choosePixelFormat(getHdc(), component.getX(), component.getY(), pixel_format, null, true, true, false, true);
setPixelFormat(getHdc(), format);
has_pixel_format = true;
}
}

View File

@ -51,7 +51,8 @@ final class WindowsDisplayPeerInfo extends WindowsPeerInfo {
void initDC(long hwnd, long hdc) throws LWJGLException {
nInitDC(getHandle(), hwnd, hdc);
choosePixelFormat(0, 0, pixel_format, null, true, true, false, true);
int format = choosePixelFormat(hdc, 0, 0, pixel_format, null, true, true, false, true);
setPixelFormat(hdc, format);
}
private static native void nInitDC(ByteBuffer peer_info_handle, long hwnd, long hdc);

View File

@ -48,12 +48,11 @@ abstract class WindowsPeerInfo extends PeerInfo {
}
private static native ByteBuffer createHandle();
protected void choosePixelFormat(int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException {
int pixel_format_id = nChoosePixelFormat(getHdc(), origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, support_window, support_pbuffer, double_buffered);
setPixelFormat(getHdc(), pixel_format_id);
protected static int choosePixelFormat(long hdc, int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException {
return nChoosePixelFormat(hdc, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, support_window, support_pbuffer, double_buffered);
}
private static native int nChoosePixelFormat(long hdc, int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException;
private static native void setPixelFormat(long hdc, int pixel_format) throws LWJGLException;
protected static native void setPixelFormat(long hdc, int pixel_format) throws LWJGLException;
public final long getHdc() {
return nGetHdc(getHandle());