X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/87d3576fdc86ca3dfdece3c2d6df3f449a22670e..ac3688c0d8a39d200f0556ad4b401d89b45ff04a:/src/msw/dc.cpp diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 4c4e2768ac..1db02a2c57 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -28,7 +28,6 @@ #include "wx/msw/wrapcdlg.h" #include "wx/image.h" #include "wx/window.h" - #include "wx/dc.h" #include "wx/utils.h" #include "wx/dialog.h" #include "wx/app.h" @@ -40,6 +39,7 @@ #include "wx/module.h" #endif +#include "wx/msw/dc.h" #include "wx/sysopt.h" #include "wx/dynlib.h" @@ -84,9 +84,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxMSWDCImpl, wxDCImpl) static const int VIEWPORT_EXTENT = 1000; -static const int MM_POINTS = 9; -static const int MM_METRIC = 10; - // ROPs which don't have standard names (see "Ternary Raster Operations" in the // MSDN docs for how this and other numbers in wxDC::Blit() are obtained) #define DSTCOPY 0x00AA0029 // a.k.a. NOP operation @@ -282,7 +279,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxGDIDLLsCleanupModule, wxModule) wxColourChanger::wxColourChanger(wxMSWDCImpl& dc) : m_dc(dc) { const wxBrush& brush = dc.GetBrush(); - if ( brush.IsOk() && brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) + if ( brush.IsOk() && brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE ) { HDC hdc = GetHdcOf(dc); m_colFgOld = ::GetTextColor(hdc); @@ -303,8 +300,8 @@ wxColourChanger::wxColourChanger(wxMSWDCImpl& dc) : m_dc(dc) } SetBkMode(hdc, - dc.GetBackgroundMode() == wxTRANSPARENT ? TRANSPARENT - : OPAQUE); + dc.GetBackgroundMode() == wxBRUSHSTYLE_TRANSPARENT + ? TRANSPARENT : OPAQUE); // flag which telsl us to undo changes in the dtor m_changed = true; @@ -743,7 +740,7 @@ void wxMSWDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord xxx2 = (wxCoord) (xxc+ray); wxCoord yyy2 = (wxCoord) (yyc+ray); - if ( m_brush.IsOk() && m_brush.GetStyle() != wxTRANSPARENT ) + if ( m_brush.IsOk() && m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT ) { // Have to add 1 to bottom-right corner of rectangle // to make semi-circles look right (crooked line otherwise). @@ -779,7 +776,7 @@ void wxMSWDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, rect.bottom = y2; #ifdef __WXWINCE__ - DrawFrameControl(GetHdc(), &rect, DFC_BUTTON, DFCS_BUTTONCHECK); + DrawFrameControl(GetHdc(), &rect, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_CHECKED); #else DrawFrameControl(GetHdc(), &rect, DFC_MENU, DFCS_MENUCHECK); #endif @@ -860,7 +857,7 @@ wxMSWDCImpl::DoDrawPolyPolygon(int n, int fillStyle) { #ifdef __WXWINCE__ - wxDCBase::DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); + wxDCImpl::DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); #else WXMICROWIN_CHECK_HDC @@ -951,7 +948,7 @@ void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h // (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 #ifndef __WXWINCE__ - if ( m_pen.GetStyle() == wxTRANSPARENT ) + if ( m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) { x2dev++; y2dev++; @@ -985,7 +982,7 @@ void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wx // 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_pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) { x2++; y2++; @@ -1018,7 +1015,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points) { #ifdef __WXWINCE__ // WinCE does not support ::PolyBezier so use generic version - wxDCBase::DoDrawSpline(points); + wxDCImpl::DoDrawSpline(points); #else // quadratic b-spline to cubic bezier spline conversion // @@ -1141,13 +1138,13 @@ void wxMSWDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,doub // Swap start and end positions if the end angle is less than the start angle. if (ea < sa) { - int temp; - temp = rx2; - rx2 = rx1; - rx1 = temp; - temp = ry2; - ry2 = ry1; - ry1 = temp; + int temp; + temp = rx2; + rx2 = rx1; + rx1 = temp; + temp = ry2; + ry2 = ry1; + ry1 = temp; } // draw pie with NULL_PEN first and then outline otherwise a line is @@ -1352,7 +1349,7 @@ void wxMSWDCImpl::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) old_background = SetBkColor(GetHdc(), m_textBackgroundColour.GetPixel() ); } - SetBkMode(GetHdc(), m_backgroundMode == wxTRANSPARENT ? TRANSPARENT + SetBkMode(GetHdc(), m_backgroundMode == wxBRUSHSTYLE_TRANSPARENT ? TRANSPARENT : OPAQUE); #ifdef __WXWINCE__ @@ -1890,7 +1887,6 @@ void wxMSWDCImpl::RealizeScaleAndOrigin() ::SetViewportOrgEx(GetHdc(), m_deviceOriginX, m_deviceOriginY, NULL); ::SetWindowOrgEx(GetHdc(), m_logicalOriginX, m_logicalOriginY, NULL); #endif - } void wxMSWDCImpl::SetMapMode(int mode) @@ -2032,23 +2028,23 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, WXMICROWIN_CHECK_HDC_RET(false) - wxDCImpl *impl = source->GetImpl(); - wxMSWDCImpl *msw_impl = wxDynamicCast( impl, wxMSWDCImpl ); - if (!msw_impl) + wxMSWDCImpl *implSrc = wxDynamicCast( source->GetImpl(), wxMSWDCImpl ); + if ( !implSrc ) { - // TODO: Do we want to be able to blit - // from other DCs too? + // TODO: Do we want to be able to blit from other DCs too? return false; } + const HDC hdcSrc = GetHdcOf(*implSrc); + // if either the source or destination has alpha channel, we must use // AlphaBlt() as other function don't handle it correctly - const wxBitmap& bmpSrc = msw_impl->GetSelectedBitmap(); + const wxBitmap& bmpSrc = implSrc->GetSelectedBitmap(); if ( bmpSrc.IsOk() && (bmpSrc.HasAlpha() || (m_selectedBitmap.IsOk() && m_selectedBitmap.HasAlpha())) ) { if ( AlphaBlt(GetHdc(), xdest, ydest, dstWidth, dstHeight, - xsrc, ysrc, srcWidth, srcHeight, GetHdcOf(*msw_impl), bmpSrc) ) + xsrc, ysrc, srcWidth, srcHeight, hdcSrc, bmpSrc) ) return true; } @@ -2128,7 +2124,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, ( GetHdc(), xdest, ydest, dstWidth, dstHeight, - GetHdcOf(*msw_impl), + hdcSrc, xsrc, ysrc, (HBITMAP)mask->GetMaskBitmap(), xsrcMask, ysrcMask, @@ -2147,7 +2143,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, #if wxUSE_DC_CACHEING // create a temp buffer bitmap and DCs to access it and the mask - wxDCCacheEntry* dcCacheEntry1 = FindDCInCache(NULL, msw_impl->GetHDC()); + wxDCCacheEntry* dcCacheEntry1 = FindDCInCache(NULL, hdcSrc); dc_mask = (HDC) dcCacheEntry1->m_dc; wxDCCacheEntry* dcCacheEntry2 = FindDCInCache(dcCacheEntry1, GetHDC()); @@ -2159,7 +2155,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, buffer_bmap = (HBITMAP) bitmapCacheEntry->m_bitmap; #else // !wxUSE_DC_CACHEING // create a temp buffer bitmap and DCs to access it and the mask - dc_mask = ::CreateCompatibleDC(GetHdcOf(*source)); + dc_mask = ::CreateCompatibleDC(hdcSrc); dc_buffer = ::CreateCompatibleDC(GetHdc()); buffer_bmap = ::CreateCompatibleBitmap(GetHdc(), dstWidth, dstHeight); #endif // wxUSE_DC_CACHEING/!wxUSE_DC_CACHEING @@ -2179,7 +2175,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, // copy src to buffer using selected raster op if ( !::StretchBlt(dc_buffer, 0, 0, (int)dstWidth, (int)dstHeight, - GetHdcOf(*msw_impl), xsrc, ysrc, srcWidth, srcHeight, dwRop) ) + hdcSrc, xsrc, ysrc, srcWidth, srcHeight, dwRop) ) { wxLogLastError(wxT("StretchBlt")); } @@ -2290,7 +2286,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, ( GetHdc(), xdest, ydest, dstWidth, dstHeight, - GetHdcOf(*msw_impl), + hdcSrc, xsrc, ysrc, srcWidth, srcHeight, dwRop ) ) @@ -2310,7 +2306,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, GetHdc(), xdest, ydest, (int)dstWidth, (int)dstHeight, - GetHdcOf(*msw_impl), + hdcSrc, xsrc, ysrc, dwRop ) )