From cc41ddf62a926b26065a796739c572fd26eae8d4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 7 Jul 2019 03:18:18 +0200 Subject: [PATCH] Document wxGCDC::SetGraphicsContext() difference from ctor Document the discrepancy between constructing wxGCDC from wxGraphicsContext directly or default-constructing it and calling SetGraphicsContext() later. Current behaviour is somewhat inconsistent, but useful, because it allows to draw on wxGraphicsContext using wxDC API using any kind of pen and brush, even those not supported by this API, while remaining backwards-compatible (i.e. we can't change SetGraphicsContext() to not re-apply font, pen and brush, as this would break any existing code relying on this happening), so it seems like the best alternative. --- interface/wx/dcgraph.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface/wx/dcgraph.h b/interface/wx/dcgraph.h index 197f0e5a9b..dc2bbe3be8 100644 --- a/interface/wx/dcgraph.h +++ b/interface/wx/dcgraph.h @@ -100,6 +100,11 @@ public: Note that this object takes ownership of @a context and will delete it when it is destroyed or when SetGraphicsContext() is called again. + + Also, unlike the constructor taking wxGraphicsContext, this method will + reapply the current font, pen and brush, so that this object continues + to use them, if they had been changed before (which is never the case + when constructing wxGCDC directly from wxGraphicsContext). */ void SetGraphicsContext(wxGraphicsContext* context);