void wxColourRefData::AllocColour( GdkColormap *cmap ) { if (m_hasPixel && (m_colormap == cmap)) return; FreeColour(); #ifdef __WXGTK20__ if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) || (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) #else GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap; if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || (private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) #endif { m_hasPixel = gdk_colormap_alloc_color( cmap, &m_color, FALSE, TRUE ); int idx = m_color.pixel; colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] + 1; } else { m_hasPixel = gdk_color_alloc( cmap, &m_color ); } m_colormap = cmap; }
void wxColourRefData::AllocColour( GdkColormap *cmap ) { if (m_colormap != cmap) { FreeColour(); m_color.red = m_red; m_color.green = m_green; m_color.blue = m_blue; if (gdk_colormap_alloc_color(cmap, &m_color, FALSE, TRUE)) { m_colormap = cmap; } } }
void wxColourRefData::AllocColour( WXColormap cmap ) { if (m_hasPixel && (m_colormap == cmap)) return; FreeColour(); #if !wxUSE_NANOX if ((wxTheApp->m_visualInfo->m_visualType == GrayScale) || (wxTheApp->m_visualInfo->m_visualType == PseudoColor)) { m_hasPixel = XAllocColor( wxGlobalDisplay(), (Colormap) cmap, &m_color ); int idx = m_color.pixel; colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] + 1; } else #endif { m_hasPixel = XAllocColor( wxGlobalDisplay(), (Colormap) cmap, &m_color ); } m_colormap = cmap; }
virtual ~wxColourRefData() { FreeColour(); }
~wxColourRefData() { FreeColour(); }