#include "wx/sysopt.h"
#include "wx/dynlib.h"
-#ifdef wxHAVE_RAW_BITMAP
+#ifdef wxHAS_RAW_BITMAP
#include "wx/rawbmp.h"
#endif
HDC hdcSrc,
const wxBitmap& bmp);
-#ifdef wxHAVE_RAW_BITMAP
+#ifdef wxHAS_RAW_BITMAP
// our (limited) AlphaBlend() replacement for Windows versions not providing it
static void
int srcWidth, int srcHeight,
const wxBitmap& bmpSrc);
-#endif // wxHAVE_RAW_BITMAP
+#endif // wxHAS_RAW_BITMAP
// ----------------------------------------------------------------------------
// private classes
wxDCImpl::DoGetClippingBox(x, y, w, h);
}
-// common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion()
+// common part of DoSetClippingRegion() and DoSetDeviceClippingRegion()
void wxMSWDCImpl::SetClippingHrgn(WXHRGN hrgn)
{
wxCHECK_RET( hrgn, wxT("invalid clipping region") );
}
}
-void wxMSWDCImpl::DoSetClippingRegionAsRegion(const wxRegion& region)
+void wxMSWDCImpl::DoSetDeviceClippingRegion(const wxRegion& region)
{
SetClippingHrgn(region.GetHRGN());
}
wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
- wxCoord x2 = (x+width);
- wxCoord y2 = (y+height);
+ // +1 below makes the ellipse more similar to other platforms.
+ // In particular, DoDrawEllipse(x,y,1,1) should draw one point.
+ wxCoord x2 = x + width + 1;
+ wxCoord y2 = y + height + 1;
- (void)Ellipse(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2));
+ // Problem: Windows GDI Ellipse() with x2-x == y2-y == 3 and transparent
+ // pen doesn't draw anything. Should we provide a workaround?
+
+ ::Ellipse(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2));
CalcBoundingBox(x, y);
CalcBoundingBox(x2, y2);
}
-#if wxUSE_SPLINES
+#if wxUSE_SPLINES && !defined(__WXWINCE__)
void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
{
-#ifdef __WXWINCE__
- // WinCE does not support ::PolyBezier so use generic version
- wxDCImpl::DoDrawSpline(points);
-#else
// quadratic b-spline to cubic bezier spline conversion
//
// quadratic spline with control points P0,P1,P2
::PolyBezier( GetHdc(), lppt, bezier_pos );
free(lppt);
-#endif
}
-#endif
+#endif // wxUSE_SPLINES
// Chris Breeze 20/5/98: first implementation of DrawEllipticArc on Windows
void wxMSWDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
void wxMSWDCImpl::RealizeScaleAndOrigin()
{
- // VZ: it seems very wasteful to always use MM_ANISOTROPIC when in 99% of
- // cases we could do with MM_TEXT and in the remaining 0.9% with
- // MM_ISOTROPIC (TODO!)
+ // although it may seem wasteful to always use MM_ANISOTROPIC here instead
+ // of using MM_TEXT if there is no scaling, benchmarking doesn't detect any
+ // noticeable difference between these mapping modes
#ifndef __WXWINCE__
::SetMapMode(GetHdc(), MM_ANISOTROPIC);
wxDCImpl::SetLogicalOrigin( x, y );
-#ifndef __WXWINCE__
- ::SetWindowOrgEx(GetHdc(), (int)m_logicalOriginX, (int)m_logicalOriginY, NULL);
-#endif
+ RealizeScaleAndOrigin();
+}
+
+// For use by wxWidgets only, unless custom units are required.
+void wxMSWDCImpl::SetLogicalScale(double x, double y)
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxDCImpl::SetLogicalScale(x,y);
}
void wxMSWDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y)
return wxSize(x, y);
}
-// For use by wxWidgets only, unless custom units are required.
-void wxMSWDCImpl::SetLogicalScale(double x, double y)
-{
- WXMICROWIN_CHECK_HDC
-
- wxDCImpl::SetLogicalScale(x,y);
-}
-
// ----------------------------------------------------------------------------
// DC caching
// ----------------------------------------------------------------------------
// AlphaBlend() unavailable of failed: use our own (probably much slower)
// implementation
-#ifdef wxHAVE_RAW_BITMAP
+#ifdef wxHAS_RAW_BITMAP
wxAlphaBlend(hdcDst, x, y, dstWidth, dstHeight, srcX, srcY, srcWidth, srcHeight, bmp);
return true;
-#else // !wxHAVE_RAW_BITMAP
+#else // !wxHAS_RAW_BITMAP
// no wxAlphaBlend() neither, fall back to using simple BitBlt() (we lose
// alpha but at least something will be shown like this)
wxUnusedVar(bmp);
return false;
-#endif // wxHAVE_RAW_BITMAP
+#endif // wxHAS_RAW_BITMAP/!wxHAS_RAW_BITMAP
}
// wxAlphaBlend: our fallback if ::AlphaBlend() is unavailable
-#ifdef wxHAVE_RAW_BITMAP
+#ifdef wxHAS_RAW_BITMAP
static void
wxAlphaBlend(HDC hdcDst, int xDst, int yDst,
}
}
-#endif // #ifdef wxHAVE_RAW_BITMAP
+#endif // wxHAS_RAW_BITMAP
void wxMSWDCImpl::DoGradientFillLinear (const wxRect& rect,
const wxColour& initialColour,