Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Reverse previous commit for alpha channel data in image because of newly discovered crashes in Tk |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | bug-99b84e49ff-trunk |
Files: | files | file ages | folders |
SHA1: |
63cc69567652c0d8cf671635ebd972e3 |
User & Date: | kevin_walzer 2014-06-23 02:18:46 |
Context
2014-06-23
| ||
02:18 | Reverse previous commit for alpha channel data in image because of newly discovered crashes in Tk Closed-Leaf check-in: 63cc6956 user: kevin_walzer tags: bug-99b84e49ff-trunk | |
2014-06-22
| ||
01:34 | Fix for images with alpha channel data on Mavericks; thanks to Mark Culler for the patch. check-in: ca2ba35e user: kevin_walzer tags: bug-99b84e49ff-trunk | |
Changes
Changes to macosx/tkMacOSXDraw.c.
︙ | ︙ | |||
110 111 112 113 114 115 116 | } return TCL_OK; } /* *---------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < | > | < > | | < < | | < | | | > | | | < < | | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | } return TCL_OK; } /* *---------------------------------------------------------------------- * * XCopyArea -- * * Copies data from one drawable to another using block transfer * routines. * * Results: * None. * * Side effects: * Data is moved from a window or bitmap to a second window or * bitmap. * *---------------------------------------------------------------------- */ void XCopyArea( Display *display, /* Display. */ Drawable src, /* Source drawable. */ Drawable dst, /* Destination drawable. */ GC gc, /* GC to use. */ int src_x, /* X & Y, width & height */ int src_y, /* define the source rectangle */ unsigned int width, /* that will be copied. */ unsigned int height, int dest_x, /* Dest X & Y on dest rect. */ int dest_y) { TkMacOSXDrawingContext dc; MacDrawable *srcDraw = (MacDrawable *) src; display->request++; if (!width || !height) { /* TkMacOSXDbgMsg("Drawing of emtpy area requested"); */ return; } if (srcDraw->flags & TK_IS_PIXMAP) { if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { return; } if (dc.context) { CGImageRef img = TkMacOSXCreateCGImageWithDrawable(src); if (img) { DrawCGImage(dst, gc, dc.context, img, gc->foreground, gc->background, CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height), CGRectMake(src_x, src_y, width, height), CGRectMake(dest_x, dest_y, width, height)); CFRelease(img); } else { TkMacOSXDbgMsg("Invalid source drawable"); } } else { TkMacOSXDbgMsg("Invalid destination drawable"); } TkMacOSXRestoreDrawingContext(&dc); } else if (TkMacOSXDrawableWindow(src)) { NSView *view = TkMacOSXDrawableView(srcDraw); NSWindow *w = [view window]; NSInteger gs = [w windowNumber] > 0 ? [w gState] : 0; /* // alternative using per-view gState: NSInteger gs = [view gState]; if (!gs) { [view allocateGState]; if ([view lockFocusIfCanDraw]) { [view unlockFocus]; } gs = [view gState]; } */ if (!gs || !TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { return; } if (dc.context) { NSGraphicsContext *gc = nil; CGFloat boundsH = [view bounds].size.height; NSRect srcRect = NSMakeRect(srcDraw->xOff + src_x, boundsH - height - (srcDraw->yOff + src_y), width, height); if (((MacDrawable *) dst)->flags & TK_IS_PIXMAP) { gc = [NSGraphicsContext graphicsContextWithGraphicsPort: dc.context flipped:NO]; if (gc) { [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:gc]; } } NSCopyBits(gs, srcRect, NSMakePoint(dest_x, dc.portBounds.size.height - dest_y)); if (gc) { [NSGraphicsContext restoreGraphicsState]; } } else { TkMacOSXDbgMsg("Invalid destination drawable"); } TkMacOSXRestoreDrawingContext(&dc); } else { TkMacOSXDbgMsg("Invalid source drawable"); } } /* *---------------------------------------------------------------------- * * XCopyPlane -- * |
︙ | ︙ | |||
273 274 275 276 277 278 279 | unsigned long plane) /* Which plane to copy. */ { TkMacOSXDrawingContext dc; MacDrawable *srcDraw = (MacDrawable *) src; display->request++; if (!width || !height) { | | | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | unsigned long plane) /* Which plane to copy. */ { TkMacOSXDrawingContext dc; MacDrawable *srcDraw = (MacDrawable *) src; display->request++; if (!width || !height) { /* TkMacOSXDbgMsg("Drawing of emtpy area requested"); */ return; } if (plane != 1) { Tcl_Panic("Unexpected plane specified for XCopyPlane"); } if (srcDraw->flags & TK_IS_PIXMAP) { if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { |
︙ | ︙ |
Changes to macosx/tkMacOSXPrivate.h.
︙ | ︙ | |||
226 227 228 229 230 231 232 | int antiAlias); MODULE_SCOPE int TkMacOSXGenerateFocusEvent(TkWindow *winPtr, int activeFlag); MODULE_SCOPE WindowClass TkMacOSXWindowClass(TkWindow *winPtr); MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr); MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window); MODULE_SCOPE EventModifiers TkMacOSXModifierState(void); | < < | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | int antiAlias); MODULE_SCOPE int TkMacOSXGenerateFocusEvent(TkWindow *winPtr, int activeFlag); MODULE_SCOPE WindowClass TkMacOSXWindowClass(TkWindow *winPtr); MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr); MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window); MODULE_SCOPE EventModifiers TkMacOSXModifierState(void); MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG, TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel, CGContextRef context); MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr, |
︙ | ︙ |
Changes to macosx/tkMacOSXSubwindows.c.
︙ | ︙ | |||
1273 1274 1275 1276 1277 1278 1279 | * * Creates an in memory drawing surface. * * Results: * Returns a handle to a new pixmap. * * Side effects: | | | 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 | * * Creates an in memory drawing surface. * * Results: * Returns a handle to a new pixmap. * * Side effects: * Allocates a new Macintosh GWorld. * *---------------------------------------------------------------------- */ Pixmap Tk_GetPixmap( Display *display, /* Display for new pixmap (can be null). */ |
︙ | ︙ | |||
1319 1320 1321 1322 1323 1324 1325 | * * Release the resources associated with a pixmap. * * Results: * None. * * Side effects: | | | 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 | * * Release the resources associated with a pixmap. * * Results: * None. * * Side effects: * Deletes the Macintosh GWorld created by Tk_GetPixmap. * *---------------------------------------------------------------------- */ void Tk_FreePixmap( Display *display, /* Display. */ |
︙ | ︙ |
Changes to macosx/tkMacOSXXStubs.c.
︙ | ︙ | |||
838 839 840 841 842 843 844 | *---------------------------------------------------------------------- * * XGetImage -- * * This function copies data from a pixmap or window into an XImage. * * Results: | | < | > > | | | | | | | | < > > > | > | < | > | > > > > | > | < | | | | | > > | | > | < | < < > > | < < < < < < | > | > | < | | < < < | | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | *---------------------------------------------------------------------- * * XGetImage -- * * This function copies data from a pixmap or window into an XImage. * * Results: * Returns a newly allocated image containing the data from the given * rectangle of the given drawable. * * Side effects: * None. * *---------------------------------------------------------------------- */ XImage * XGetImage( Display *display, Drawable d, int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, int format) { MacDrawable *macDraw = (MacDrawable *) d; XImage * imagePtr = NULL; Pixmap pixmap = (Pixmap) NULL; Tk_Window win = (Tk_Window) macDraw->winPtr; GC gc; char * data = NULL; int depth = 32; int offset = 0; int bitmap_pad = 0; int bytes_per_line = 0; if (format == ZPixmap) { if (width > 0 && height > 0) { /* * Tk_GetPixmap fails for zero width or height. */ pixmap = Tk_GetPixmap(display, d, width, height, depth); } if (win) { XGCValues values; gc = Tk_GetGC(win, 0, &values); } else { gc = XCreateGC(display, pixmap, 0, NULL); } if (pixmap) { CGContextRef context; XCopyArea(display, d, pixmap, gc, x, y, width, height, 0, 0); context = ((MacDrawable *) pixmap)->context; if (context) { data = CGBitmapContextGetData(context); bytes_per_line = CGBitmapContextGetBytesPerRow(context); } } if (data) { imagePtr = XCreateImage(display, NULL, depth, format, offset, data, width, height, bitmap_pad, bytes_per_line); /* * Track Pixmap underlying the XImage in the unused obdata field * so that we can treat XImages coming from XGetImage specially. */ imagePtr->obdata = (XPointer) pixmap; } else if (pixmap) { Tk_FreePixmap(display, pixmap); } if (!win) { XFreeGC(display, gc); } } else { TkMacOSXDbgMsg("Invalid image format"); } return imagePtr; } /* *---------------------------------------------------------------------- * |
︙ | ︙ |