Huw Davies : wineps: Add a helper to return the rgb to grayscale scaling factors.

Alexandre Julliard julliard at winehq.org
Fri Apr 5 14:02:16 CDT 2013


Module: wine
Branch: master
Commit: 30162ab39d1dd599b65cd1024e3a2c3c71da16ee
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=30162ab39d1dd599b65cd1024e3a2c3c71da16ee

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Apr  5 11:59:06 2013 +0100

wineps: Add a helper to return the rgb to grayscale scaling factors.

---

 dlls/wineps.drv/color.c |   10 ++++++++--
 dlls/wineps.drv/psdrv.h |    1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/wineps.drv/color.c b/dlls/wineps.drv/color.c
index 1f82253..867260a 100644
--- a/dlls/wineps.drv/color.c
+++ b/dlls/wineps.drv/color.c
@@ -52,6 +52,12 @@ BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2)
     return TRUE;
 }
 
+PSRGB rgb_to_grayscale_scale( void )
+{
+    static const PSRGB scale = {0.3, 0.59, 0.11};
+    /* FIXME configurable */
+    return scale;
+}
 
 /**********************************************************************
  *	     PSDRV_CreateColor
@@ -79,9 +85,9 @@ void PSDRV_CreateColor( PHYSDEV dev, PSCOLOR *pscolor, COLORREF wincolor )
 	pscolor->value.rgb.g = g;
 	pscolor->value.rgb.b = b;
     } else {
+        PSRGB scale = rgb_to_grayscale_scale();
         pscolor->type = PSCOLOR_GRAY;
-	/* FIXME configurable */
-	pscolor->value.gray.i = r * 0.3 + g * 0.59 + b * 0.11;
+        pscolor->value.gray.i = r * scale.r + g * scale.g + b * scale.b;
     }
     return;
 }
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h
index 42acdcb..e7584fa 100644
--- a/dlls/wineps.drv/psdrv.h
+++ b/dlls/wineps.drv/psdrv.h
@@ -485,6 +485,7 @@ extern void PSDRV_ResetClip( PHYSDEV dev ) DECLSPEC_HIDDEN;
 extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2) DECLSPEC_HIDDEN;
 extern void PSDRV_CreateColor( PHYSDEV dev, PSCOLOR *pscolor,
 		     COLORREF wincolor ) DECLSPEC_HIDDEN;
+extern PSRGB rgb_to_grayscale_scale( void ) DECLSPEC_HIDDEN;
 extern char PSDRV_UnicodeToANSI(int u) DECLSPEC_HIDDEN;
 
 extern INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title ) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list