summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-11-18 16:11:03 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-11-18 16:11:03 (GMT)
commit96e0f171dc799d6c736b52f00548ac65f8612a0c (patch)
treee71d62f24f690ffcf49b1509d256cc538c1ebea0 /generic/tkImgPhoto.c
parente91354a1f438857414146b91cc7bed3ed9e22643 (diff)
parent3edf85a73eca0f7ca5925e9b6575ef31c5ce6a5b (diff)
downloadtk-96e0f171dc799d6c736b52f00548ac65f8612a0c.zip
tk-96e0f171dc799d6c736b52f00548ac65f8612a0c.tar.gz
tk-96e0f171dc799d6c736b52f00548ac65f8612a0c.tar.bz2
Merge 9.0
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c245
1 files changed, 1 insertions, 244 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index b6596a6..55fb44f 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -139,11 +139,6 @@ typedef struct {
Tk_PhotoImageFormat *formatList;
/* Pointer to the first in the list of known
* photo image formats.*/
-#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- Tk_PhotoImageFormat *oldFormatList;
- /* Pointer to the first in the list of known
- * photo image formats.*/
-#endif
Tk_PhotoImageFormatVersion3 *formatListVersion3;
/* Pointer to the first in the list of known
* photo image formats in Version3 format.*/
@@ -247,13 +242,6 @@ PhotoFormatThreadExitProc(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- while (tsdPtr->oldFormatList != NULL) {
- freePtr = tsdPtr->oldFormatList;
- tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr;
- ckfree(freePtr);
- }
-#endif
while (tsdPtr->formatList != NULL) {
freePtr = tsdPtr->formatList;
tsdPtr->formatList = tsdPtr->formatList->nextPtr;
@@ -271,7 +259,7 @@ PhotoFormatThreadExitProc(
/*
*----------------------------------------------------------------------
*
- * Tk_CreateOldPhotoImageFormat, Tk_CreatePhotoImageFormat,
+ * Tk_CreatePhotoImageFormat,
* Tk_CreatePhotoImageFormatVersion3 --
*
* This function is invoked by an image file handler to register a new
@@ -288,29 +276,6 @@ PhotoFormatThreadExitProc(
*----------------------------------------------------------------------
*/
-#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-void
-Tk_CreateOldPhotoImageFormat(
- const Tk_PhotoImageFormat *formatPtr)
- /* Structure describing the format. All of the
- * fields except "nextPtr" must be filled in
- * by caller. */
-{
- Tk_PhotoImageFormat *copyPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- if (!tsdPtr->initialized) {
- tsdPtr->initialized = 1;
- Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL);
- }
- copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat));
- *copyPtr = *formatPtr;
- copyPtr->nextPtr = tsdPtr->oldFormatList;
- tsdPtr->oldFormatList = copyPtr;
-}
-#endif
-
void
Tk_CreatePhotoImageFormat(
const Tk_PhotoImageFormat *formatPtr)
@@ -328,12 +293,6 @@ Tk_CreatePhotoImageFormat(
}
copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
-#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- if (isupper((unsigned char) *formatPtr->name)) {
- copyPtr->nextPtr = tsdPtr->oldFormatList;
- tsdPtr->oldFormatList = copyPtr;
- } else
-#endif
{
/* for compatibility with aMSN: make a copy of formatPtr->name */
char *name = (char *)ckalloc(strlen(formatPtr->name) + 1);
@@ -835,23 +794,6 @@ ImgPhotoCmd(
}
}
}
-#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- if (stringWriteProc == NULL) {
- oldformat = 1;
- for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
- imageFormat = imageFormat->nextPtr) {
- if ((strncasecmp(Tcl_GetString(options.format),
- imageFormat->name,
- strlen(imageFormat->name)) == 0)) {
- matched = 1;
- if (imageFormat->stringWriteProc != NULL) {
- stringWriteProc = imageFormat->stringWriteProc;
- break;
- }
- }
- }
- }
-#endif
if (stringWriteProc == NULL) {
oldformat = 0;
for (imageFormatVersion3 = tsdPtr->formatListVersion3;
@@ -1512,22 +1454,6 @@ readCleanup:
}
}
}
-#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- if (imageFormat == NULL) {
- oldformat = 1;
- for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
- imageFormat = imageFormat->nextPtr) {
- if ((fmtString == NULL)
- || (strncasecmp(fmtString, imageFormat->name,
- strlen(imageFormat->name)) == 0)) {
- matched = 1;
- if (imageFormat->fileWriteProc != NULL) {
- break;
- }
- }
- }
- }
-#endif
if (imageFormat == NULL) {
oldformat = 0;
for (imageFormatVersion3 = tsdPtr->formatListVersion3;
@@ -2778,42 +2704,6 @@ MatchFileFormat(
}
}
}
-#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-if (formatPtr == NULL) {
- useoldformat = 1;
- for (formatPtr = tsdPtr->oldFormatList; formatPtr != NULL;
- formatPtr = formatPtr->nextPtr) {
- if (formatString != NULL) {
- if (strncasecmp(formatString,
- formatPtr->name, strlen(formatPtr->name)) != 0) {
- continue;
- }
- matched = 1;
- if (formatPtr->fileMatchProc == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "-file option isn't supported for %s images",
- formatString));
- Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
- "NOT_FILE_FORMAT", NULL);
- return TCL_ERROR;
- }
- }
- if (formatPtr->fileMatchProc != NULL) {
- (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET);
- if (formatPtr->fileMatchProc(chan, fileName, (Tcl_Obj *)
- formatString, widthPtr, heightPtr, interp)) {
- if (*widthPtr < 1) {
- *widthPtr = 1;
- }
- if (*heightPtr < 1) {
- *heightPtr = 1;
- }
- break;
- }
- }
- }
- }
-#endif
/*
* For old and not version 3 format, exit now with success
@@ -3011,38 +2901,6 @@ MatchStringFormat(
}
}
-#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- if (formatPtr == NULL) {
- useoldformat = 1;
- for (formatPtr = tsdPtr->oldFormatList; formatPtr != NULL;
- formatPtr = formatPtr->nextPtr) {
- if (formatObj != NULL) {
- if (strncasecmp(formatString,
- formatPtr->name, strlen(formatPtr->name)) != 0) {
- continue;
- }
- matched = 1;
- if (formatPtr->stringMatchProc == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "-data option isn't supported for %s images",
- formatString));
- Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO",
- "NOT_DATA_FORMAT", NULL);
- return TCL_ERROR;
- }
- }
- if ((formatPtr->stringMatchProc != NULL)
- && (formatPtr->stringReadProc != NULL)
- && formatPtr->stringMatchProc(
- (Tcl_Obj *) Tcl_GetString(data),
- (Tcl_Obj *) formatString,
- widthPtr, heightPtr, interp)) {
- break;
- }
- }
- }
-#endif
-
if (formatPtr == NULL) {
useoldformat = 0;
for (formatVersion3Ptr = tsdPtr->formatListVersion3;
@@ -4531,107 +4389,6 @@ ImgPhotoPostscript(
}
/*
- *----------------------------------------------------------------------
- *
- * Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite --
- *
- * These backward-compatibility functions just exist to fill slots in stubs
- * table. For the behaviour of *_NoComposite, refer to the corresponding
- * function without the extra suffix, except that the compositing rule is
- * always "overlay" and the function always panics on memory-allocation
- * failure.
- *
- *----------------------------------------------------------------------
- */
-#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-void
-Tk_PhotoPutBlock_NoComposite(
- Tk_PhotoHandle handle,
- Tk_PhotoImageBlock *blockPtr,
- int x, int y, int width, int height)
-{
- if (Tk_PhotoPutBlock(NULL, handle, blockPtr, x, y, width, height,
- TK_PHOTO_COMPOSITE_OVERLAY) != TCL_OK) {
- Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
- }
-}
-
-void
-Tk_PhotoPutZoomedBlock_NoComposite(
- Tk_PhotoHandle handle,
- Tk_PhotoImageBlock *blockPtr,
- int x, int y, int width, int height,
- int zoomX, int zoomY, int subsampleX, int subsampleY)
-{
- if (Tk_PhotoPutZoomedBlock(NULL, handle, blockPtr, x, y, width, height,
- zoomX, zoomY, subsampleX, subsampleY,
- TK_PHOTO_COMPOSITE_OVERLAY) != TCL_OK) {
- Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic,
- * Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic
- *
- * Backward compatibility functions for preserving the old behaviour (i.e.
- * panic on memory allocation failure) so that extensions do not need to be
- * significantly updated to take account of TIP #116. These call the new
- * interface (i.e. the interface without the extra suffix), but panic if an
- * error condition is returned.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_PhotoExpand_Panic(
- Tk_PhotoHandle handle,
- int width, int height)
-{
- if (Tk_PhotoExpand(NULL, handle, width, height) != TCL_OK) {
- Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
- }
-}
-
-void
-Tk_PhotoPutBlock_Panic(
- Tk_PhotoHandle handle,
- Tk_PhotoImageBlock *blockPtr,
- int x, int y, int width, int height, int compRule)
-{
- if (Tk_PhotoPutBlock(NULL, handle, blockPtr, x, y, width, height,
- compRule) != TCL_OK) {
- Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
- }
-}
-
-void
-Tk_PhotoPutZoomedBlock_Panic(
- Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr,
- int x, int y, int width, int height,
- int zoomX, int zoomY, int subsampleX, int subsampleY,
- int compRule)
-{
- if (Tk_PhotoPutZoomedBlock(NULL, handle, blockPtr, x, y, width, height,
- zoomX, zoomY, subsampleX, subsampleY, compRule) != TCL_OK) {
- Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
- }
-}
-
-void
-Tk_PhotoSetSize_Panic(
- Tk_PhotoHandle handle,
- int width, int height)
-{
- if (Tk_PhotoSetSize(NULL, handle, width, height) != TCL_OK) {
- Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE);
- }
-}
-#endif /* TK_NO_DEPRECATED */
-
-/*
* Local Variables:
* mode: c
* c-basic-offset: 4