Vitaly Budovski : wined3d: Fixed some typos and prevented divide by 0.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Feb 28 06:08:15 CST 2006
Module: wine
Branch: refs/heads/master
Commit: c8480e25e723a81647c5766c11a8863d448902e5
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=c8480e25e723a81647c5766c11a8863d448902e5
Author: Vitaly Budovski <vbudovsk at cs.rmit.edu.au>
Date: Sat Feb 25 20:50:27 2006 +1100
wined3d: Fixed some typos and prevented divide by 0.
---
dlls/wined3d/device.c | 39 +++++++++++++++++++++------------------
1 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e458fa3..0518c37 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3502,7 +3502,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRen
{
/*
* POINTSCALEENABLE controls how point size value is treated. If set to
- * true, the point size is scaled with repsect to height of viewport.
+ * true, the point size is scaled with respect to height of viewport.
* When set to false point size is in pixels.
*
* http://msdn.microsoft.com/library/en-us/directx9_c/point_sprites.asp
@@ -3510,28 +3510,31 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRen
/* Default values */
GLfloat att[3] = {1.0f, 0.0f, 0.0f};
-
+
/*
- * Minium valid point size for OpenGL is 1.0f. For Direct3D it is 0.0f.
+ * Minimum valid point size for OpenGL is 1.0f. For Direct3D it is 0.0f.
* This means that OpenGL will clamp really small point sizes to 1.0f.
* To correct for this we need to multiply by the scale factor when sizes
* are less than 1.0f. scale_factor = 1.0f / point_size.
*/
- GLfloat pointSize = *((float*)&This->stateBlock->renderState[D3DRS_POINTSIZE]);
- GLfloat scaleFactor;
- if(pointSize < 1.0f) {
- scaleFactor = pointSize * pointSize;
- } else {
- scaleFactor = 1.0f;
- }
-
- if(This->stateBlock->renderState[WINED3DRS_POINTSCALEENABLE]) {
- att[0] = *((float*)&This->stateBlock->renderState[WINED3DRS_POINTSCALE_A]) /
- (This->stateBlock->viewport.Height * This->stateBlock->viewport.Height * scaleFactor);
- att[1] = *((float*)&This->stateBlock->renderState[WINED3DRS_POINTSCALE_B]) /
- (This->stateBlock->viewport.Height * This->stateBlock->viewport.Height * scaleFactor);
- att[2] = *((float*)&This->stateBlock->renderState[WINED3DRS_POINTSCALE_C]) /
- (This->stateBlock->viewport.Height * This->stateBlock->viewport.Height * scaleFactor);
+ GLfloat pointSize = *((float*)&This->stateBlock->renderState[WINED3DRS_POINTSIZE]);
+ if(pointSize > 0.0f) {
+ GLfloat scaleFactor;
+
+ if(pointSize < 1.0f) {
+ scaleFactor = pointSize * pointSize;
+ } else {
+ scaleFactor = 1.0f;
+ }
+
+ if(This->stateBlock->renderState[WINED3DRS_POINTSCALEENABLE]) {
+ att[0] = *((float*)&This->stateBlock->renderState[WINED3DRS_POINTSCALE_A]) /
+ (This->stateBlock->viewport.Height * This->stateBlock->viewport.Height * scaleFactor);
+ att[1] = *((float*)&This->stateBlock->renderState[WINED3DRS_POINTSCALE_B]) /
+ (This->stateBlock->viewport.Height * This->stateBlock->viewport.Height * scaleFactor);
+ att[2] = *((float*)&This->stateBlock->renderState[WINED3DRS_POINTSCALE_C]) /
+ (This->stateBlock->viewport.Height * This->stateBlock->viewport.Height * scaleFactor);
+ }
}
if(GL_SUPPORT(ARB_POINT_PARAMETERS)) {
More information about the wine-cvs
mailing list