-/* fxwgl.c - Microsoft wgl functions emulation for
- * 3Dfx VooDoo/Mesa interface
- */
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.3
+ *
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Thank you for your contribution, David!
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
*
- * See the file fxapi.c for more informations about authors
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
*
+ * See fxapi.h for more revision/author details.
*/
+
+
+/* fxwgl.c - Microsoft wgl functions emulation for
+ * 3Dfx VooDoo/Mesa interface
+ */
+
+
#ifdef __WIN32__
#ifdef __cplusplus
#endif
#include <windows.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
+#include "GL/gl.h"
#ifdef __cplusplus
}
#endif
#include <stdio.h>
-#include <GL/fxmesa.h>
+#include "GL/fxmesa.h"
#include "fxdrv.h"
#define MAX_MESA_ATTRS 20
static int moving = 0;
if (!moving) {
if(fxQueryHardware()!=GR_SSTTYPE_VOODOO) {
- if(!grSstControl(GR_CONTROL_RESIZE)) {
+ if(!FX_grSstControl(GR_CONTROL_RESIZE)) {
moving = 1;
SetWindowPos(hwnd, 0, 0, 0, 300, 300, SWP_NOMOVE|SWP_NOZORDER);
moving = 0;
- if(!grSstControl(GR_CONTROL_RESIZE)) {
+ if(!FX_grSstControl(GR_CONTROL_RESIZE)) {
/*MessageBox(0,_T("Error changing windowsize"),_T("fxMESA"),MB_OK);*/
PostMessage(hWND,WM_CLOSE,0,0);
}
}
/* Do the clipping in the glide library */
- grClipWindow(0,0,grSstScreenWidth(),grSstScreenHeight());
+ FX_grClipWindow(0,0,FX_grSstScreenWidth(),FX_grSstScreenHeight());
/* And let the new size set in the context */
fxMesaUpdateScreenSize(ctx);
}
BOOL fMinimized = (BOOL) HIWORD(wParam);
if((fActive == WA_INACTIVE) || fMinimized)
- grSstControl(GR_CONTROL_DEACTIVATE);
+ FX_grSstControl(GR_CONTROL_DEACTIVATE);
else
- grSstControl(GR_CONTROL_ACTIVATE);
+ FX_grSstControl(GR_CONTROL_ACTIVATE);
}
break;
case WM_SHOWWINDOW:
break;
+ case WM_SYSKEYDOWN:
case WM_SYSCHAR:
if(gdiWindowHackEna && (VK_RETURN == wParam)) {
if(gdiWindowHack) {
gdiWindowHack = GL_FALSE;
- grSstControl(GR_CONTROL_ACTIVATE);
+ FX_grSstControl(GR_CONTROL_ACTIVATE);
} else {
gdiWindowHack = GL_TRUE;
- grSstControl(GR_CONTROL_DEACTIVATE);
+ FX_grSstControl(GR_CONTROL_DEACTIVATE);
}
}
break;
hDC = GetDC(dibWnd);
- dibBMI = (BITMAPINFO*) malloc( sizeof(BITMAPINFO) + (256*sizeof(RGBQUAD)));
+ dibBMI = (BITMAPINFO*) MALLOC( sizeof(BITMAPINFO) + (256*sizeof(RGBQUAD)));
memset(dibBMI,0,sizeof(BITMAPINFO) + (256*sizeof(RGBQUAD)));
gdiWindowHack = GL_FALSE;
else {
gdiWindowHack = GL_TRUE;
- grSstControl(GR_CONTROL_DEACTIVATE);
+ FX_grSstControl(GR_CONTROL_DEACTIVATE);
}
}
} else {
if(ctx && hglrc == (HGLRC)1) {
if (gdiWindowHackEna) {
DeleteObject(dibHBM);
- free(dibBMI);
+ FREE(dibBMI);
dibSurfacePtr = NULL;
dibBMI = NULL;
SetTextColor(bitDevice, tempColor);
// Place chars based on base line
- VERIFY(SetTextAlign(bitDevice, TA_BASELINE) >= 0);
+ VERIFY(SetTextAlign(bitDevice, TA_BASELINE) >= 0 ? 1 : 0);
for(i = 0; i < numChars; i++) {
SIZE size;
// Convert the display dependant representation to a 1 bit deep DIB
numBytes = (bmapWidth * bmapHeight) / 8;
- bmap = malloc(numBytes);
+ bmap = MALLOC(numBytes);
dibInfo->bmiHeader.biWidth = bmapWidth;
dibInfo->bmiHeader.biHeight = bmapHeight;
res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap,
DeleteObject(bitObject);
// Deallocate the bitmap data
- free(bmap);
+ FREE(bmap);
}
// Destroy the DC
VERIFY(DeleteDC(bitDevice));
- free(dibInfo);
+ FREE(dibInfo);
return TRUE;
#undef VERIFY
HDC hdcDIBSection = CreateCompatibleDC(hdcScreen);
HBITMAP holdBitmap = (HBITMAP) SelectObject(hdcDIBSection, dibHBM);
- grLfbReadRegion(GR_BUFFER_FRONTBUFFER, 0, 0,
+ FX_grLfbReadRegion(GR_BUFFER_FRONTBUFFER, 0, 0,
width, height,
width * 2,
dibSurfacePtr);
* display. Obviously, it's performance hit will be higher on larger displays and
* less on smaller displays. To support the window-hack display this is probably fine.
*/
+#if FXMESA_USE_ARGB
{
unsigned long *pixel = dibSurfacePtr;
unsigned long count = (width * height) / 2;
;
}
}
-
+#endif
+
BitBlt(hdcScreen, 0, 0,
width, height,
hdcDIBSection,