Removed support for Tk versions earlier than 8.4

This commit is contained in:
Andrew Murray 2015-06-19 19:24:21 +10:00
parent f1f6835170
commit 68ca91f32c
2 changed files with 3 additions and 60 deletions

View File

@ -42,11 +42,9 @@ The Photoimage Booster Patch (for Windows 95/NT)
This patch kit boosts performance for 16/24-bit displays. The 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 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 16-bit displays) and later versions. By installing both patches,
where Sun added something similar themselves, only to remove it in Tk's PhotoImage handling becomes much faster on both 16-bit and
8.0b2. By installing both patches, Tk's PhotoImage handling becomes 24-bit displays. The patch has been tested with Tk 4.2 and 8.0.
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 Here's a benchmark, made with a sample program which loads two
512x512 greyscale PGM's, and two 512x512 colour PPM's, and displays 512x512 greyscale PGM's, and two 512x512 colour PPM's, and displays

View File

@ -143,60 +143,6 @@ PyImagingPhotoPut(ClientData clientdata, Tcl_Interp* interp,
src_xoffset * im->pixelsize; src_xoffset * im->pixelsize;
#endif #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 */ #if TK < 85 /* Tk 8.4 */
Tk_PhotoPutBlock(photo, &block, 0, 0, block.width, block.height, Tk_PhotoPutBlock(photo, &block, 0, 0, block.width, block.height,
TK_PHOTO_COMPOSITE_SET); TK_PHOTO_COMPOSITE_SET);
@ -207,7 +153,6 @@ PyImagingPhotoPut(ClientData clientdata, Tcl_Interp* interp,
#else /* Tk 8.5 */ #else /* Tk 8.5 */
Tk_PhotoPutBlock(interp, photo, &block, 0, 0, block.width, block.height, Tk_PhotoPutBlock(interp, photo, &block, 0, 0, block.width, block.height,
TK_PHOTO_COMPOSITE_SET); TK_PHOTO_COMPOSITE_SET);
#endif
#endif #endif
return TCL_OK; return TCL_OK;