X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/670f9935630beb2123a5ca62894ae92a3f0efa4f..13b4df952c77383f50696e51fcbaa2d8bbd3b3b9:/src/motif/colour.cpp diff --git a/src/motif/colour.cpp b/src/motif/colour.cpp index 657bf6b849..05d1a89e9b 100644 --- a/src/motif/colour.cpp +++ b/src/motif/colour.cpp @@ -19,10 +19,9 @@ #ifndef WX_PRECOMP #include "wx/app.h" + #include "wx/gdicmn.h" #endif -#include "wx/gdicmn.h" - #ifdef __VMS__ #pragma message disable nosimpint #endif @@ -33,16 +32,14 @@ #include "wx/motif/private.h" -IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) +wxCOMPILE_TIME_ASSERT( sizeof(WXPixel) == sizeof(Pixel), PixelSizeIsOk ); // Colour void wxColour::Init() { m_isInit = false; - m_red = - m_blue = - m_green = 0; + m_red = m_blue = m_green = 0; m_pixel = -1; } @@ -65,7 +62,8 @@ wxColour::~wxColour() { } -void wxColour::InitWith(unsigned char r, unsigned char g, unsigned char b) +void wxColour::InitRGBA(unsigned char r, unsigned char g, unsigned char b, + unsigned char WXUNUSED(a)) { m_red = r; m_green = g; @@ -82,7 +80,7 @@ void wxColour::InitWith(unsigned char r, unsigned char g, unsigned char b) // TODO: can this handle mono displays? If not, we should have an extra // flag to specify whether this should be black or white by default. -int wxColour::AllocColour(WXDisplay* display, bool realloc) +WXPixel wxColour::AllocColour(WXDisplay* display, bool realloc) { if ((m_pixel != -1) && !realloc) return m_pixel; @@ -106,7 +104,7 @@ int wxColour::AllocColour(WXDisplay* display, bool realloc) } else { - m_pixel = (int) color.pixel; + m_pixel = (WXPixel) color.pixel; return m_pixel; } } @@ -141,14 +139,14 @@ A read-only colour will not change. may give better matching. -------------------------------------------*/ -int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap) +WXPixel wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap) { if (cmap == (Colormap) NULL) cmap = (Colormap) wxTheApp->GetMainColormap(display); int numPixVals = XDisplayCells(display, DefaultScreen (display)); int mindist = 256 * 256 * 3; - int bestpixel = (int) BlackPixel (display, DefaultScreen (display)); + Pixel bestpixel = BlackPixel (display, DefaultScreen (display)); int red = desiredColor->red >> 8; int green = desiredColor->green >> 8; int blue = desiredColor->blue >> 8;