X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf428459fcec8f1916b437ea38c4fc8a0502214a..9802983f157c32177e92e8c0f6b1ce44aec0ebca:/src/cocoa/dcmemory.mm diff --git a/src/cocoa/dcmemory.mm b/src/cocoa/dcmemory.mm index ff5882d995..0f2f04c365 100644 --- a/src/cocoa/dcmemory.mm +++ b/src/cocoa/dcmemory.mm @@ -53,8 +53,10 @@ bool wxMemoryDC::CocoaLockFocus() { [m_cocoaNSImage lockFocus]; sm_cocoaDCStack.Insert(this); - m_cocoaFlipped = [m_cocoaNSImage isFlipped]; - m_cocoaHeight = [m_cocoaNSImage size].height; + NSAffineTransform *newTransform = CocoaGetWxToBoundsTransform([m_cocoaNSImage isFlipped], [m_cocoaNSImage size].height); + [newTransform retain]; + [m_cocoaWxToBoundsTransform release]; + m_cocoaWxToBoundsTransform = newTransform; CocoaApplyTransformations(); return true; } @@ -152,20 +154,16 @@ bool wxMemoryDC::CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest, return false; } -void wxMemoryDC::Clear() +bool wxMemoryDC::CocoaGetBounds(void *rectData) { - if(!CocoaTakeFocus()) return; - - NSGraphicsContext *context = [NSGraphicsContext currentContext]; - [context saveGraphicsState]; - - [m_backgroundBrush.GetNSColor() set]; - NSRect rect; - rect.origin.x = 0; - rect.origin.y = 0; - rect.size = [m_cocoaNSImage size]; - [NSBezierPath fillRect:rect]; - - [context restoreGraphicsState]; + if(!rectData) + return false; + if(!m_cocoaNSImage) + return false; + NSRect *pRect = (NSRect*)rectData; + pRect->origin.x = 0.0; + pRect->origin.y = 0.0; + pRect->size = [m_cocoaNSImage size]; + return true; }