Don't save and restore the graphics context for color changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21803 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,31 +64,21 @@ wxDC::~wxDC(void)
|
|||||||
|
|
||||||
void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||||
{
|
{
|
||||||
NSGraphicsContext *context = [NSGraphicsContext currentContext];
|
|
||||||
[context saveGraphicsState];
|
|
||||||
|
|
||||||
NSBezierPath *bezpath = [NSBezierPath bezierPathWithRect:NSMakeRect(x,y,width,height)];
|
NSBezierPath *bezpath = [NSBezierPath bezierPathWithRect:NSMakeRect(x,y,width,height)];
|
||||||
[m_textForegroundColour.GetNSColor() set];
|
[m_textForegroundColour.GetNSColor() set];
|
||||||
[bezpath stroke];
|
[bezpath stroke];
|
||||||
[m_brush.GetNSColor() set];
|
[m_brush.GetNSColor() set];
|
||||||
[bezpath fill];
|
[bezpath fill];
|
||||||
|
|
||||||
[context restoreGraphicsState];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
|
void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
|
||||||
{
|
{
|
||||||
NSGraphicsContext *context = [NSGraphicsContext currentContext];
|
|
||||||
[context saveGraphicsState];
|
|
||||||
|
|
||||||
NSBezierPath *bezpath = [NSBezierPath bezierPath];
|
NSBezierPath *bezpath = [NSBezierPath bezierPath];
|
||||||
[bezpath moveToPoint:NSMakePoint(x1,y1)];
|
[bezpath moveToPoint:NSMakePoint(x1,y1)];
|
||||||
[bezpath lineToPoint:NSMakePoint(x2,y2)];
|
[bezpath lineToPoint:NSMakePoint(x2,y2)];
|
||||||
|
|
||||||
[m_textForegroundColour.GetNSColor() set];
|
[m_textForegroundColour.GetNSColor() set];
|
||||||
[bezpath stroke];
|
[bezpath stroke];
|
||||||
|
|
||||||
[context restoreGraphicsState];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoGetTextExtent(const wxString& text, wxCoord *x, wxCoord *y, wxCoord *descent, wxCoord *externalLeading, wxFont *theFont) const
|
void wxDC::DoGetTextExtent(const wxString& text, wxCoord *x, wxCoord *y, wxCoord *descent, wxCoord *externalLeading, wxFont *theFont) const
|
||||||
|
Reference in New Issue
Block a user