fix warnings (double to int conversions and unused variables); removed hard TABs and extra spaces
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42180 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -50,7 +50,7 @@ static inline double DegToRad(double deg)
|
|||||||
|
|
||||||
wxPoint2DDouble wxGraphicsPath::GetCurrentPoint()
|
wxPoint2DDouble wxGraphicsPath::GetCurrentPoint()
|
||||||
{
|
{
|
||||||
wxDouble x,y ;
|
wxDouble x,y;
|
||||||
GetCurrentPoint(x,y);
|
GetCurrentPoint(x,y);
|
||||||
return wxPoint2DDouble(x,y);
|
return wxPoint2DDouble(x,y);
|
||||||
}
|
}
|
||||||
@@ -82,14 +82,14 @@ void wxGraphicsPath::AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble star
|
|||||||
void wxGraphicsPath::AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y )
|
void wxGraphicsPath::AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y )
|
||||||
{
|
{
|
||||||
// calculate using degree elevation to a cubic bezier
|
// calculate using degree elevation to a cubic bezier
|
||||||
wxPoint2DDouble c1 ;
|
wxPoint2DDouble c1;
|
||||||
wxPoint2DDouble c2 ;
|
wxPoint2DDouble c2;
|
||||||
|
|
||||||
wxPoint2DDouble start = GetCurrentPoint() ;
|
wxPoint2DDouble start = GetCurrentPoint();
|
||||||
wxPoint2DDouble end(x,y);
|
wxPoint2DDouble end(x,y);
|
||||||
wxPoint2DDouble c(cx,cy);
|
wxPoint2DDouble c(cx,cy);
|
||||||
c1 = wxDouble(1/3.0) * start + wxDouble(2/3.0) * c;
|
c1 = wxDouble(1/3.0) * start + wxDouble(2/3.0) * c;
|
||||||
c2 = wxDouble(2/3.0) * c + wxDouble(1/3.0) * end ;
|
c2 = wxDouble(2/3.0) * c + wxDouble(1/3.0) * end;
|
||||||
AddCurveToPoint(c1.m_x,c1.m_y,c2.m_x,c2.m_y,x,y);
|
AddCurveToPoint(c1.m_x,c1.m_y,c2.m_x,c2.m_y,x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,30 +116,30 @@ void wxGraphicsPath::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDo
|
|||||||
wxPoint2DDouble p1(x1,y1);
|
wxPoint2DDouble p1(x1,y1);
|
||||||
wxPoint2DDouble p2(x2,y2);
|
wxPoint2DDouble p2(x2,y2);
|
||||||
|
|
||||||
wxPoint2DDouble v1 = current - p1 ;
|
wxPoint2DDouble v1 = current - p1;
|
||||||
v1.Normalize();
|
v1.Normalize();
|
||||||
wxPoint2DDouble v2 = p2 - p1 ;
|
wxPoint2DDouble v2 = p2 - p1;
|
||||||
v2.Normalize();
|
v2.Normalize();
|
||||||
|
|
||||||
wxDouble alpha = v1.GetVectorAngle() - v2.GetVectorAngle();
|
wxDouble alpha = v1.GetVectorAngle() - v2.GetVectorAngle();
|
||||||
|
|
||||||
if ( alpha < 0 )
|
if ( alpha < 0 )
|
||||||
alpha = 360 + alpha ;
|
alpha = 360 + alpha;
|
||||||
// TODO obtuse angles
|
// TODO obtuse angles
|
||||||
|
|
||||||
alpha = DegToRad(alpha);
|
alpha = DegToRad(alpha);
|
||||||
|
|
||||||
wxDouble dist = r / sin(alpha/2) * cos(alpha/2) ;
|
wxDouble dist = r / sin(alpha/2) * cos(alpha/2);
|
||||||
// calculate tangential points
|
// calculate tangential points
|
||||||
wxPoint2DDouble t1 = dist*v1 + p1 ;
|
wxPoint2DDouble t1 = dist*v1 + p1;
|
||||||
wxPoint2DDouble t2 = dist*v2 + p1 ;
|
wxPoint2DDouble t2 = dist*v2 + p1;
|
||||||
|
|
||||||
wxPoint2DDouble nv1 = v1 ;
|
wxPoint2DDouble nv1 = v1;
|
||||||
nv1.SetVectorAngle(v1.GetVectorAngle()-90);
|
nv1.SetVectorAngle(v1.GetVectorAngle()-90);
|
||||||
wxPoint2DDouble c = t1 + r*nv1;
|
wxPoint2DDouble c = t1 + r*nv1;
|
||||||
|
|
||||||
wxDouble a1 = v1.GetVectorAngle()+90 ;
|
wxDouble a1 = v1.GetVectorAngle()+90;
|
||||||
wxDouble a2 = v2.GetVectorAngle()-90 ;
|
wxDouble a2 = v2.GetVectorAngle()-90;
|
||||||
|
|
||||||
AddLineToPoint(t1);
|
AddLineToPoint(t1);
|
||||||
AddArc(c.m_x,c.m_y,r,DegToRad(a1),DegToRad(a2),true);
|
AddArc(c.m_x,c.m_y,r,DegToRad(a1),DegToRad(a2),true);
|
||||||
@@ -158,17 +158,17 @@ void wxGraphicsContext::DrawPath( const wxGraphicsPath *path, int fillStyle )
|
|||||||
|
|
||||||
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
|
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
|
||||||
{
|
{
|
||||||
Translate(x,y) ;
|
Translate(x,y);
|
||||||
Rotate( -angle );
|
Rotate( -angle );
|
||||||
DrawText( str , 0, 0 );
|
DrawText( str , 0, 0 );
|
||||||
Rotate( angle );
|
Rotate( angle );
|
||||||
Translate(-x,-y) ;
|
Translate(-x,-y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGraphicsContext::StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2)
|
void wxGraphicsContext::StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2)
|
||||||
{
|
{
|
||||||
wxGraphicsPath* path = CreatePath();
|
wxGraphicsPath* path = CreatePath();
|
||||||
path->MoveToPoint(x1, y1) ;
|
path->MoveToPoint(x1, y1);
|
||||||
path->AddLineToPoint( x2, y2 );
|
path->AddLineToPoint( x2, y2 );
|
||||||
StrokePath( path );
|
StrokePath( path );
|
||||||
delete path;
|
delete path;
|
||||||
@@ -194,8 +194,8 @@ void wxGraphicsContext::DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDoubl
|
|||||||
{
|
{
|
||||||
PushState();
|
PushState();
|
||||||
Translate(x+w/2,y+h/2);
|
Translate(x+w/2,y+h/2);
|
||||||
wxDouble factor = ((wxDouble) w) / h ;
|
wxDouble factor = ((wxDouble) w) / h;
|
||||||
Scale( factor , 1.0) ;
|
Scale( factor , 1.0);
|
||||||
path->AddCircle(0,0,h/2);
|
path->AddCircle(0,0,h/2);
|
||||||
DrawPath(path);
|
DrawPath(path);
|
||||||
PopState();
|
PopState();
|
||||||
@@ -232,8 +232,8 @@ void wxGraphicsContext::StrokeLines( size_t n, const wxPoint2DDouble *points)
|
|||||||
{
|
{
|
||||||
wxASSERT(n > 1);
|
wxASSERT(n > 1);
|
||||||
wxGraphicsPath* path = CreatePath();
|
wxGraphicsPath* path = CreatePath();
|
||||||
path->MoveToPoint(points[0].m_x, points[0].m_y) ;
|
path->MoveToPoint(points[0].m_x, points[0].m_y);
|
||||||
for ( size_t i = 1 ; i < n; ++i)
|
for ( size_t i = 1; i < n; ++i)
|
||||||
path->AddLineToPoint( points[i].m_x, points[i].m_y );
|
path->AddLineToPoint( points[i].m_x, points[i].m_y );
|
||||||
StrokePath( path );
|
StrokePath( path );
|
||||||
delete path;
|
delete path;
|
||||||
@@ -243,8 +243,8 @@ void wxGraphicsContext::DrawLines( size_t n, const wxPoint2DDouble *points, int
|
|||||||
{
|
{
|
||||||
wxASSERT(n > 1);
|
wxASSERT(n > 1);
|
||||||
wxGraphicsPath* path = CreatePath();
|
wxGraphicsPath* path = CreatePath();
|
||||||
path->MoveToPoint(points[0].m_x, points[0].m_y) ;
|
path->MoveToPoint(points[0].m_x, points[0].m_y);
|
||||||
for ( size_t i = 1 ; i < n; ++i)
|
for ( size_t i = 1; i < n; ++i)
|
||||||
path->AddLineToPoint( points[i].m_x, points[i].m_y );
|
path->AddLineToPoint( points[i].m_x, points[i].m_y );
|
||||||
DrawPath( path , fillStyle);
|
DrawPath( path , fillStyle);
|
||||||
delete path;
|
delete path;
|
||||||
@@ -254,9 +254,9 @@ void wxGraphicsContext::StrokeLines( size_t n, const wxPoint2DDouble *beginPoint
|
|||||||
{
|
{
|
||||||
wxASSERT(n > 0);
|
wxASSERT(n > 0);
|
||||||
wxGraphicsPath* path = CreatePath();
|
wxGraphicsPath* path = CreatePath();
|
||||||
for ( size_t i = 0 ; i < n; ++i)
|
for ( size_t i = 0; i < n; ++i)
|
||||||
{
|
{
|
||||||
path->MoveToPoint(beginPoints[i].m_x, beginPoints[i].m_y) ;
|
path->MoveToPoint(beginPoints[i].m_x, beginPoints[i].m_y);
|
||||||
path->AddLineToPoint( endPoints[i].m_x, endPoints[i].m_y );
|
path->AddLineToPoint( endPoints[i].m_x, endPoints[i].m_y );
|
||||||
}
|
}
|
||||||
StrokePath( path );
|
StrokePath( path );
|
||||||
@@ -349,7 +349,7 @@ void wxGCDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord h
|
|||||||
ww = LogicalToDeviceXRel(width);
|
ww = LogicalToDeviceXRel(width);
|
||||||
hh = LogicalToDeviceYRel(height);
|
hh = LogicalToDeviceYRel(height);
|
||||||
|
|
||||||
m_graphicContext->Clip( xx, yy, ww, hh );
|
m_graphicContext->Clip( xx, yy, ww, hh );
|
||||||
if ( m_clipping )
|
if ( m_clipping )
|
||||||
{
|
{
|
||||||
m_clipX1 = wxMax( m_clipX1, xx );
|
m_clipX1 = wxMax( m_clipX1, xx );
|
||||||
@@ -394,31 +394,31 @@ void wxGCDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_graphicContext->Clip( region ) ;
|
m_graphicContext->Clip( region );
|
||||||
if ( m_clipping )
|
if ( m_clipping )
|
||||||
{
|
{
|
||||||
m_clipX1 = wxMax( m_clipX1, xx );
|
m_clipX1 = wxMax( m_clipX1, xx );
|
||||||
m_clipY1 = wxMax( m_clipY1, yy );
|
m_clipY1 = wxMax( m_clipY1, yy );
|
||||||
m_clipX2 = wxMin( m_clipX2, (xx + ww) );
|
m_clipX2 = wxMin( m_clipX2, (xx + ww) );
|
||||||
m_clipY2 = wxMin( m_clipY2, (yy + hh) );
|
m_clipY2 = wxMin( m_clipY2, (yy + hh) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_clipping = true;
|
m_clipping = true;
|
||||||
|
|
||||||
m_clipX1 = xx;
|
m_clipX1 = xx;
|
||||||
m_clipY1 = yy;
|
m_clipY1 = yy;
|
||||||
m_clipX2 = xx + ww;
|
m_clipX2 = xx + ww;
|
||||||
m_clipY2 = yy + hh;
|
m_clipY2 = yy + hh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGCDC::DestroyClippingRegion()
|
void wxGCDC::DestroyClippingRegion()
|
||||||
{
|
{
|
||||||
m_graphicContext->ResetClip() ;
|
m_graphicContext->ResetClip();
|
||||||
m_graphicContext->SetPen( m_pen ) ;
|
m_graphicContext->SetPen( m_pen );
|
||||||
m_graphicContext->SetBrush( m_brush ) ;
|
m_graphicContext->SetBrush( m_brush );
|
||||||
|
|
||||||
m_clipping = false;
|
m_clipping = false;
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ void wxGCDC::SetUserScale( double x, double y )
|
|||||||
|
|
||||||
m_userScaleX = x;
|
m_userScaleX = x;
|
||||||
m_userScaleY = y;
|
m_userScaleY = y;
|
||||||
ComputeScaleAndOrigin();
|
ComputeScaleAndOrigin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGCDC::SetLogicalScale( double x, double y )
|
void wxGCDC::SetLogicalScale( double x, double y )
|
||||||
@@ -547,7 +547,7 @@ void wxGCDC::ComputeScaleAndOrigin()
|
|||||||
wxPen pen(GetPen());
|
wxPen pen(GetPen());
|
||||||
m_pen = wxNullPen;
|
m_pen = wxNullPen;
|
||||||
SetPen(pen);
|
SetPen(pen);
|
||||||
SetFont(m_font);
|
SetFont(m_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,12 +565,12 @@ void wxGCDC::SetFont( const wxFont &font )
|
|||||||
{
|
{
|
||||||
m_font = font;
|
m_font = font;
|
||||||
if ( m_graphicContext )
|
if ( m_graphicContext )
|
||||||
{
|
{
|
||||||
wxFont f = font ;
|
wxFont f = font;
|
||||||
if ( f.Ok() )
|
if ( f.Ok() )
|
||||||
f.SetPointSize( LogicalToDeviceYRel(font.GetPointSize())) ;
|
f.SetPointSize( LogicalToDeviceYRel(font.GetPointSize()));
|
||||||
m_graphicContext->SetFont( f );
|
m_graphicContext->SetFont( f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGCDC::SetPen( const wxPen &pen )
|
void wxGCDC::SetPen( const wxPen &pen )
|
||||||
@@ -793,8 +793,8 @@ void wxGCDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
|||||||
wxGraphicsPath* path = m_graphicContext->CreatePath();
|
wxGraphicsPath* path = m_graphicContext->CreatePath();
|
||||||
m_graphicContext->PushState();
|
m_graphicContext->PushState();
|
||||||
m_graphicContext->Translate(xx+ww/2,yy+hh/2);
|
m_graphicContext->Translate(xx+ww/2,yy+hh/2);
|
||||||
wxDouble factor = ((wxDouble) ww) / hh ;
|
wxDouble factor = ((wxDouble) ww) / hh;
|
||||||
m_graphicContext->Scale( factor , 1.0) ;
|
m_graphicContext->Scale( factor , 1.0);
|
||||||
if ( fill && (sa!=ea) )
|
if ( fill && (sa!=ea) )
|
||||||
path->MoveToPoint(0,0);
|
path->MoveToPoint(0,0);
|
||||||
// since these angles (ea,sa) are measured counter-clockwise, we invert them to
|
// since these angles (ea,sa) are measured counter-clockwise, we invert them to
|
||||||
@@ -825,14 +825,14 @@ void wxGCDC::DoDrawLines(int n, wxPoint points[],
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxPoint2DDouble* pointsD = new wxPoint2DDouble[n] ;
|
wxPoint2DDouble* pointsD = new wxPoint2DDouble[n];
|
||||||
for( int i = 0 ; i < n; ++i)
|
for( int i = 0; i < n; ++i)
|
||||||
{
|
{
|
||||||
pointsD[i].m_x = LogicalToDeviceX(points[i].x + xoffset);
|
pointsD[i].m_x = LogicalToDeviceX(points[i].x + xoffset);
|
||||||
pointsD[i].m_y = LogicalToDeviceY(points[i].y + yoffset);
|
pointsD[i].m_y = LogicalToDeviceY(points[i].y + yoffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_graphicContext->StrokeLines( n , pointsD) ;
|
m_graphicContext->StrokeLines( n , pointsD);
|
||||||
delete[] pointsD;
|
delete[] pointsD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -909,12 +909,12 @@ void wxGCDC::DoDrawPolygon( int n, wxPoint points[],
|
|||||||
if ( m_logicalFunction != wxCOPY )
|
if ( m_logicalFunction != wxCOPY )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool closeIt = false ;
|
bool closeIt = false;
|
||||||
if (points[n-1] != points[0])
|
if (points[n-1] != points[0])
|
||||||
closeIt = true ;
|
closeIt = true;
|
||||||
|
|
||||||
wxPoint2DDouble* pointsD = new wxPoint2DDouble[n+(closeIt?1:0)] ;
|
wxPoint2DDouble* pointsD = new wxPoint2DDouble[n+(closeIt?1:0)];
|
||||||
for( int i = 0 ; i < n; ++i)
|
for( int i = 0; i < n; ++i)
|
||||||
{
|
{
|
||||||
pointsD[i].m_x = LogicalToDeviceX(points[i].x + xoffset);
|
pointsD[i].m_x = LogicalToDeviceX(points[i].x + xoffset);
|
||||||
pointsD[i].m_y = LogicalToDeviceY(points[i].y + yoffset);
|
pointsD[i].m_y = LogicalToDeviceY(points[i].y + yoffset);
|
||||||
@@ -922,7 +922,7 @@ void wxGCDC::DoDrawPolygon( int n, wxPoint points[],
|
|||||||
if ( closeIt )
|
if ( closeIt )
|
||||||
pointsD[n] = pointsD[0];
|
pointsD[n] = pointsD[0];
|
||||||
|
|
||||||
m_graphicContext->DrawLines( n+(closeIt?1:0) , pointsD, fillStyle) ;
|
m_graphicContext->DrawLines( n+(closeIt?1:0) , pointsD, fillStyle);
|
||||||
delete[] pointsD;
|
delete[] pointsD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,17 +936,17 @@ void wxGCDC::DoDrawPolyPolygon(int n,
|
|||||||
wxASSERT(n > 1);
|
wxASSERT(n > 1);
|
||||||
wxGraphicsPath* path = m_graphicContext->CreatePath();
|
wxGraphicsPath* path = m_graphicContext->CreatePath();
|
||||||
|
|
||||||
int i = 0 ;
|
int i = 0;
|
||||||
for ( int j = 0 ; j < n ; ++j)
|
for ( int j = 0; j < n; ++j)
|
||||||
{
|
{
|
||||||
wxPoint start = points[i];
|
wxPoint start = points[i];
|
||||||
path->MoveToPoint(LogicalToDeviceX(start.x+ xoffset), LogicalToDeviceY(start.y+ yoffset)) ;
|
path->MoveToPoint(LogicalToDeviceX(start.x+ xoffset), LogicalToDeviceY(start.y+ yoffset));
|
||||||
++i;
|
++i;
|
||||||
int l = count[j];
|
int l = count[j];
|
||||||
for ( int k = 1 ; k < l ; ++k)
|
for ( int k = 1; k < l; ++k)
|
||||||
{
|
{
|
||||||
path->AddLineToPoint( LogicalToDeviceX(points[i].x+ xoffset), LogicalToDeviceY(points[i].y+ yoffset));
|
path->AddLineToPoint( LogicalToDeviceX(points[i].x+ xoffset), LogicalToDeviceY(points[i].y+ yoffset));
|
||||||
++i ;
|
++i;
|
||||||
}
|
}
|
||||||
// close the polygon
|
// close the polygon
|
||||||
if ( start != points[i-1])
|
if ( start != points[i-1])
|
||||||
@@ -1028,10 +1028,10 @@ void wxGCDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|||||||
if ( m_logicalFunction != wxCOPY )
|
if ( m_logicalFunction != wxCOPY )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxCoord xx = LogicalToDeviceX(x);
|
wxDouble xx = LogicalToDeviceX(x);
|
||||||
wxCoord yy = LogicalToDeviceY(y);
|
wxDouble yy = LogicalToDeviceY(y);
|
||||||
wxDouble ww = m_signX * LogicalToDeviceXRel(width);
|
wxDouble ww = m_signX * LogicalToDeviceXRel(width);
|
||||||
wxCoord hh = m_signY * LogicalToDeviceYRel(height);
|
wxDouble hh = m_signY * LogicalToDeviceYRel(height);
|
||||||
|
|
||||||
// CMB: draw nothing if transformed w or h is 0
|
// CMB: draw nothing if transformed w or h is 0
|
||||||
if (ww == 0 || hh == 0)
|
if (ww == 0 || hh == 0)
|
||||||
@@ -1187,13 +1187,13 @@ void wxGCDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *heig
|
|||||||
m_graphicContext->GetTextExtent( str, &w, &h, &d, &e );
|
m_graphicContext->GetTextExtent( str, &w, &h, &d, &e );
|
||||||
|
|
||||||
if ( height )
|
if ( height )
|
||||||
*height = DeviceToLogicalYRel( h );
|
*height = DeviceToLogicalYRel((wxCoord)h);
|
||||||
if ( descent )
|
if ( descent )
|
||||||
*descent =DeviceToLogicalYRel( d);
|
*descent = DeviceToLogicalYRel((wxCoord)d);
|
||||||
if ( externalLeading )
|
if ( externalLeading )
|
||||||
*externalLeading = DeviceToLogicalYRel( e);
|
*externalLeading = DeviceToLogicalYRel((wxCoord)e);
|
||||||
if ( width )
|
if ( width )
|
||||||
*width = DeviceToLogicalXRel( w );
|
*width = DeviceToLogicalXRel((wxCoord)w);
|
||||||
|
|
||||||
if ( theFont )
|
if ( theFont )
|
||||||
{
|
{
|
||||||
@@ -1207,13 +1207,13 @@ bool wxGCDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) c
|
|||||||
widths.Clear();
|
widths.Clear();
|
||||||
widths.Add(0,text.Length());
|
widths.Add(0,text.Length());
|
||||||
if ( text.IsEmpty() )
|
if ( text.IsEmpty() )
|
||||||
return true ;
|
return true;
|
||||||
|
|
||||||
wxArrayDouble widthsD ;
|
wxArrayDouble widthsD;
|
||||||
|
|
||||||
m_graphicContext->GetPartialTextExtents( text, widthsD );
|
m_graphicContext->GetPartialTextExtents( text, widthsD );
|
||||||
for ( size_t i = 0; i < widths.GetCount(); ++i )
|
for ( size_t i = 0; i < widths.GetCount(); ++i )
|
||||||
widths[i] = DeviceToLogicalXRel( widthsD[i] + 0.5 ) ;
|
widths[i] = DeviceToLogicalXRel((wxCoord)(widthsD[i] + 0.5));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1238,12 +1238,12 @@ void wxGCDC::Clear(void)
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::Clear - invalid DC") );
|
wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::Clear - invalid DC") );
|
||||||
// TODO better implementation / incorporate size info into wxGCDC or context
|
// TODO better implementation / incorporate size info into wxGCDC or context
|
||||||
m_graphicContext->SetBrush( m_backgroundBrush );
|
m_graphicContext->SetBrush( m_backgroundBrush );
|
||||||
wxPen p = *wxTRANSPARENT_PEN ;
|
wxPen p = *wxTRANSPARENT_PEN;
|
||||||
m_graphicContext->SetPen( p );
|
m_graphicContext->SetPen( p );
|
||||||
DoDrawRectangle( 0, 0, 32000 , 32000 );
|
DoDrawRectangle( 0, 0, 32000 , 32000 );
|
||||||
m_graphicContext->SetPen( m_pen ) ;
|
m_graphicContext->SetPen( m_pen );
|
||||||
m_graphicContext->SetBrush( m_brush );
|
m_graphicContext->SetBrush( m_brush );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGCDC::DoGetSize(int *width, int *height) const
|
void wxGCDC::DoGetSize(int *width, int *height) const
|
||||||
@@ -1257,42 +1257,42 @@ void wxGCDC::DoGradientFillLinear(const wxRect& rect,
|
|||||||
const wxColour& destColour,
|
const wxColour& destColour,
|
||||||
wxDirection nDirection )
|
wxDirection nDirection )
|
||||||
{
|
{
|
||||||
wxPoint start ;
|
wxPoint start;
|
||||||
wxPoint end ;
|
wxPoint end;
|
||||||
switch( nDirection)
|
switch( nDirection)
|
||||||
{
|
{
|
||||||
case wxWEST :
|
case wxWEST :
|
||||||
start = rect.GetRightBottom();
|
start = rect.GetRightBottom();
|
||||||
start.x++;
|
start.x++;
|
||||||
end = rect.GetLeftBottom();
|
end = rect.GetLeftBottom();
|
||||||
break ;
|
break;
|
||||||
case wxEAST :
|
case wxEAST :
|
||||||
start = rect.GetLeftBottom();
|
start = rect.GetLeftBottom();
|
||||||
end = rect.GetRightBottom();
|
end = rect.GetRightBottom();
|
||||||
end.x++;
|
end.x++;
|
||||||
break ;
|
break;
|
||||||
case wxNORTH :
|
case wxNORTH :
|
||||||
start = rect.GetLeftBottom();
|
start = rect.GetLeftBottom();
|
||||||
start.y++;
|
start.y++;
|
||||||
end = rect.GetLeftTop();
|
end = rect.GetLeftTop();
|
||||||
break ;
|
break;
|
||||||
case wxSOUTH :
|
case wxSOUTH :
|
||||||
start = rect.GetLeftTop();
|
start = rect.GetLeftTop();
|
||||||
end = rect.GetLeftBottom();
|
end = rect.GetLeftBottom();
|
||||||
end.y++;
|
end.y++;
|
||||||
break ;
|
break;
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_graphicContext->SetLinearGradientBrush(
|
m_graphicContext->SetLinearGradientBrush(
|
||||||
LogicalToDeviceX(start.x),LogicalToDeviceY(start.y),
|
LogicalToDeviceX(start.x),LogicalToDeviceY(start.y),
|
||||||
LogicalToDeviceX(end.x),LogicalToDeviceY(end.y), initialColour, destColour);
|
LogicalToDeviceX(end.x),LogicalToDeviceY(end.y), initialColour, destColour);
|
||||||
|
|
||||||
wxCoord xx = LogicalToDeviceX(rect.x);
|
wxDouble xx = LogicalToDeviceX(rect.x);
|
||||||
wxCoord yy = LogicalToDeviceY(rect.y);
|
wxDouble yy = LogicalToDeviceY(rect.y);
|
||||||
wxDouble ww = m_signX * LogicalToDeviceXRel(rect.width);
|
wxDouble ww = m_signX * LogicalToDeviceXRel(rect.width);
|
||||||
wxCoord hh = m_signY * LogicalToDeviceYRel(rect.height);
|
wxDouble hh = m_signY * LogicalToDeviceYRel(rect.height);
|
||||||
|
|
||||||
if (ww == 0 || hh == 0)
|
if (ww == 0 || hh == 0)
|
||||||
return;
|
return;
|
||||||
@@ -1327,10 +1327,10 @@ void wxGCDC::DoGradientFillConcentric(const wxRect& rect,
|
|||||||
else
|
else
|
||||||
nRadius = cy;
|
nRadius = cy;
|
||||||
|
|
||||||
wxCoord xx = LogicalToDeviceX(rect.x);
|
wxDouble xx = LogicalToDeviceX(rect.x);
|
||||||
wxCoord yy = LogicalToDeviceY(rect.y);
|
wxDouble yy = LogicalToDeviceY(rect.y);
|
||||||
wxDouble ww = m_signX * LogicalToDeviceXRel(rect.width);
|
wxDouble ww = m_signX * LogicalToDeviceXRel(rect.width);
|
||||||
wxCoord hh = m_signY * LogicalToDeviceYRel(rect.height);
|
wxDouble hh = m_signY * LogicalToDeviceYRel(rect.height);
|
||||||
|
|
||||||
if (ww == 0 || hh == 0)
|
if (ww == 0 || hh == 0)
|
||||||
return;
|
return;
|
||||||
@@ -1347,7 +1347,7 @@ void wxGCDC::DoGradientFillConcentric(const wxRect& rect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
|
m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
|
||||||
m_graphicContext->SetBrush( wxBrush( destColour) ) ;
|
m_graphicContext->SetBrush( wxBrush( destColour) );
|
||||||
m_graphicContext->DrawRectangle( xx,yy,ww,hh);
|
m_graphicContext->DrawRectangle( xx,yy,ww,hh);
|
||||||
|
|
||||||
m_graphicContext->SetRadialGradientBrush(
|
m_graphicContext->SetRadialGradientBrush(
|
||||||
|
@@ -119,7 +119,6 @@ wxWindowDC::wxWindowDC(wxWindow *window)
|
|||||||
if (!rootwindow)
|
if (!rootwindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
|
|
||||||
int x , y ;
|
int x , y ;
|
||||||
x = y = 0 ;
|
x = y = 0 ;
|
||||||
window->MacWindowToRootWindow( &x , &y ) ;
|
window->MacWindowToRootWindow( &x , &y ) ;
|
||||||
@@ -127,31 +126,31 @@ wxWindowDC::wxWindowDC(wxWindow *window)
|
|||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
m_window->GetSize( &m_width , &m_height);
|
m_window->GetSize( &m_width , &m_height);
|
||||||
CGContextRef cg = (CGContextRef) window->MacGetCGContextRef();
|
CGContextRef cg = (CGContextRef) window->MacGetCGContextRef();
|
||||||
m_release = false;
|
m_release = false;
|
||||||
if ( cg == NULL )
|
if ( cg == NULL )
|
||||||
{
|
{
|
||||||
SetGraphicsContext( wxGraphicsContext::Create( window ) ) ;
|
SetGraphicsContext( wxGraphicsContext::Create( window ) ) ;
|
||||||
SetDeviceOrigin( x, y );
|
SetDeviceOrigin( x, y );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CGContextSaveGState( cg );
|
CGContextSaveGState( cg );
|
||||||
m_release = true ;
|
m_release = true ;
|
||||||
// make sure the context is having its origin at the wx-window coordinates of the
|
// make sure the context is having its origin at the wx-window coordinates of the
|
||||||
// view (read at the top of window.cpp about the differences)
|
// view (read at the top of window.cpp about the differences)
|
||||||
if ( window->MacGetLeftBorderSize() != 0 || window->MacGetTopBorderSize() != 0 )
|
if ( window->MacGetLeftBorderSize() != 0 || window->MacGetTopBorderSize() != 0 )
|
||||||
CGContextTranslateCTM( cg , -window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize() );
|
CGContextTranslateCTM( cg , -window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize() );
|
||||||
|
|
||||||
SetGraphicsContext( wxGraphicsContext::CreateFromNative( cg ) );
|
SetGraphicsContext( wxGraphicsContext::CreateFromNative( cg ) );
|
||||||
}
|
}
|
||||||
m_graphicContext->SetPen( m_pen ) ;
|
m_graphicContext->SetPen( m_pen ) ;
|
||||||
m_graphicContext->SetBrush( m_brush ) ;
|
m_graphicContext->SetBrush( m_brush ) ;
|
||||||
SetClippingRegion( 0 , 0 , m_width , m_height ) ;
|
SetClippingRegion( 0 , 0 , m_width , m_height ) ;
|
||||||
#else
|
#else
|
||||||
m_macLocalOrigin.x = x ;
|
m_macLocalOrigin.x = x ;
|
||||||
m_macLocalOrigin.y = y ;
|
m_macLocalOrigin.y = y ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( (WindowRef) rootwindow->MacGetWindowRef() ) ;
|
||||||
|
|
||||||
CopyRgn( (RgnHandle) window->MacGetVisibleRegion(true).GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
CopyRgn( (RgnHandle) window->MacGetVisibleRegion(true).GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
||||||
@@ -165,22 +164,22 @@ wxWindowDC::wxWindowDC(wxWindow *window)
|
|||||||
wxWindowDC::~wxWindowDC()
|
wxWindowDC::~wxWindowDC()
|
||||||
{
|
{
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
if ( m_release && m_graphicContext )
|
if ( m_release && m_graphicContext )
|
||||||
{
|
{
|
||||||
CGContextRef cg = (CGContextRef) m_window->MacGetCGContextRef();
|
CGContextRef cg = (CGContextRef) m_window->MacGetCGContextRef();
|
||||||
CGContextRestoreGState(cg);
|
CGContextRestoreGState(cg);
|
||||||
// CGContextRef cg = (CGContextRef) m_graphicContext->GetNativeContext() ;
|
//CGContextRef cg = (CGContextRef) m_graphicContext->GetNativeContext() ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DoGetSize( int* width, int* height ) const
|
void wxWindowDC::DoGetSize( int* width, int* height ) const
|
||||||
{
|
{
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
if ( width )
|
if ( width )
|
||||||
*width = m_width;
|
*width = m_width;
|
||||||
if ( height )
|
if ( height )
|
||||||
*height = m_height;
|
*height = m_height;
|
||||||
#else
|
#else
|
||||||
wxCHECK_RET( m_window, _T("GetSize() doesn't work without window") );
|
wxCHECK_RET( m_window, _T("GetSize() doesn't work without window") );
|
||||||
m_window->GetSize(width, height);
|
m_window->GetSize(width, height);
|
||||||
@@ -198,7 +197,7 @@ wxClientDC::wxClientDC()
|
|||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
wxClientDC::wxClientDC(wxWindow *window) :
|
wxClientDC::wxClientDC(wxWindow *window) :
|
||||||
wxWindowDC( window )
|
wxWindowDC( window )
|
||||||
{
|
{
|
||||||
wxPoint origin = window->GetClientAreaOrigin() ;
|
wxPoint origin = window->GetClientAreaOrigin() ;
|
||||||
wxSize size = window->GetClientSize() ;
|
wxSize size = window->GetClientSize() ;
|
||||||
@@ -207,8 +206,8 @@ wxClientDC::wxClientDC(wxWindow *window) :
|
|||||||
y = origin.y ;
|
y = origin.y ;
|
||||||
window->MacWindowToRootWindow( &x , &y ) ;
|
window->MacWindowToRootWindow( &x , &y ) ;
|
||||||
m_window->GetClientSize( &m_width , &m_height);
|
m_window->GetClientSize( &m_width , &m_height);
|
||||||
SetDeviceOrigin( origin.x, origin.y );
|
SetDeviceOrigin( origin.x, origin.y );
|
||||||
SetClippingRegion( 0 , 0 , m_width , m_height ) ;
|
SetClippingRegion( 0 , 0 , m_width , m_height ) ;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
wxClientDC::wxClientDC(wxWindow *window)
|
wxClientDC::wxClientDC(wxWindow *window)
|
||||||
@@ -265,7 +264,7 @@ wxPaintDC::wxPaintDC()
|
|||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
wxPaintDC::wxPaintDC(wxWindow *window) :
|
wxPaintDC::wxPaintDC(wxWindow *window) :
|
||||||
wxWindowDC( window )
|
wxWindowDC( window )
|
||||||
{
|
{
|
||||||
wxPoint origin = window->GetClientAreaOrigin() ;
|
wxPoint origin = window->GetClientAreaOrigin() ;
|
||||||
wxSize size = window->GetClientSize() ;
|
wxSize size = window->GetClientSize() ;
|
||||||
@@ -274,8 +273,8 @@ wxPaintDC::wxPaintDC(wxWindow *window) :
|
|||||||
y = origin.y ;
|
y = origin.y ;
|
||||||
window->MacWindowToRootWindow( &x , &y ) ;
|
window->MacWindowToRootWindow( &x , &y ) ;
|
||||||
m_window->GetClientSize( &m_width , &m_height);
|
m_window->GetClientSize( &m_width , &m_height);
|
||||||
SetDeviceOrigin( origin.x, origin.y );
|
SetDeviceOrigin( origin.x, origin.y );
|
||||||
SetClippingRegion( 0 , 0 , m_width , m_height ) ;
|
SetClippingRegion( 0 , 0 , m_width , m_height ) ;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
wxPaintDC::wxPaintDC(wxWindow *window)
|
wxPaintDC::wxPaintDC(wxWindow *window)
|
||||||
|
@@ -21,19 +21,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
|
|||||||
wxScreenDC::wxScreenDC()
|
wxScreenDC::wxScreenDC()
|
||||||
{
|
{
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
CGRect cgbounds ;
|
CGRect cgbounds ;
|
||||||
cgbounds = CGDisplayBounds(CGMainDisplayID());
|
cgbounds = CGDisplayBounds(CGMainDisplayID());
|
||||||
Rect bounds;
|
Rect bounds;
|
||||||
bounds.top = cgbounds.origin.y;
|
bounds.top = (short)cgbounds.origin.y;
|
||||||
bounds.left = cgbounds.origin.x;
|
bounds.left = (short)cgbounds.origin.x;
|
||||||
bounds.bottom = bounds.top + cgbounds.size.height;
|
bounds.bottom = bounds.top + (short)cgbounds.size.height;
|
||||||
bounds.right = bounds.left + cgbounds.size.width;
|
bounds.right = bounds.left + (short)cgbounds.size.width;
|
||||||
WindowAttributes overlayAttributes = kWindowIgnoreClicksAttribute;
|
WindowAttributes overlayAttributes = kWindowIgnoreClicksAttribute;
|
||||||
OSStatus err = CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, (WindowRef*) &m_overlayWindow );
|
CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, (WindowRef*) &m_overlayWindow );
|
||||||
ShowWindow((WindowRef)m_overlayWindow);
|
ShowWindow((WindowRef)m_overlayWindow);
|
||||||
SetGraphicsContext( wxGraphicsContext::CreateFromNativeWindow( m_overlayWindow ) );
|
SetGraphicsContext( wxGraphicsContext::CreateFromNativeWindow( m_overlayWindow ) );
|
||||||
m_width = cgbounds.size.width;
|
m_width = (wxCoord)cgbounds.size.width;
|
||||||
m_height = cgbounds.size.height;
|
m_height = (wxCoord)cgbounds.size.height;
|
||||||
#else
|
#else
|
||||||
m_macPort = CreateNewPort() ;
|
m_macPort = CreateNewPort() ;
|
||||||
GrafPtr port ;
|
GrafPtr port ;
|
||||||
@@ -60,15 +60,15 @@ wxScreenDC::wxScreenDC()
|
|||||||
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
||||||
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
||||||
#endif
|
#endif
|
||||||
m_ok = true ;
|
m_ok = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxScreenDC::~wxScreenDC()
|
wxScreenDC::~wxScreenDC()
|
||||||
{
|
{
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
delete m_graphicContext;
|
delete m_graphicContext;
|
||||||
m_graphicContext = NULL;
|
m_graphicContext = NULL;
|
||||||
DisposeWindow((WindowRef) m_overlayWindow );
|
DisposeWindow((WindowRef) m_overlayWindow );
|
||||||
#else
|
#else
|
||||||
if ( m_macPort )
|
if ( m_macPort )
|
||||||
DisposePort( (CGrafPtr) m_macPort ) ;
|
DisposePort( (CGrafPtr) m_macPort ) ;
|
||||||
|
@@ -569,13 +569,12 @@ int wxDisplayDepth()
|
|||||||
void wxDisplaySize(int *width, int *height)
|
void wxDisplaySize(int *width, int *height)
|
||||||
{
|
{
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
CGRect bounds ;
|
|
||||||
// TODO adapt for multi-displays
|
// TODO adapt for multi-displays
|
||||||
bounds = CGDisplayBounds(CGMainDisplayID());
|
CGRect bounds = CGDisplayBounds(CGMainDisplayID());
|
||||||
if ( width )
|
if ( width )
|
||||||
*width = bounds.size.width ;
|
*width = (int)bounds.size.width ;
|
||||||
if ( height )
|
if ( height )
|
||||||
*height = bounds.size.height;
|
*height = (int)bounds.size.height;
|
||||||
#else
|
#else
|
||||||
BitMap screenBits;
|
BitMap screenBits;
|
||||||
GetQDGlobalsScreenBits( &screenBits );
|
GetQDGlobalsScreenBits( &screenBits );
|
||||||
|
Reference in New Issue
Block a user