don't assign NULLs to bools and floats, this is confusing (and also the usual: deTABified; corrected double to int cast)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42794 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -433,7 +433,7 @@ void wxMacCoreGraphicsPenData::Init()
|
|||||||
{
|
{
|
||||||
m_lengths = NULL;
|
m_lengths = NULL;
|
||||||
m_userLengths = NULL;
|
m_userLengths = NULL;
|
||||||
m_width = NULL;
|
m_width = 0;
|
||||||
m_count = 0;
|
m_count = 0;
|
||||||
m_patternColorComponents = NULL;
|
m_patternColorComponents = NULL;
|
||||||
m_isPattern = false;
|
m_isPattern = false;
|
||||||
@@ -701,27 +701,27 @@ wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
|
|||||||
class WXDLLIMPEXP_CORE wxMacCoreGraphicsMatrixData : public wxGraphicsMatrixData
|
class WXDLLIMPEXP_CORE wxMacCoreGraphicsMatrixData : public wxGraphicsMatrixData
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
wxMacCoreGraphicsMatrixData(wxGraphicsRenderer* renderer) ;
|
wxMacCoreGraphicsMatrixData(wxGraphicsRenderer* renderer) ;
|
||||||
|
|
||||||
virtual ~wxMacCoreGraphicsMatrixData() ;
|
virtual ~wxMacCoreGraphicsMatrixData() ;
|
||||||
|
|
||||||
virtual wxGraphicsObjectRefData *Clone() const ;
|
virtual wxGraphicsObjectRefData *Clone() const ;
|
||||||
|
|
||||||
// concatenates the matrix
|
// concatenates the matrix
|
||||||
virtual void Concat( const wxGraphicsMatrixData *t );
|
virtual void Concat( const wxGraphicsMatrixData *t );
|
||||||
|
|
||||||
// sets the matrix to the respective values
|
// sets the matrix to the respective values
|
||||||
virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
|
virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
|
||||||
wxDouble tx=0.0, wxDouble ty=0.0);
|
wxDouble tx=0.0, wxDouble ty=0.0);
|
||||||
|
|
||||||
// makes this the inverse matrix
|
// makes this the inverse matrix
|
||||||
virtual void Invert();
|
virtual void Invert();
|
||||||
|
|
||||||
// returns true if the elements of the transformation matrix are equal ?
|
// returns true if the elements of the transformation matrix are equal ?
|
||||||
virtual bool IsEqual( const wxGraphicsMatrixData* t) const ;
|
virtual bool IsEqual( const wxGraphicsMatrixData* t) const ;
|
||||||
|
|
||||||
// return true if this is the identity matrix
|
// return true if this is the identity matrix
|
||||||
virtual bool IsIdentity() const;
|
virtual bool IsIdentity() const;
|
||||||
|
|
||||||
//
|
//
|
||||||
// transformation
|
// transformation
|
||||||
@@ -740,14 +740,14 @@ public :
|
|||||||
// apply the transforms
|
// apply the transforms
|
||||||
//
|
//
|
||||||
|
|
||||||
// applies that matrix to the point
|
// applies that matrix to the point
|
||||||
virtual void TransformPoint( wxDouble *x, wxDouble *y ) const;
|
virtual void TransformPoint( wxDouble *x, wxDouble *y ) const;
|
||||||
|
|
||||||
// applies the matrix except for translations
|
// applies the matrix except for translations
|
||||||
virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const;
|
virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const;
|
||||||
|
|
||||||
// returns the native representation
|
// returns the native representation
|
||||||
virtual void * GetNativeMatrix() const;
|
virtual void * GetNativeMatrix() const;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
CGAffineTransform m_matrix;
|
CGAffineTransform m_matrix;
|
||||||
@@ -914,22 +914,22 @@ public :
|
|||||||
// draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
|
// draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
|
||||||
virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r );
|
virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r );
|
||||||
|
|
||||||
// adds another path
|
// adds another path
|
||||||
virtual void AddPath( const wxGraphicsPathData* path );
|
virtual void AddPath( const wxGraphicsPathData* path );
|
||||||
|
|
||||||
// returns the native path
|
// returns the native path
|
||||||
virtual void * GetNativePath() const { return m_path; }
|
virtual void * GetNativePath() const { return m_path; }
|
||||||
|
|
||||||
// give the native path returned by GetNativePath() back (there might be some deallocations necessary)
|
// give the native path returned by GetNativePath() back (there might be some deallocations necessary)
|
||||||
virtual void UnGetNativePath(void *p) const {}
|
virtual void UnGetNativePath(void *p) const {}
|
||||||
|
|
||||||
// transforms each point of this path by the matrix
|
// transforms each point of this path by the matrix
|
||||||
virtual void Transform( const wxGraphicsMatrixData* matrix );
|
virtual void Transform( const wxGraphicsMatrixData* matrix );
|
||||||
|
|
||||||
// gets the bounding box enclosing all points (possibly including control points)
|
// gets the bounding box enclosing all points (possibly including control points)
|
||||||
virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *y) const;
|
virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *y) const;
|
||||||
|
|
||||||
virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE) const;
|
virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE) const;
|
||||||
private :
|
private :
|
||||||
CGMutablePathRef m_path;
|
CGMutablePathRef m_path;
|
||||||
};
|
};
|
||||||
@@ -940,10 +940,10 @@ private :
|
|||||||
|
|
||||||
wxMacCoreGraphicsPathData::wxMacCoreGraphicsPathData( wxGraphicsRenderer* renderer, CGMutablePathRef path) : wxGraphicsPathData(renderer)
|
wxMacCoreGraphicsPathData::wxMacCoreGraphicsPathData( wxGraphicsRenderer* renderer, CGMutablePathRef path) : wxGraphicsPathData(renderer)
|
||||||
{
|
{
|
||||||
if ( path )
|
if ( path )
|
||||||
m_path = path;
|
m_path = path;
|
||||||
else
|
else
|
||||||
m_path = CGPathCreateMutable();
|
m_path = CGPathCreateMutable();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacCoreGraphicsPathData::~wxMacCoreGraphicsPathData()
|
wxMacCoreGraphicsPathData::~wxMacCoreGraphicsPathData()
|
||||||
@@ -953,8 +953,8 @@ wxMacCoreGraphicsPathData::~wxMacCoreGraphicsPathData()
|
|||||||
|
|
||||||
wxGraphicsObjectRefData* wxMacCoreGraphicsPathData::Clone() const
|
wxGraphicsObjectRefData* wxMacCoreGraphicsPathData::Clone() const
|
||||||
{
|
{
|
||||||
wxMacCoreGraphicsPathData* clone = new wxMacCoreGraphicsPathData(GetRenderer(),CGPathCreateMutableCopy(m_path));
|
wxMacCoreGraphicsPathData* clone = new wxMacCoreGraphicsPathData(GetRenderer(),CGPathCreateMutableCopy(m_path));
|
||||||
return clone ;
|
return clone ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1004,7 +1004,7 @@ void wxMacCoreGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDoub
|
|||||||
|
|
||||||
void wxMacCoreGraphicsPathData::AddPath( const wxGraphicsPathData* path )
|
void wxMacCoreGraphicsPathData::AddPath( const wxGraphicsPathData* path )
|
||||||
{
|
{
|
||||||
CGPathAddPath( m_path , NULL, (CGPathRef) path->GetNativePath() );
|
CGPathAddPath( m_path , NULL, (CGPathRef) path->GetNativePath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// closes the current subpath
|
// closes the current subpath
|
||||||
@@ -1024,25 +1024,25 @@ void wxMacCoreGraphicsPathData::GetCurrentPoint( wxDouble* x, wxDouble* y) const
|
|||||||
// transforms each point of this path by the matrix
|
// transforms each point of this path by the matrix
|
||||||
void wxMacCoreGraphicsPathData::Transform( const wxGraphicsMatrixData* matrix )
|
void wxMacCoreGraphicsPathData::Transform( const wxGraphicsMatrixData* matrix )
|
||||||
{
|
{
|
||||||
CGMutablePathRef p = CGPathCreateMutable() ;
|
CGMutablePathRef p = CGPathCreateMutable() ;
|
||||||
CGPathAddPath( p, (CGAffineTransform*) matrix->GetNativeMatrix() , m_path );
|
CGPathAddPath( p, (CGAffineTransform*) matrix->GetNativeMatrix() , m_path );
|
||||||
CGPathRelease( m_path );
|
CGPathRelease( m_path );
|
||||||
m_path = p;
|
m_path = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets the bounding box enclosing all points (possibly including control points)
|
// gets the bounding box enclosing all points (possibly including control points)
|
||||||
void wxMacCoreGraphicsPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const
|
void wxMacCoreGraphicsPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const
|
||||||
{
|
{
|
||||||
CGRect bounds = CGPathGetBoundingBox( m_path ) ;
|
CGRect bounds = CGPathGetBoundingBox( m_path ) ;
|
||||||
*x = bounds.origin.x;
|
*x = bounds.origin.x;
|
||||||
*y = bounds.origin.y;
|
*y = bounds.origin.y;
|
||||||
*w = bounds.size.width;
|
*w = bounds.size.width;
|
||||||
*h = bounds.size.height;
|
*h = bounds.size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMacCoreGraphicsPathData::Contains( wxDouble x, wxDouble y, int fillStyle) const
|
bool wxMacCoreGraphicsPathData::Contains( wxDouble x, wxDouble y, int fillStyle) const
|
||||||
{
|
{
|
||||||
return CGPathContainsPoint( m_path, NULL, CGPointMake(x,y), fillStyle == wxODDEVEN_RULE );
|
return CGPathContainsPoint( m_path, NULL, CGPointMake(x,y), fillStyle == wxODDEVEN_RULE );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1068,7 +1068,7 @@ public:
|
|||||||
|
|
||||||
~wxMacCoreGraphicsContext();
|
~wxMacCoreGraphicsContext();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
// push the current state of the context, ie the transformation matrix on a stack
|
// push the current state of the context, ie the transformation matrix on a stack
|
||||||
virtual void PushState();
|
virtual void PushState();
|
||||||
@@ -1100,14 +1100,14 @@ public:
|
|||||||
// rotate (radians)
|
// rotate (radians)
|
||||||
virtual void Rotate( wxDouble angle );
|
virtual void Rotate( wxDouble angle );
|
||||||
|
|
||||||
// concatenates this transform with the current transform of this context
|
// concatenates this transform with the current transform of this context
|
||||||
virtual void ConcatTransform( const wxGraphicsMatrix& matrix );
|
virtual void ConcatTransform( const wxGraphicsMatrix& matrix );
|
||||||
|
|
||||||
// sets the transform of this context
|
// sets the transform of this context
|
||||||
virtual void SetTransform( const wxGraphicsMatrix& matrix );
|
virtual void SetTransform( const wxGraphicsMatrix& matrix );
|
||||||
|
|
||||||
// gets the matrix of this context
|
// gets the matrix of this context
|
||||||
virtual wxGraphicsMatrix GetTransform() const;
|
virtual wxGraphicsMatrix GetTransform() const;
|
||||||
//
|
//
|
||||||
// setting the paint
|
// setting the paint
|
||||||
//
|
//
|
||||||
@@ -1126,7 +1126,7 @@ public:
|
|||||||
int penwidth = 0 ;
|
int penwidth = 0 ;
|
||||||
if ( !m_pen.IsNull() )
|
if ( !m_pen.IsNull() )
|
||||||
{
|
{
|
||||||
penwidth = ((wxMacCoreGraphicsPenData*)m_pen.GetRefData())->GetWidth();
|
penwidth = (int)((wxMacCoreGraphicsPenData*)m_pen.GetRefData())->GetWidth();
|
||||||
if ( penwidth == 0 )
|
if ( penwidth == 0 )
|
||||||
penwidth = 1;
|
penwidth = 1;
|
||||||
}
|
}
|
||||||
@@ -1162,11 +1162,11 @@ private:
|
|||||||
void EnsureIsValid();
|
void EnsureIsValid();
|
||||||
|
|
||||||
CGContextRef m_cgContext;
|
CGContextRef m_cgContext;
|
||||||
WindowRef m_windowRef;
|
WindowRef m_windowRef;
|
||||||
bool m_releaseContext;
|
bool m_releaseContext;
|
||||||
CGAffineTransform m_windowTransform;
|
CGAffineTransform m_windowTransform;
|
||||||
|
|
||||||
wxMacCFRefHolder<HIShapeRef> m_clipRgn;
|
wxMacCFRefHolder<HIShapeRef> m_clipRgn;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1190,7 +1190,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMacCoreGraphicsContext, wxGraphicsContext)
|
|||||||
void wxMacCoreGraphicsContext::Init()
|
void wxMacCoreGraphicsContext::Init()
|
||||||
{
|
{
|
||||||
m_cgContext = NULL;
|
m_cgContext = NULL;
|
||||||
m_releaseContext = false;
|
m_releaseContext = false;
|
||||||
m_windowRef = NULL;
|
m_windowRef = NULL;
|
||||||
|
|
||||||
HIRect r = CGRectMake(0,0,0,0);
|
HIRect r = CGRectMake(0,0,0,0);
|
||||||
@@ -1199,20 +1199,20 @@ void wxMacCoreGraphicsContext::Init()
|
|||||||
|
|
||||||
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, CGContextRef cgcontext ) : wxGraphicsContext(renderer)
|
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, CGContextRef cgcontext ) : wxGraphicsContext(renderer)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
SetNativeContext(cgcontext);
|
SetNativeContext(cgcontext);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window ): wxGraphicsContext(renderer)
|
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window ): wxGraphicsContext(renderer)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
m_windowRef = window;
|
m_windowRef = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window ): wxGraphicsContext(renderer)
|
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window ): wxGraphicsContext(renderer)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
m_windowRef = (WindowRef) window->MacGetTopLevelWindowRef();
|
m_windowRef = (WindowRef) window->MacGetTopLevelWindowRef();
|
||||||
int originX , originY;
|
int originX , originY;
|
||||||
originX = originY = 0;
|
originX = originY = 0;
|
||||||
window->MacWindowToRootWindow( &originX , &originY );
|
window->MacWindowToRootWindow( &originX , &originY );
|
||||||
@@ -1226,12 +1226,12 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
|
|||||||
|
|
||||||
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext(wxGraphicsRenderer* renderer) : wxGraphicsContext(renderer)
|
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext(wxGraphicsRenderer* renderer) : wxGraphicsContext(renderer)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext() : wxGraphicsContext(NULL)
|
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext() : wxGraphicsContext(NULL)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
wxLogDebug(wxT("Illegal Constructor called"));
|
wxLogDebug(wxT("Illegal Constructor called"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1242,65 +1242,65 @@ wxMacCoreGraphicsContext::~wxMacCoreGraphicsContext()
|
|||||||
|
|
||||||
void wxMacCoreGraphicsContext::EnsureIsValid()
|
void wxMacCoreGraphicsContext::EnsureIsValid()
|
||||||
{
|
{
|
||||||
if ( !m_cgContext )
|
if ( !m_cgContext )
|
||||||
{
|
{
|
||||||
OSStatus status = QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
|
OSStatus status = QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
|
||||||
wxASSERT_MSG( status == noErr , wxT("Cannot nest wxDCs on the same window") );
|
wxASSERT_MSG( status == noErr , wxT("Cannot nest wxDCs on the same window") );
|
||||||
|
|
||||||
CGContextConcatCTM( m_cgContext, m_windowTransform );
|
CGContextConcatCTM( m_cgContext, m_windowTransform );
|
||||||
CGContextSaveGState( m_cgContext );
|
CGContextSaveGState( m_cgContext );
|
||||||
m_releaseContext = true;
|
m_releaseContext = true;
|
||||||
if ( !HIShapeIsEmpty(m_clipRgn) )
|
if ( !HIShapeIsEmpty(m_clipRgn) )
|
||||||
{
|
{
|
||||||
HIShapeReplacePathInCGContext( m_clipRgn, m_cgContext );
|
HIShapeReplacePathInCGContext( m_clipRgn, m_cgContext );
|
||||||
CGContextClip( m_cgContext );
|
CGContextClip( m_cgContext );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxMacCoreGraphicsContext::Clip( const wxRegion ®ion )
|
void wxMacCoreGraphicsContext::Clip( const wxRegion ®ion )
|
||||||
{
|
{
|
||||||
if( m_cgContext )
|
if( m_cgContext )
|
||||||
{
|
{
|
||||||
HIShapeRef shape = HIShapeCreateWithQDRgn( (RgnHandle) region.GetWXHRGN() );
|
HIShapeRef shape = HIShapeCreateWithQDRgn( (RgnHandle) region.GetWXHRGN() );
|
||||||
HIShapeReplacePathInCGContext( shape, m_cgContext );
|
HIShapeReplacePathInCGContext( shape, m_cgContext );
|
||||||
CGContextClip( m_cgContext );
|
CGContextClip( m_cgContext );
|
||||||
CFRelease( shape );
|
CFRelease( shape );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_clipRgn.Set(HIShapeCreateWithQDRgn( (RgnHandle) region.GetWXHRGN() ));
|
m_clipRgn.Set(HIShapeCreateWithQDRgn( (RgnHandle) region.GetWXHRGN() ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clips drawings to the rect
|
// clips drawings to the rect
|
||||||
void wxMacCoreGraphicsContext::Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
void wxMacCoreGraphicsContext::Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
||||||
{
|
{
|
||||||
HIRect r = CGRectMake( x , y , w , h );
|
HIRect r = CGRectMake( x , y , w , h );
|
||||||
if ( m_cgContext )
|
if ( m_cgContext )
|
||||||
{
|
{
|
||||||
CGContextClipToRect( m_cgContext, r );
|
CGContextClipToRect( m_cgContext, r );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_clipRgn.Set(HIShapeCreateWithRect(&r));
|
m_clipRgn.Set(HIShapeCreateWithRect(&r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// resets the clipping to original extent
|
// resets the clipping to original extent
|
||||||
void wxMacCoreGraphicsContext::ResetClip()
|
void wxMacCoreGraphicsContext::ResetClip()
|
||||||
{
|
{
|
||||||
if ( m_cgContext )
|
if ( m_cgContext )
|
||||||
{
|
{
|
||||||
CGContextRestoreGState( m_cgContext );
|
CGContextRestoreGState( m_cgContext );
|
||||||
CGContextSaveGState( m_cgContext );
|
CGContextSaveGState( m_cgContext );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HIRect r = CGRectMake(0,0,0,0);
|
HIRect r = CGRectMake(0,0,0,0);
|
||||||
m_clipRgn.Set(HIShapeCreateWithRect(&r));
|
m_clipRgn.Set(HIShapeCreateWithRect(&r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacCoreGraphicsContext::StrokePath( const wxGraphicsPath &path )
|
void wxMacCoreGraphicsContext::StrokePath( const wxGraphicsPath &path )
|
||||||
@@ -1308,7 +1308,7 @@ void wxMacCoreGraphicsContext::StrokePath( const wxGraphicsPath &path )
|
|||||||
if ( m_pen.IsNull() )
|
if ( m_pen.IsNull() )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
|
|
||||||
bool offset = ShouldOffset();
|
bool offset = ShouldOffset();
|
||||||
if ( offset )
|
if ( offset )
|
||||||
@@ -1358,7 +1358,7 @@ void wxMacCoreGraphicsContext::DrawPath( const wxGraphicsPath &path , int fillSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
|
|
||||||
if ( !m_brush.IsNull() )
|
if ( !m_brush.IsNull() )
|
||||||
((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->Apply(this);
|
((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->Apply(this);
|
||||||
@@ -1382,7 +1382,7 @@ void wxMacCoreGraphicsContext::FillPath( const wxGraphicsPath &path , int fillSt
|
|||||||
if ( m_brush.IsNull() )
|
if ( m_brush.IsNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
|
|
||||||
if ( ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->IsShading() )
|
if ( ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->IsShading() )
|
||||||
{
|
{
|
||||||
@@ -1434,13 +1434,13 @@ void wxMacCoreGraphicsContext::SetNativeContext( CGContextRef cg )
|
|||||||
CGContextRetain(m_cgContext);
|
CGContextRetain(m_cgContext);
|
||||||
CGContextSaveGState( m_cgContext );
|
CGContextSaveGState( m_cgContext );
|
||||||
CGContextSaveGState( m_cgContext );
|
CGContextSaveGState( m_cgContext );
|
||||||
m_releaseContext = NULL;
|
m_releaseContext = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacCoreGraphicsContext::Translate( wxDouble dx , wxDouble dy )
|
void wxMacCoreGraphicsContext::Translate( wxDouble dx , wxDouble dy )
|
||||||
{
|
{
|
||||||
if ( m_cgContext )
|
if ( m_cgContext )
|
||||||
CGContextTranslateCTM( m_cgContext, dx, dy );
|
CGContextTranslateCTM( m_cgContext, dx, dy );
|
||||||
else
|
else
|
||||||
m_windowTransform = CGAffineTransformTranslate(m_windowTransform,dx,dy);
|
m_windowTransform = CGAffineTransformTranslate(m_windowTransform,dx,dy);
|
||||||
@@ -1448,7 +1448,7 @@ void wxMacCoreGraphicsContext::Translate( wxDouble dx , wxDouble dy )
|
|||||||
|
|
||||||
void wxMacCoreGraphicsContext::Scale( wxDouble xScale , wxDouble yScale )
|
void wxMacCoreGraphicsContext::Scale( wxDouble xScale , wxDouble yScale )
|
||||||
{
|
{
|
||||||
if ( m_cgContext )
|
if ( m_cgContext )
|
||||||
CGContextScaleCTM( m_cgContext , xScale , yScale );
|
CGContextScaleCTM( m_cgContext , xScale , yScale );
|
||||||
else
|
else
|
||||||
m_windowTransform = CGAffineTransformScale(m_windowTransform,xScale,yScale);
|
m_windowTransform = CGAffineTransformScale(m_windowTransform,xScale,yScale);
|
||||||
@@ -1456,7 +1456,7 @@ void wxMacCoreGraphicsContext::Scale( wxDouble xScale , wxDouble yScale )
|
|||||||
|
|
||||||
void wxMacCoreGraphicsContext::Rotate( wxDouble angle )
|
void wxMacCoreGraphicsContext::Rotate( wxDouble angle )
|
||||||
{
|
{
|
||||||
if ( m_cgContext )
|
if ( m_cgContext )
|
||||||
CGContextRotateCTM( m_cgContext , angle );
|
CGContextRotateCTM( m_cgContext , angle );
|
||||||
else
|
else
|
||||||
m_windowTransform = CGAffineTransformRotate(m_windowTransform,angle);
|
m_windowTransform = CGAffineTransformRotate(m_windowTransform,angle);
|
||||||
@@ -1464,7 +1464,7 @@ void wxMacCoreGraphicsContext::Rotate( wxDouble angle )
|
|||||||
|
|
||||||
void wxMacCoreGraphicsContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
void wxMacCoreGraphicsContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
||||||
{
|
{
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
|
|
||||||
CGImageRef image = (CGImageRef)( bmp.CGImageCreate() );
|
CGImageRef image = (CGImageRef)( bmp.CGImageCreate() );
|
||||||
HIRect r = CGRectMake( x , y , w , h );
|
HIRect r = CGRectMake( x , y , w , h );
|
||||||
@@ -1474,7 +1474,7 @@ void wxMacCoreGraphicsContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDo
|
|||||||
|
|
||||||
void wxMacCoreGraphicsContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
void wxMacCoreGraphicsContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
||||||
{
|
{
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
|
|
||||||
CGRect r = CGRectMake( 00 , 00 , w , h );
|
CGRect r = CGRectMake( 00 , 00 , w , h );
|
||||||
CGContextSaveGState( m_cgContext );
|
CGContextSaveGState( m_cgContext );
|
||||||
@@ -1487,14 +1487,14 @@ void wxMacCoreGraphicsContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDoubl
|
|||||||
|
|
||||||
void wxMacCoreGraphicsContext::PushState()
|
void wxMacCoreGraphicsContext::PushState()
|
||||||
{
|
{
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
|
|
||||||
CGContextSaveGState( m_cgContext );
|
CGContextSaveGState( m_cgContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacCoreGraphicsContext::PopState()
|
void wxMacCoreGraphicsContext::PopState()
|
||||||
{
|
{
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
|
|
||||||
CGContextRestoreGState( m_cgContext );
|
CGContextRestoreGState( m_cgContext );
|
||||||
}
|
}
|
||||||
@@ -1509,7 +1509,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
|
|||||||
if ( m_font.IsNull() )
|
if ( m_font.IsNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
|
|
||||||
OSStatus status = noErr;
|
OSStatus status = noErr;
|
||||||
ATSUTextLayout atsuLayout;
|
ATSUTextLayout atsuLayout;
|
||||||
@@ -1756,7 +1756,7 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
|
|||||||
|
|
||||||
void * wxMacCoreGraphicsContext::GetNativeContext()
|
void * wxMacCoreGraphicsContext::GetNativeContext()
|
||||||
{
|
{
|
||||||
return m_cgContext;
|
return m_cgContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
// concatenates this transform with the current transform of this context
|
// concatenates this transform with the current transform of this context
|
||||||
@@ -1808,24 +1808,24 @@ public :
|
|||||||
|
|
||||||
virtual ~wxMacCoreGraphicsRenderer() {}
|
virtual ~wxMacCoreGraphicsRenderer() {}
|
||||||
|
|
||||||
// Context
|
// Context
|
||||||
|
|
||||||
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
|
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
|
||||||
|
|
||||||
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
|
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
|
||||||
|
|
||||||
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window );
|
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window );
|
||||||
|
|
||||||
virtual wxGraphicsContext * CreateContext( wxWindow* window );
|
virtual wxGraphicsContext * CreateContext( wxWindow* window );
|
||||||
|
|
||||||
// Path
|
// Path
|
||||||
|
|
||||||
virtual wxGraphicsPath CreatePath();
|
virtual wxGraphicsPath CreatePath();
|
||||||
|
|
||||||
// Matrix
|
// Matrix
|
||||||
|
|
||||||
virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
|
virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
|
||||||
wxDouble tx=0.0, wxDouble ty=0.0);
|
wxDouble tx=0.0, wxDouble ty=0.0);
|
||||||
|
|
||||||
|
|
||||||
virtual wxGraphicsPen CreatePen(const wxPen& pen) ;
|
virtual wxGraphicsPen CreatePen(const wxPen& pen) ;
|
||||||
@@ -1858,7 +1858,7 @@ static wxMacCoreGraphicsRenderer gs_MacCoreGraphicsRenderer;
|
|||||||
|
|
||||||
wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer()
|
wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer()
|
||||||
{
|
{
|
||||||
return &gs_MacCoreGraphicsRenderer;
|
return &gs_MacCoreGraphicsRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC& dc)
|
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC& dc)
|
||||||
@@ -1879,7 +1879,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeWindow( vo
|
|||||||
|
|
||||||
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window )
|
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window )
|
||||||
{
|
{
|
||||||
return new wxMacCoreGraphicsContext(this, window );
|
return new wxMacCoreGraphicsContext(this, window );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path
|
// Path
|
||||||
@@ -1895,7 +1895,7 @@ wxGraphicsPath wxMacCoreGraphicsRenderer::CreatePath()
|
|||||||
// Matrix
|
// Matrix
|
||||||
|
|
||||||
wxGraphicsMatrix wxMacCoreGraphicsRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDouble c, wxDouble d,
|
wxGraphicsMatrix wxMacCoreGraphicsRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDouble c, wxDouble d,
|
||||||
wxDouble tx, wxDouble ty)
|
wxDouble tx, wxDouble ty)
|
||||||
{
|
{
|
||||||
wxGraphicsMatrix m;
|
wxGraphicsMatrix m;
|
||||||
wxMacCoreGraphicsMatrixData* data = new wxMacCoreGraphicsMatrixData( this );
|
wxMacCoreGraphicsMatrixData* data = new wxMacCoreGraphicsMatrixData( this );
|
||||||
|
Reference in New Issue
Block a user