]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/palette.cpp
Patch to use high printer resolution instead of Cairo's 72dpi
[wxWidgets.git] / src / os2 / palette.cpp
index 43252c40700a2b5f0d12e20c7a574838a0d0c82f..a579c53803122338fef80136aee09b46b0b5000f 100644 (file)
@@ -1,25 +1,23 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.cpp
+// Name:        src/os2/palette.cpp
 // Purpose:     wxPalette
 // Author:      AUTHOR
 // Modified by:
 // Created:     ??/??/98
 // RCS-ID:      $Id$
 // Copyright:   (c) AUTHOR
 // Purpose:     wxPalette
 // Author:      AUTHOR
 // Modified by:
 // Created:     ??/??/98
 // RCS-ID:      $Id$
 // Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifndef WX_PRECOMP
 /////////////////////////////////////////////////////////////////////////////
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifndef WX_PRECOMP
-#include <stdio.h>
-#include "wx/defs.h"
-#include "wx/setup.h"
-#include "wx/string.h"
-#include "wx/os2/private.h"
-#include "wx/palette.h"
-#include "wx/app.h"
+    #include <stdio.h>
+    #include "wx/string.h"
+    #include "wx/os2/private.h"
+    #include "wx/palette.h"
+    #include "wx/app.h"
 #endif
 
 #define INCL_PM
 #endif
 
 #define INCL_PM
@@ -68,24 +66,20 @@ wxPalette::~wxPalette()
 {
 } // end of wxPalette::~wxPalette
 
 {
 } // end of wxPalette::~wxPalette
 
-bool wxPalette::FreeResource(
-  bool                              bForce
-)
+bool wxPalette::FreeResource( bool WXUNUSED(bForce) )
 {
     if ( M_PALETTEDATA && M_PALETTEDATA->m_hPalette)
     {
         ::GpiSelectPalette(M_PALETTEDATA->m_hPS, NULLHANDLE);
         ::GpiDeletePalette((HPAL)M_PALETTEDATA->m_hPalette);
     }
 {
     if ( M_PALETTEDATA && M_PALETTEDATA->m_hPalette)
     {
         ::GpiSelectPalette(M_PALETTEDATA->m_hPS, NULLHANDLE);
         ::GpiDeletePalette((HPAL)M_PALETTEDATA->m_hPalette);
     }
-    return TRUE;
+    return true;
 } // end of wxPalette::FreeResource
 
 } // end of wxPalette::FreeResource
 
-bool wxPalette::Create(
-  int                               n
-, const unsigned char*              pRed
-, const unsigned char*              pGreen
-, const unsigned char*              pBlue
-)
+bool wxPalette::Create( int n,
+                        const unsigned char* pRed,
+                        const unsigned char* pGreen,
+                        const unsigned char* pBlue )
 {
     PULONG                          pualTable;
 
 {
     PULONG                          pualTable;
 
@@ -94,7 +88,7 @@ bool wxPalette::Create(
     m_refData = new wxPaletteRefData;
     pualTable = new ULONG[n];
     if (!pualTable)
     m_refData = new wxPaletteRefData;
     pualTable = new ULONG[n];
     if (!pualTable)
-        return(FALSE);
+        return false;
 
     for (int i = 0; i < n; i ++)
     {
 
     for (int i = 0; i < n; i ++)
     {
@@ -107,25 +101,23 @@ bool wxPalette::Create(
                                                                ,pualTable
                                                               );
     delete [] pualTable;
                                                                ,pualTable
                                                               );
     delete [] pualTable;
-    return TRUE;
+    return true;
 } // end of wxPalette::Create
 
 } // end of wxPalette::Create
 
-int wxPalette::GetPixel(
-  const unsigned char               cRed
-, const unsigned char               cGreen
-, const unsigned char               cBlue
-) const
+int wxPalette::GetPixel( unsigned char cRed,
+                         unsigned char cGreen,
+                         unsigned char cBlue) const
 {
 {
-    bool                            bFound = FALSE;
-    PULONG                          pualTable = NULL;
-    ULONG                           ulNumEntries;
-    ULONG                           ulRGB = (PC_RESERVED * 16777216) +
-                                            ((int)cRed * 65536) +
-                                            ((int)cGreen * 256) +
-                                             (int)cBlue;
+    bool    bFound = false;
+    PULONG  pualTable = NULL;
+    ULONG   ulNumEntries;
+    ULONG   ulRGB = (PC_RESERVED * 16777216) +
+                    ((int)cRed * 65536) +
+                    ((int)cGreen * 256) +
+                    (int)cBlue;
 
     if (!m_refData)
 
     if (!m_refData)
-        return FALSE;
+        return wxNOT_FOUND;
 
     //
     // Get number of entries first
 
     //
     // Get number of entries first
@@ -153,36 +145,34 @@ int wxPalette::GetPixel(
     //
     // Now loop through and find the matching entry
     //
     //
     // Now loop through and find the matching entry
     //
-    ULONG                           i;
+    ULONG i;
     for (i = 0; i < ulNumEntries; i++)
     {
         if (pualTable[i] == ulRGB)
         {
     for (i = 0; i < ulNumEntries; i++)
     {
         if (pualTable[i] == ulRGB)
         {
-            bFound = TRUE;
+            bFound = true;
             break;
         }
     }
     if (!bFound)
             break;
         }
     }
     if (!bFound)
-        return 0;
+        return wxNOT_FOUND;
     return (i + 1);
 } // end of wxPalette::GetPixel
 
     return (i + 1);
 } // end of wxPalette::GetPixel
 
-bool wxPalette::GetRGB(
-  int                               nIndex
-, unsigned char*                    pRed
-, unsigned char*                    pGreen
-, unsigned char*                    pBlue
-) const
+bool wxPalette::GetRGB( int nIndex,
+                        unsigned char* pRed,
+                        unsigned char* pGreen,
+                        unsigned char* pBlue) const
 {
     PULONG                          pualTable = NULL;
     RGB2                            vRGB;
     ULONG                           ulNumEntries;
 
     if (!m_refData)
 {
     PULONG                          pualTable = NULL;
     RGB2                            vRGB;
     ULONG                           ulNumEntries;
 
     if (!m_refData)
-        return FALSE;
+        return false;
 
     if (nIndex < 0 || nIndex > 255)
 
     if (nIndex < 0 || nIndex > 255)
-        return FALSE;
+        return false;
     //
     // Get number of entries first
     //
     //
     // Get number of entries first
     //
@@ -211,7 +201,7 @@ bool wxPalette::GetRGB(
     *pBlue  = vRGB.bBlue;
     *pGreen = vRGB.bGreen;
     *pRed   = vRGB.bRed;
     *pBlue  = vRGB.bBlue;
     *pGreen = vRGB.bGreen;
     *pRed   = vRGB.bRed;
-    return TRUE;
+    return true;
 } // end of wxPalette::GetRGB
 
 void wxPalette::SetHPALETTE(
 } // end of wxPalette::GetRGB
 
 void wxPalette::SetHPALETTE(
@@ -234,4 +224,3 @@ void wxPalette::SetPS(
     ::GpiSelectPalette(M_PALETTEDATA->m_hPS, M_PALETTEDATA->m_hPalette);
     M_PALETTEDATA->m_hPS = hPS;
 } // end of wxPalette::SetHPALETTE
     ::GpiSelectPalette(M_PALETTEDATA->m_hPS, M_PALETTEDATA->m_hPalette);
     M_PALETTEDATA->m_hPS = hPS;
 } // end of wxPalette::SetHPALETTE
-