diff --git a/Tk/README.rst b/Tk/README.rst index bb5eb9c3c..dc53787f0 100644 --- a/Tk/README.rst +++ b/Tk/README.rst @@ -42,11 +42,9 @@ The Photoimage Booster Patch (for Windows 95/NT) This patch kit boosts performance for 16/24-bit displays. The first patch is required on Tk 4.2 (where it fixes the problems for -16-bit displays) and later versions, with the exception for Tk 8.0b1 -where Sun added something similar themselves, only to remove it in -8.0b2. By installing both patches, Tk's PhotoImage handling becomes -much faster on both 16-bit and 24-bit displays. The patch has been -tested with Tk 4.2 and 8.0. +16-bit displays) and later versions. By installing both patches, +Tk's PhotoImage handling becomes much faster on both 16-bit and +24-bit displays. The patch has been tested with Tk 4.2 and 8.0. Here's a benchmark, made with a sample program which loads two 512x512 greyscale PGM's, and two 512x512 colour PPM's, and displays diff --git a/Tk/tkImaging.c b/Tk/tkImaging.c index 3ebe49d48..494349a8e 100644 --- a/Tk/tkImaging.c +++ b/Tk/tkImaging.c @@ -143,60 +143,6 @@ PyImagingPhotoPut(ClientData clientdata, Tcl_Interp* interp, src_xoffset * im->pixelsize; #endif -#if TK < 84 /* < 8.4.0 */ - if (strcmp(im->mode, "RGBA") == 0) { - /* Copy non-transparent pixels to photo image */ - int x, y; - Tk_PhotoImageBlock run; - - /* Clear current contents */ - Tk_PhotoBlank(photo); - - /* Setup run descriptor */ - run.height = 1; - run.pitch = block.pitch; - run.pixelSize = block.pixelSize; - run.offset[0] = 0; - run.offset[1] = 1; - run.offset[2] = 2; - run.offset[3] = 0; /* no alpha (or reserved, under 8.2) */ - - /* Copy opaque runs to photo image */ - for (y = 0; y < block.height; y++) { - unsigned char* p = block.pixelPtr + y*block.pitch; - unsigned char* s = p; - int w = 0; - for (x = 0; x < block.width; x++) { - if (p[3]) { - /* opaque: add pixel to current run */ - if (w == 0) - s = p; - w = w + 1; - } else if (s) { - /* copy run to photo image */ - if (w > 0) { - run.width = w; - run.pixelPtr = s; - Tk_PhotoPutBlock(photo, &run, x-w, y, run.width, 1); - } - w = 0; - } - p += block.pixelSize; - } - if (w > 0) { - /* copy final run, if any */ - run.width = w; - run.pixelPtr = s; - Tk_PhotoPutBlock(photo, &run, x-w, y, run.width, 1); - } - } - - } else - - /* Copy opaque block to photo image, and leave the rest to TK */ - Tk_PhotoPutBlock(photo, &block, 0, 0, block.width, block.height); - -#else /* Tk 8.4 and newer */ #if TK < 85 /* Tk 8.4 */ Tk_PhotoPutBlock(photo, &block, 0, 0, block.width, block.height, TK_PHOTO_COMPOSITE_SET); @@ -207,7 +153,6 @@ PyImagingPhotoPut(ClientData clientdata, Tcl_Interp* interp, #else /* Tk 8.5 */ Tk_PhotoPutBlock(interp, photo, &block, 0, 0, block.width, block.height, TK_PHOTO_COMPOSITE_SET); -#endif #endif return TCL_OK;