+// When we're using GDI+, the DC might have transforms applied to it,
+// but the renderer APIs don't respect them. So we need to apply
+// the transforms to the rect ourselves.
+inline
+wxRect applyGDIPlusTransformsToRect(wxDC& dc, const wxRect& r)
+{
+ wxRect rect = r;
+#if wxUSE_GRAPHICS_CONTEXT
+ wxGCDC* gcdc = dynamic_cast<wxGCDC*>(&dc);
+ if (gcdc)
+ {
+ double xtrans = 0;
+ double ytrans = 0;
+ wxGraphicsContext* gc = gcdc->GetGraphicsContext();
+ gc->GetTransform().TransformPoint(&xtrans, &ytrans);
+ rect.x = rect.x + (int)xtrans;
+ rect.y = rect.y + (int)ytrans;
+ }
+#endif
+ return rect;
+}
+