+// Helpers for efficiency
+
+inline void wxCheckSetFont(wxDC& dc, const wxFont& font)
+{
+ const wxFont& font1 = dc.GetFont();
+ if (font1.IsOk() && font.IsOk())
+ {
+ if (font1.GetPointSize() == font.GetPointSize() &&
+ font1.GetFamily() == font.GetFamily() &&
+ font1.GetStyle() == font.GetStyle() &&
+ font1.GetWeight() == font.GetWeight() &&
+ font1.GetFaceName() == font.GetFaceName())
+ return;
+ }
+ dc.SetFont(font);
+}
+
+inline void wxCheckSetPen(wxDC& dc, const wxPen& pen)
+{
+ const wxPen& pen1 = dc.GetPen();
+ if (pen1.IsOk() && pen.IsOk())
+ {
+ if (pen1.GetWidth() == pen.GetWidth() &&
+ pen1.GetStyle() == pen.GetStyle() &&
+ pen1.GetColour() == pen.GetColour())
+ return;
+ }
+ dc.SetPen(pen);
+}
+
+inline void wxCheckSetBrush(wxDC& dc, const wxBrush& brush)
+{
+ const wxBrush& brush1 = dc.GetBrush();
+ if (brush1.IsOk() && brush.IsOk())
+ {
+ if (brush1.GetStyle() == brush.GetStyle() &&
+ brush1.GetColour() == brush.GetColour())
+ return;
+ }
+ dc.SetBrush(brush);
+}
+