Fix retrieving bounding box coordinates
Bounding box coordinates have to be calculated and stored internally in device units to be independent on changes of logical coordinates between calls to wxDC::CalcBoundingBox. These stored coordinates are converted to the logical units on demand when they are retrieved with call to wxDC::MinX, MinY, MaxX or MaxY. Closes #17667.
This commit is contained in:
@@ -105,6 +105,7 @@ All (GUI):
|
|||||||
- Add wxGraphicsContext::Flush() for Cairo renderer.
|
- Add wxGraphicsContext::Flush() for Cairo renderer.
|
||||||
- Add wxStyledTextEvent::GetListCompletionMethod() (NewPagodi).
|
- Add wxStyledTextEvent::GetListCompletionMethod() (NewPagodi).
|
||||||
- Add wxEVT_STC_AUTOCOMP_COMPLETED event (NewPagodi).
|
- Add wxEVT_STC_AUTOCOMP_COMPLETED event (NewPagodi).
|
||||||
|
- Fix retrieving bounding box for wxDC with transformed coordinates.
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -325,6 +325,9 @@ public:
|
|||||||
|
|
||||||
virtual void CalcBoundingBox(wxCoord x, wxCoord y)
|
virtual void CalcBoundingBox(wxCoord x, wxCoord y)
|
||||||
{
|
{
|
||||||
|
// Bounding box is internally stored in device units.
|
||||||
|
x = LogicalToDeviceX(x);
|
||||||
|
y = LogicalToDeviceY(y);
|
||||||
if ( m_isBBoxValid )
|
if ( m_isBBoxValid )
|
||||||
{
|
{
|
||||||
if ( x < m_minX ) m_minX = x;
|
if ( x < m_minX ) m_minX = x;
|
||||||
@@ -349,10 +352,11 @@ public:
|
|||||||
m_minX = m_maxX = m_minY = m_maxY = 0;
|
m_minX = m_maxX = m_minY = m_maxY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord MinX() const { return m_minX; }
|
// Get bounding box in logical units.
|
||||||
wxCoord MaxX() const { return m_maxX; }
|
wxCoord MinX() const { return m_isBBoxValid ? DeviceToLogicalX(m_minX) : 0; }
|
||||||
wxCoord MinY() const { return m_minY; }
|
wxCoord MaxX() const { return m_isBBoxValid ? DeviceToLogicalX(m_maxX) : 0; }
|
||||||
wxCoord MaxY() const { return m_maxY; }
|
wxCoord MinY() const { return m_isBBoxValid ? DeviceToLogicalY(m_minY) : 0; }
|
||||||
|
wxCoord MaxY() const { return m_isBBoxValid ? DeviceToLogicalY(m_maxY) : 0; }
|
||||||
|
|
||||||
// setters and getters
|
// setters and getters
|
||||||
|
|
||||||
@@ -712,8 +716,8 @@ protected:
|
|||||||
m_mm_to_pix_y;
|
m_mm_to_pix_y;
|
||||||
|
|
||||||
// bounding and clipping boxes
|
// bounding and clipping boxes
|
||||||
wxCoord m_minX, m_minY, m_maxX, m_maxY;
|
wxCoord m_minX, m_minY, m_maxX, m_maxY; // Bounding box is stored in device units.
|
||||||
wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2;
|
wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; // Clipping box is stored in logical units.
|
||||||
|
|
||||||
wxRasterOperationMode m_logicalFunction;
|
wxRasterOperationMode m_logicalFunction;
|
||||||
int m_backgroundMode;
|
int m_backgroundMode;
|
||||||
|
Reference in New Issue
Block a user