+ if (m_logicalFunction == wxXOR)
+ {
+ XGCValues values;
+ XGetGCValues ((Display*) m_display, (GC) m_gc, GCBackground, &values);
+ XSetForeground ((Display*) m_display, (GC) m_gc,
+ pixel ^ values.background);
+ if (m_window && m_window->GetBackingPixmap())
+ XSetForeground ((Display*) m_display,(GC) m_gcBacking,
+ pixel ^ values.background);
+ }
+ else
+ {
+ XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
+ if (m_window && m_window->GetBackingPixmap())
+ XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel);
+ }
+}
+
+WXPixel wxWindowDCImpl::CalculatePixel(wxColour& colour, wxColour& curCol,
+ bool roundToWhite) const
+{
+ const unsigned char wp = (unsigned char)255;
+
+ WXPixel pixel = -1;
+ if(!m_colour) // Mono display
+ {
+ unsigned char red = colour.Red ();
+ unsigned char blue = colour.Blue ();
+ unsigned char green = colour.Green ();
+ // white
+ if((red == wp && blue == wp && green == wp) ||
+ // not black and roundToWhite was specified
+ ((red != 0 || blue != 0 || green != 0) && roundToWhite))
+ {
+ curCol = *wxWHITE;
+ pixel = WhitePixel((Display*) m_display,
+ DefaultScreen((Display*) m_display));
+ curCol.SetPixel(pixel);
+ colour.SetPixel(pixel);
+ }
+ else
+ {
+ curCol = *wxBLACK;
+ pixel = BlackPixel((Display*) m_display,
+ DefaultScreen((Display*) m_display));
+ curCol.SetPixel(pixel);
+ colour.SetPixel(pixel);
+ }
+ }
+ else
+ {
+ curCol = colour;
+ pixel = colour.AllocColour((Display*) m_display);
+ curCol.SetPixel(pixel);
+ }
+
+ return pixel;
+}
+
+void wxWindowDCImpl::SetPen( const wxPen &pen )
+{
+ wxCHECK_RET( IsOk(), "invalid dc" );