From b6e78a559d9d0ddcfc14f12fbbfbcf451bbca331 Mon Sep 17 00:00:00 2001 From: fedor Date: Thu, 6 Sep 2001 19:04:07 +0000 Subject: [PATCH] Switch back to gsave/grestore. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10850 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/NSView.m | 37 ++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index fb28a8a9d..2f11c0327 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-09-06 Adam Fedor + + * Source/NSView.m (-lockFocusInRect:): Switch back to gsave/grestore + syntax, use rectclip instead of rectviewclip. + (-unlockFocusWithFlush:): Likewise. + 2001-09-03 Adam Fedor * Source/tiff.m (NSTiffWrite): Set EXTRASAMPLES even if 0. diff --git a/Source/NSView.m b/Source/NSView.m index 93a0c54aa..59cf0d500 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -1317,7 +1317,6 @@ GSSetDragTypes(NSView* obj, NSArray *types) - (void) lockFocusInRect: (NSRect)rect { NSGraphicsContext *ctxt = GSCurrentContext(); - NSAffineTransform *matrix; struct NSWindow_struct *window_t; NSRect wrect; int window_gstate; @@ -1336,20 +1335,8 @@ GSSetDragTypes(NSView* obj, NSArray *types) window_t = (struct NSWindow_struct *)_window; [window_t->_rectsBeingDrawn addObject: [NSValue valueWithRect: wrect]]; - /* - * Clipping - set viewclip to the visible rectangle - which will never be - * greater than the bounds of the view. This prevents drawing outside - * our bounds (FIXME: Perhaps IntersectRect with bounds, just to make sure?) - */ - DPSsave(ctxt); - DPSmark(ctxt); /* Rather than keep the save object, just mark it to make - sure we can find it when we unlock. We really should - keep an ivar for it, though... */ - matrix = [self _matrixToWindow]; - if ([matrix isRotated]) - { - [matrix boundingRectFor: rect result: &rect]; - } + /* Make sure we don't modify superview's gstate */ + DPSgsave(ctxt); if (_gstate) { @@ -1360,15 +1347,24 @@ GSSetDragTypes(NSView* obj, NSArray *types) } _renew_gstate = 0; DPSgsave(ctxt); - DPSrectviewclip(ctxt, NSMinX(rect), NSMinY(rect), - NSWidth(rect), NSHeight(rect)); } else { + NSAffineTransform *matrix; + matrix = [self _matrixToWindow]; + if ([matrix isRotated]) + { + [matrix boundingRectFor: rect result: &rect]; + } + DPSsetgstate(ctxt, window_gstate); DPSgsave(ctxt); [matrix concat]; - DPSrectviewclip(ctxt, NSMinX(rect), NSMinY(rect), + /* Clip to the visible rectangle - which will never be greater + * than the bounds of the view. This prevents drawing outside + * our bounds + */ + DPSrectclip(ctxt, NSMinX(rect), NSMinY(rect), NSWidth(rect), NSHeight(rect)); /* Allow subclases to make other modifications */ @@ -1400,9 +1396,8 @@ GSSetDragTypes(NSView* obj, NSArray *types) /* Restore our original gstate */ DPSgrestore(ctxt); - /* Restore state (including viewclip) of nesting lockFocus */ - DPScleartomark(ctxt); - DPSrestore(ctxt); + /* Restore state of nesting lockFocus */ + DPSgrestore(ctxt); if (!_allocate_gstate) _gstate = 0;