Add bool return value for wxDC::GetClippingBox()

Determining whether there is an actual clipping region or not is not
that simple, as shown by the recent problems in wxDCClipper code, so
return a boolean value indicating this from GetClippingBox() directly,
instead of requiring the caller to find it out on their own.

This simplifies wxDCClipper code, as well as any other code calling
GetClippingBox(), at the price of some extra complexity in wxDCImpl
itself, which seems to be worth it.
This commit is contained in:
Vadim Zeitlin
2018-06-18 14:39:11 +02:00
parent 119dce5eb8
commit 350867939a
3 changed files with 111 additions and 28 deletions

View File

@@ -764,8 +764,30 @@ public:
@remarks
Clipping region is given in logical coordinates.
@param x If non-@NULL, filled in with the logical horizontal coordinate
of the top left corner of the clipping region if the function
returns true or 0 otherwise.
@param y If non-@NULL, filled in with the logical vertical coordinate
of the top left corner of the clipping region if the function
returns true or 0 otherwise.
@param width If non-@NULL, filled in with the width of the clipping
region if the function returns true or the device context width
otherwise.
@param height If non-@NULL, filled in with the height of the clipping
region if the function returns true or the device context height
otherwise.
@return @true if there is a clipping region or @false if there is no
active clipping region (note that this return value is available
only since wxWidgets 3.1.2, this function didn't return anything in
the previous versions).
*/
void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height) const;
bool GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height) const;
/**
@overload
*/
bool GetClippingBox(wxRect& rect) const;
/**
Sets the clipping region for this device context to the intersection of