X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cd9da200285e3c625be91768c9ca61dc218c94d0..5d25c05039a7c6ebbddfe16d99234dc756e75356:/src/msw/dc.cpp?ds=sidebyside diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index f339b4dafe..354c617418 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -318,12 +318,15 @@ bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const // get the color of the pixel COLORREF pixelcolor = ::GetPixel(GetHdc(), XLOG2DEV(x), YLOG2DEV(y)); + // JACS: what was this for? +#if 0 // get the color of the pen COLORREF pencolor = 0x00ffffff; if (m_pen.Ok()) { pencolor = m_pen.GetColour().GetPixel(); } +#endif // return the color of the pixel if( col ) @@ -335,7 +338,10 @@ bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const // check, if color of the pixels is the same as the color of the current // pen and return TRUE if it is, FALSE otherwise - return pixelcolor == pencolor; + // JACS, 24/02/2000: can't understand the reason for this, so returning TRUE instead. + // return pixelcolor == pencolor; + + return TRUE; } void wxDC::DoCrossHair(wxCoord x, wxCoord y) @@ -360,8 +366,9 @@ void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) (void)MoveToEx(GetHdc(), XLOG2DEV(x1), YLOG2DEV(y1), NULL); (void)LineTo(GetHdc(), XLOG2DEV(x2), YLOG2DEV(y2)); - // Normalization: Windows doesn't draw the last point of the line - (void)LineTo(GetHdc(), XLOG2DEV(x2) + 1, YLOG2DEV(y2)); + // Normalization: Windows doesn't draw the last point of the line. + // But apparently neither does GTK+, so we take it out again. +// (void)LineTo(GetHdc(), XLOG2DEV(x2) + 1, YLOG2DEV(y2)); CalcBoundingBox(x1, y1); CalcBoundingBox(x2, y2); @@ -427,8 +434,8 @@ void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, // In WIN16, draw a cross HPEN blackPen = ::CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); HPEN whiteBrush = (HPEN)::GetStockObject(WHITE_BRUSH); - HPEN hPenOld = (HPEN)::SelectObject(hdcMem, blackPen); - HPEN hBrushOld = (HPEN)::SelectObject(hdcMem, whiteBrush); + HPEN hPenOld = (HPEN)::SelectObject(GetHdc(), blackPen); + HPEN hBrushOld = (HPEN)::SelectObject(GetHdc(), whiteBrush); ::SetROP2(GetHdc(), R2_COPYPEN); Rectangle(GetHdc(), x1, y1, x2, y2); MoveTo(GetHdc(), x1, y1); @@ -575,16 +582,31 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxCoord x2 = x + width; wxCoord y2 = y + height; - // Windows draws the filled rectangles without outline (i.e. drawn with a - // transparent pen) one pixel smaller in both directions and we want them - // to have the same size regardless of which pen is used - adjust - if ( m_pen.GetStyle() == wxTRANSPARENT ) + if ((m_logicalFunction == wxCOPY) && (m_pen.GetStyle() == wxTRANSPARENT)) { - x2++; - y2++; + RECT rect; + rect.left = XLOG2DEV(x); + rect.top = YLOG2DEV(y); + rect.right = XLOG2DEV(x2); + rect.bottom = YLOG2DEV(y2); + (void)FillRect(GetHdc(), &rect, (HBRUSH)m_brush.GetResourceHandle() ); + } + else + { + // Windows draws the filled rectangles without outline (i.e. drawn with a + // transparent pen) one pixel smaller in both directions and we want them + // to have the same size regardless of which pen is used - adjust + + // I wonder if this shouldn´t be done after the LOG2DEV() conversions. RR. + if ( m_pen.GetStyle() == wxTRANSPARENT ) + { + x2++; + y2++; + } + + (void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2)); } - (void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2)); CalcBoundingBox(x, y); CalcBoundingBox(x2, y2);