X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2970ae54d3ac3989cd47180229bc7d6cc0f65f51..03a126c68c940c13a7a6c9ee183fa88e9b575a21:/src/common/dcbase.cpp?ds=sidebyside diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 249af182a6..9f28a5f0ad 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -513,12 +513,12 @@ wxCoord wxImplDC::DeviceToLogicalYRel(wxCoord y) const wxCoord wxImplDC::LogicalToDeviceX(wxCoord x) const { - return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX + m_deviceLocalOriginX; + return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX * m_signY + m_deviceLocalOriginX; } wxCoord wxImplDC::LogicalToDeviceY(wxCoord y) const { - return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY + m_deviceLocalOriginY; + return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY * m_signY + m_deviceLocalOriginY; } wxCoord wxImplDC::LogicalToDeviceXRel(wxCoord x) const @@ -601,6 +601,7 @@ void wxImplDC::SetDeviceLocalOrigin( wxCoord x, wxCoord y ) void wxImplDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) { // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there + // wxWidgets 2.9: no longer override it m_signX = (xLeftRight ? 1 : -1); m_signY = (yBottomUp ? -1 : 1); ComputeScaleAndOrigin(); @@ -1302,7 +1303,7 @@ void wxImplDC::DoGradientFillLinear(const wxRect& rect, SetPen(wxPen(colour, 1, wxSOLID)); SetBrush(wxBrush(colour)); if(nDirection == wxEAST) - DoDrawRectangle(rect.GetRight()-x-xDelta, rect.GetTop(), + DoDrawRectangle(rect.GetRight()-x-xDelta+1, rect.GetTop(), xDelta, rect.GetHeight()); else //nDirection == wxWEST DoDrawRectangle(rect.GetLeft()+x, rect.GetTop(), @@ -1342,7 +1343,7 @@ void wxImplDC::DoGradientFillLinear(const wxRect& rect, DoDrawRectangle(rect.GetLeft(), rect.GetTop()+y, rect.GetWidth(), yDelta); else //nDirection == wxSOUTH - DoDrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta, + DoDrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta+1, rect.GetWidth(), yDelta); } } @@ -1706,6 +1707,7 @@ void wxDCBase::SetDeviceLocalOrigin( wxCoord x, wxCoord y ) void wxDCBase::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) { // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there + // wxWidgets 2.9: no longer override it m_signX = (xLeftRight ? 1 : -1); m_signY = (yBottomUp ? -1 : 1); ComputeScaleAndOrigin(); @@ -2172,9 +2174,9 @@ void wxDCBase::GetMultiLineTextExtent(const wxString& text, heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; wxString curLine; - for ( const wxChar *pc = text; ; pc++ ) + for ( wxString::const_iterator pc = text.begin(); ; ++pc ) { - if ( *pc == _T('\n') || *pc == _T('\0') ) + if ( pc == text.end() || *pc == _T('\n') ) { if ( curLine.empty() ) { @@ -2205,14 +2207,13 @@ void wxDCBase::GetMultiLineTextExtent(const wxString& text, heightTextTotal += heightLine; } - if ( *pc == _T('\n') ) + if ( pc == text.end() ) { - curLine.clear(); + break; } - else + else // '\n' { - // the end of string - break; + curLine.clear(); } } else @@ -2303,7 +2304,7 @@ void wxDCBase::DrawLabel(const wxString& text, wxString curLine; for ( wxString::const_iterator pc = text.begin(); ; ++pc ) { - if ( *pc == _T('\n') || pc == text.end() ) + if ( pc == text.end() || *pc == _T('\n') ) { int xRealStart = x; // init it here to avoid compielr warnings @@ -2433,7 +2434,7 @@ void wxDCBase::DoGradientFillLinear(const wxRect& rect, SetPen(wxPen(colour, 1, wxSOLID)); SetBrush(wxBrush(colour)); if(nDirection == wxEAST) - DrawRectangle(rect.GetRight()-x-xDelta, rect.GetTop(), + DrawRectangle(rect.GetRight()-x-xDelta+1, rect.GetTop(), xDelta, rect.GetHeight()); else //nDirection == wxWEST DrawRectangle(rect.GetLeft()+x, rect.GetTop(), @@ -2473,7 +2474,7 @@ void wxDCBase::DoGradientFillLinear(const wxRect& rect, DrawRectangle(rect.GetLeft(), rect.GetTop()+y, rect.GetWidth(), yDelta); else //nDirection == wxSOUTH - DrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta, + DrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta+1, rect.GetWidth(), yDelta); } }