X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad81651f00edc6f489d9b6a0839d316a964fd521..bbda1088f7995eec084f450141d1071052473106:/src/motif/dcclient.cpp diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index aa4970ddef..9fcfc8730a 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -134,7 +134,7 @@ wxWindowDC::wxWindowDC() m_currentPenWidth = 1; m_currentPenJoin = -1; m_currentPenDashCount = -1; - m_currentPenDash = (char*) NULL; + m_currentPenDash = (wxMOTIFDash*) NULL; m_currentStyle = -1; m_currentFill = -1; // m_currentBkMode = wxTRANSPARENT; @@ -159,7 +159,7 @@ wxWindowDC::wxWindowDC( wxWindow *window ) m_currentPenWidth = 1; m_currentPenJoin = -1; m_currentPenDashCount = -1; - m_currentPenDash = (char*) NULL; + m_currentPenDash = (wxMOTIFDash*) NULL; m_currentStyle = -1; m_currentFill = -1; // m_currentBkMode = wxTRANSPARENT; @@ -179,16 +179,17 @@ wxWindowDC::wxWindowDC( wxWindow *window ) gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.background = WhitePixel (display, DefaultScreen (display)); gcvalues.graphics_exposures = False; + gcvalues.subwindow_mode = IncludeInferiors; gcvalues.line_width = 1; m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)), - GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth, + GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); if (m_window->GetBackingPixmap()) { m_gcBacking = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)), - GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth, + GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); } @@ -235,11 +236,18 @@ void wxWindowDC::DoFloodFill( wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), wxFAIL_MSG("not implemented"); } -bool wxWindowDC::DoGetPixel( wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), wxColour *WXUNUSED(col) ) const +bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const { - wxFAIL_MSG("not implemented"); - - return FALSE; + // Generic (and therefore rather inefficient) method. + // Could be improved. + wxMemoryDC memdc; + wxBitmap bitmap(1, 1); + memdc.SelectObject(bitmap); + memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1); + memdc.SelectObject(wxNullBitmap); + wxImage image(bitmap); + col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0)); + return TRUE; } void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) @@ -315,7 +323,7 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo wxCoord dx = xx1 - xxc; wxCoord dy = yy1 - yyc; - double radius = sqrt (dx * dx + dy * dy); + double radius = sqrt ((double)(dx * dx + dy * dy)); wxCoord r = (wxCoord) radius; double radius1, radius2; @@ -1266,7 +1274,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, // draw black pixels, ignore white ones (i.e. transparent b/g) if (image.GetRed(sx, sy) == 0) { - DrawPoint(x1 + maxx - rx, cy + y1 - ry); + DrawPoint((wxCoord) (x1 + maxx - rx), (wxCoord) (cy + y1 - ry)); } else { @@ -1506,7 +1514,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) int old_pen_join = m_currentPenJoin; int old_pen_cap = m_currentPenCap; int old_pen_nb_dash = m_currentPenDashCount; - char *old_pen_dash = m_currentPenDash; + wxMOTIFDash *old_pen_dash = m_currentPenDash; wxColour oldPenColour = m_currentColour; m_currentColour = m_pen.GetColour (); @@ -1516,7 +1524,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) m_currentPenJoin = m_pen.GetJoin (); m_currentPenCap = m_pen.GetCap (); m_currentPenDashCount = m_pen.GetDashCount(); - m_currentPenDash = m_pen.GetDash(); + m_currentPenDash = (wxMOTIFDash*)m_pen.GetDash(); if (m_currentStyle == wxSTIPPLE) m_currentStipple = * m_pen.GetStipple (); @@ -1544,15 +1552,15 @@ void wxWindowDC::SetPen( const wxPen &pen ) int style; int join; int cap; - static const char dotted[] = {2, 5}; - static const char short_dashed[] = {4, 4}; - static const char long_dashed[] = {4, 8}; - static const char dotted_dashed[] = {6, 6, 2, 6}; + static const wxMOTIFDash dotted[] = {2, 5}; + static const wxMOTIFDash short_dashed[] = {4, 4}; + static const wxMOTIFDash long_dashed[] = {4, 8}; + static const wxMOTIFDash dotted_dashed[] = {6, 6, 2, 6}; // We express dash pattern in pen width unit, so we are // independent of zoom factor and so on... int req_nb_dash; - const char *req_dash; + const wxMOTIFDash *req_dash; switch (m_pen.GetStyle ()) { @@ -1586,13 +1594,13 @@ void wxWindowDC::SetPen( const wxPen &pen ) case wxTRANSPARENT: default: style = LineSolid; - req_dash = NULL; + req_dash = (wxMOTIFDash*)NULL; req_nb_dash = 0; } if (req_dash && req_nb_dash) { - char *real_req_dash = new char[req_nb_dash]; + wxMOTIFDash *real_req_dash = new wxMOTIFDash[req_nb_dash]; if (real_req_dash) { int factor = scaled_width == 0 ? 1 : scaled_width;