Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Minor optimization of drawing code in OSX |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f98361a03b83090f2938ed7f594aa2b9 |
User & Date: | kevin_walzer 2014-12-21 04:11:51 |
Context
2014-12-21
| ||
04:16 | Revert unintended commit of menubutton file check-in: 399c1c0b user: kevin_walzer tags: trunk | |
04:11 | Minor optimization of drawing code in OSX check-in: f98361a0 user: kevin_walzer tags: trunk | |
2014-12-14
| ||
12:18 | merge-mark check-in: b4f1c0b3 user: jan.nijtmans tags: trunk | |
Changes
Changes to macosx/tkMacOSXDraw.c.
︙ | ︙ | |||
1653 1654 1655 1656 1657 1658 1659 | dc.portBounds.origin.y += macDraw->yOff; if (!dc.focusLocked) { CGContextSaveGState(dc.context); } CGContextSetTextDrawingMode(dc.context, kCGTextFill); CGContextConcatCTM(dc.context, t); if (dc.clipRgn) { | | | | 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 | dc.portBounds.origin.y += macDraw->yOff; if (!dc.focusLocked) { CGContextSaveGState(dc.context); } CGContextSetTextDrawingMode(dc.context, kCGTextFill); CGContextConcatCTM(dc.context, t); if (dc.clipRgn) { #ifdef TK_MAC_DEBUG_DRAWING CGContextSaveGState(dc.context); ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1); CGContextEOFillPath(dc.context); CGContextRestoreGState(dc.context); #endif /* TK_MAC_DEBUG_DRAWING */ CGRect r; if (!HIShapeIsRectangular(dc.clipRgn) || !CGRectContainsRect( *HIShapeGetBounds(dc.clipRgn, &r), CGRectApplyAffineTransform(clipBounds, t))) { ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); CGContextEOClip(dc.context); } |
︙ | ︙ |
Changes to macosx/tkMacOSXMenubutton.c.
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | static const BoundsFix boundsFixes[] = { [fixForStyle(NSRoundedBezelStyle)] = { 14, 10, -2, -1}, [fixForStyle(NSRegularSquareBezelStyle)] = { 6, 13, -2, 1, 1}, [fixForStyle(NSShadowlessSquareBezelStyle)] = { 15, 0, 2 }, }; #endif /* * Forward declarations for procedures defined later in this file: */ static void MenuButtonEventProc(ClientData clientData, XEvent *eventPtr); /* *---------------------------------------------------------------------- * * TkpCreateMenuButton -- * * Allocate a new TkMenuButton structure. | > > > > > > > > > > > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | static const BoundsFix boundsFixes[] = { [fixForStyle(NSRoundedBezelStyle)] = { 14, 10, -2, -1}, [fixForStyle(NSRegularSquareBezelStyle)] = { 6, 13, -2, 1, 1}, [fixForStyle(NSShadowlessSquareBezelStyle)] = { 15, 0, 2 }, }; #endif /* * Forward declarations for procedures defined later in this file: */ static void MenuButtonEventProc(ClientData clientData, XEvent *eventPtr); /* * The structure below defines menubutton class behavior by means of functions * that can be invoked from generic window code. */ Tk_ClassProcs tkpMenubuttonClass = { sizeof(Tk_ClassProcs), /* size */ TkMenuButtonWorldChanged, /* worldChangedProc */ }; /* *---------------------------------------------------------------------- * * TkpCreateMenuButton -- * * Allocate a new TkMenuButton structure. |
︙ | ︙ | |||
83 84 85 86 87 88 89 | *---------------------------------------------------------------------- */ TkMenuButton * TkpCreateMenuButton( Tk_Window tkwin) { | | > > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | *---------------------------------------------------------------------- */ TkMenuButton * TkpCreateMenuButton( Tk_Window tkwin) { MacMenuButton *macButtonPtr = (MacMenuButton *) ckalloc(sizeof(MacMenuButton)); macButtonPtr->button = nil; Tk_CreateEventHandler(tkwin, ActivateMask, MenuButtonEventProc, (ClientData) macButtonPtr); return (TkMenuButton *) macButtonPtr; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
156 157 158 159 160 161 162 | NSRect frame; int enabled; mbPtr->flags &= ~REDRAW_PENDING; if (!tkwin || !Tk_IsMapped(tkwin) || !view || !TkMacOSXSetupDrawingContext((Drawable) macWin, NULL, 1, &dc)) { return; | | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | NSRect frame; int enabled; mbPtr->flags &= ~REDRAW_PENDING; if (!tkwin || !Tk_IsMapped(tkwin) || !view || !TkMacOSXSetupDrawingContext((Drawable) macWin, NULL, 1, &dc)) { return; } CGContextConcatCTM(dc.context, t); Tk_Fill3DRectangle(tkwin, (Pixmap) macWin, mbPtr->normalBorder, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); if ([button superview] != view) { [view addSubview:button]; } enabled = !(mbPtr->state == STATE_DISABLED); |
︙ | ︙ |
Changes to macosx/tkMacOSXWindowEvent.c.
︙ | ︙ | |||
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | } else { [self performSelectorOnMainThread:@selector(generateExposeEvents:) withObject:(id)drawShape waitUntilDone:NO modes:[NSArray arrayWithObjects:NSRunLoopCommonModes, NSEventTrackingRunLoopMode, NSModalPanelRunLoopMode, nil]]; } CFRelease(drawShape); drawTime=-[beginTime timeIntervalSinceNow]; } /*At conclusion of resize event, send notification and set view for redraw if earlier drawing was skipped because of lagginess.*/ - (void)viewDidEndLiveResize { if(drawTime>MAX_DYNAMIC_TIME) { [self setNeedsDisplay:YES]; | > > > | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | } else { [self performSelectorOnMainThread:@selector(generateExposeEvents:) withObject:(id)drawShape waitUntilDone:NO modes:[NSArray arrayWithObjects:NSRunLoopCommonModes, NSEventTrackingRunLoopMode, NSModalPanelRunLoopMode, nil]]; } CFRelease(drawShape); drawTime=-[beginTime timeIntervalSinceNow]; [super setNeedsDisplayInRect:rect]; } /*At conclusion of resize event, send notification and set view for redraw if earlier drawing was skipped because of lagginess.*/ - (void)viewDidEndLiveResize { if(drawTime>MAX_DYNAMIC_TIME) { [self setNeedsDisplay:YES]; |
︙ | ︙ | |||
873 874 875 876 877 878 879 | ![[NSRunLoop currentRunLoop] currentMode] && Tcl_GetServiceMode() != TCL_SERVICE_NONE) { /* * Ensure there are no pending idle-time redraws that could prevent the * just posted Expose events from generating new redraws. */ | | | 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 | ![[NSRunLoop currentRunLoop] currentMode] && Tcl_GetServiceMode() != TCL_SERVICE_NONE) { /* * Ensure there are no pending idle-time redraws that could prevent the * just posted Expose events from generating new redraws. */ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} /* * For smoother drawing, process Expose events and resulting redraws * immediately instead of at idle time. */ ClientData oldArg; |
︙ | ︙ |