summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c636
1 files changed, 318 insertions, 318 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index f875a25..2f749c7 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -185,12 +185,12 @@ static int ParseSubcommandOptions(
int *indexPtr, int objc, Tcl_Obj *const objv[]);
static void ImgPhotoCmdDeletedProc(ClientData clientData);
static int ImgPhotoConfigureMaster(Tcl_Interp *interp,
- PhotoMaster *masterPtr, int objc,
+ PhotoMaster *modelPtr, int objc,
Tcl_Obj *const objv[], int flags);
static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr);
-static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width,
+static int ImgPhotoSetSize(PhotoMaster *modelPtr, int width,
int height);
-static char * ImgGetPhoto(PhotoMaster *masterPtr,
+static char * ImgGetPhoto(PhotoMaster *modelPtr,
Tk_PhotoImageBlock *blockPtr,
struct SubcommandOptions *optPtr);
static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan,
@@ -349,34 +349,34 @@ ImgPhotoCreate(
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- PhotoMaster *masterPtr;
+ PhotoMaster *modelPtr;
(void)typePtr;
/*
* Allocate and initialize the photo image master record.
*/
- masterPtr = (PhotoMaster *)ckalloc(sizeof(PhotoMaster));
- memset(masterPtr, 0, sizeof(PhotoMaster));
- masterPtr->tkMaster = master;
- masterPtr->interp = interp;
- masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
- masterPtr, ImgPhotoCmdDeletedProc);
- masterPtr->palette = NULL;
- masterPtr->pix32 = NULL;
- masterPtr->instancePtr = NULL;
- masterPtr->validRegion = TkCreateRegion();
+ modelPtr = (PhotoMaster *)ckalloc(sizeof(PhotoMaster));
+ memset(modelPtr, 0, sizeof(PhotoMaster));
+ modelPtr->tkMaster = master;
+ modelPtr->interp = interp;
+ modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
+ modelPtr, ImgPhotoCmdDeletedProc);
+ modelPtr->palette = NULL;
+ modelPtr->pix32 = NULL;
+ modelPtr->instancePtr = NULL;
+ modelPtr->validRegion = TkCreateRegion();
/*
* Process configuration options given in the image create command.
*/
- if (ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, 0) != TCL_OK) {
- ImgPhotoDelete(masterPtr);
+ if (ImgPhotoConfigureMaster(interp, modelPtr, objc, objv, 0) != TCL_OK) {
+ ImgPhotoDelete(modelPtr);
return TCL_ERROR;
}
- *clientDataPtr = masterPtr;
+ *clientDataPtr = modelPtr;
return TCL_OK;
}
@@ -415,7 +415,7 @@ ImgPhotoCmd(
PHOTO_WRITE
};
- PhotoMaster *masterPtr = (PhotoMaster *)clientData;
+ PhotoMaster *modelPtr = (PhotoMaster *)clientData;
int result, index, x, y, width, height;
struct SubcommandOptions options;
unsigned char *pixelPtr;
@@ -445,7 +445,7 @@ ImgPhotoCmd(
*/
if (objc == 2) {
- Tk_PhotoBlank(masterPtr);
+ Tk_PhotoBlank(modelPtr);
return TCL_OK;
} else {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
@@ -461,16 +461,16 @@ ImgPhotoCmd(
}
arg = TkGetStringFromObj(objv[2], &length);
if (strncmp(arg,"-data", length) == 0) {
- if (masterPtr->dataString) {
- Tcl_SetObjResult(interp, masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_SetObjResult(interp, modelPtr->dataString);
}
} else if (strncmp(arg,"-format", length) == 0) {
- if (masterPtr->format) {
- Tcl_SetObjResult(interp, masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_SetObjResult(interp, modelPtr->format);
}
} else {
Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
- (char *) masterPtr, Tcl_GetString(objv[2]), 0);
+ (char *) modelPtr, Tcl_GetString(objv[2]), 0);
}
return TCL_OK;
}
@@ -484,21 +484,21 @@ ImgPhotoCmd(
Tcl_Obj *obj, *subobj;
result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, NULL, 0);
+ configSpecs, (char *) modelPtr, NULL, 0);
if (result != TCL_OK) {
return result;
}
obj = Tcl_NewObj();
subobj = Tcl_NewStringObj("-data {} {} {}", 14);
- if (masterPtr->dataString) {
- Tcl_ListObjAppendElement(NULL, subobj, masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->dataString);
} else {
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewStringObj("-format {} {} {}", 16);
- if (masterPtr->format) {
- Tcl_ListObjAppendElement(NULL, subobj, masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format);
} else {
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
@@ -512,13 +512,13 @@ ImgPhotoCmd(
if (length > 1 && !strncmp(arg, "-data", length)) {
Tcl_AppendResult(interp, "-data {} {} {}", NULL);
- if (masterPtr->dataString) {
+ if (modelPtr->dataString) {
/*
* TODO: Modifying result is bad!
*/
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- masterPtr->dataString);
+ modelPtr->dataString);
} else {
Tcl_AppendResult(interp, " {}", NULL);
}
@@ -526,23 +526,23 @@ ImgPhotoCmd(
} else if (length > 1 &&
!strncmp(arg, "-format", length)) {
Tcl_AppendResult(interp, "-format {} {} {}", NULL);
- if (masterPtr->format) {
+ if (modelPtr->format) {
/*
* TODO: Modifying result is bad!
*/
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- masterPtr->format);
+ modelPtr->format);
} else {
Tcl_AppendResult(interp, " {}", NULL);
}
return TCL_OK;
} else {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, arg, 0);
+ configSpecs, (char *) modelPtr, arg, 0);
}
} else {
- return ImgPhotoConfigureMaster(interp, masterPtr, objc-2, objv+2,
+ return ImgPhotoConfigureMaster(interp, modelPtr, objc-2, objv+2,
TK_CONFIG_ARGV_ONLY);
}
@@ -645,7 +645,7 @@ ImgPhotoCmd(
+ options.fromY * block.pitch;
block.width = options.fromX2 - options.fromX;
block.height = options.fromY2 - options.fromY;
- result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr,
+ result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) modelPtr,
&block, options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY, options.zoomX, options.zoomY,
options.subsampleX, options.subsampleY,
@@ -659,7 +659,7 @@ ImgPhotoCmd(
*/
if (options.options & OPT_SHRINK) {
- if (ImgPhotoSetSize(masterPtr, options.toX2,
+ if (ImgPhotoSetSize(modelPtr, options.toX2,
options.toY2) != TCL_OK) {
if (options.background) {
Tk_FreeColor(options.background);
@@ -670,8 +670,8 @@ ImgPhotoCmd(
return TCL_ERROR;
}
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
if (options.background) {
Tk_FreeColor(options.background);
}
@@ -702,10 +702,10 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?");
return TCL_ERROR;
}
- if ((options.fromX > masterPtr->width)
- || (options.fromY > masterPtr->height)
- || (options.fromX2 > masterPtr->width)
- || (options.fromY2 > masterPtr->height)) {
+ if ((options.fromX > modelPtr->width)
+ || (options.fromY > modelPtr->height)
+ || (options.fromX2 > modelPtr->width)
+ || (options.fromY2 > modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"coordinates for -from option extend outside image", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);
@@ -717,8 +717,8 @@ ImgPhotoCmd(
*/
if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) {
- options.fromX2 = masterPtr->width;
- options.fromY2 = masterPtr->height;
+ options.fromX2 = modelPtr->width;
+ options.fromY2 = modelPtr->height;
}
if (!(options.options & OPT_FORMAT)) {
options.format = Tcl_NewStringObj("default", -1);
@@ -772,7 +772,7 @@ ImgPhotoCmd(
* Call the handler's string write function to write out the image.
*/
- data = ImgGetPhoto(masterPtr, &block, &options);
+ data = ImgGetPhoto(modelPtr, &block, &options);
if (oldformat) {
Tcl_DString buffer;
@@ -847,8 +847,8 @@ ImgPhotoCmd(
|| (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
return TCL_ERROR;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s get: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -861,7 +861,7 @@ ImgPhotoCmd(
* Extract the value of the desired pixel and format it as a list.
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
channels[0] = Tcl_NewWideIntObj(pixelPtr[0]);
channels[1] = Tcl_NewWideIntObj(pixelPtr[1]);
channels[2] = Tcl_NewWideIntObj(pixelPtr[2]);
@@ -919,7 +919,7 @@ ImgPhotoCmd(
}
if (imageFormat->stringReadProc(interp, data, format,
- (Tk_PhotoHandle) masterPtr, options.toX, options.toY,
+ (Tk_PhotoHandle) modelPtr, options.toX, options.toY,
options.toX2 - options.toX,
options.toY2 - options.toY, 0, 0) != TCL_OK) {
return TCL_ERROR;
@@ -930,7 +930,7 @@ ImgPhotoCmd(
* takes care to notify the changed image and to set/unset the
* IMAGE_CHANGED bit.
*/
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
return TCL_OK;
}
@@ -1020,7 +1020,7 @@ ImgPhotoCmd(
*/
if (options.options & OPT_SHRINK) {
- if (ImgPhotoSetSize(masterPtr, options.toX + width,
+ if (ImgPhotoSetSize(modelPtr, options.toX + width,
options.toY + height) != TCL_OK) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -1042,7 +1042,7 @@ ImgPhotoCmd(
}
result = imageFormat->fileReadProc(interp, chan,
Tcl_GetString(options.name),
- format, (Tk_PhotoHandle) masterPtr, options.toX,
+ format, (Tk_PhotoHandle) modelPtr, options.toX,
options.toY, width, height, options.fromX, options.fromY);
if (chan != NULL) {
Tcl_Close(NULL, chan);
@@ -1061,27 +1061,27 @@ ImgPhotoCmd(
* present.
*/
- x = masterPtr->ditherX;
- y = masterPtr->ditherY;
- if (masterPtr->ditherX != 0) {
- Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y,
- masterPtr->width - x, 1);
+ x = modelPtr->ditherX;
+ y = modelPtr->ditherY;
+ if (modelPtr->ditherX != 0) {
+ Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y,
+ modelPtr->width - x, 1);
}
- if (masterPtr->ditherY < masterPtr->height) {
+ if (modelPtr->ditherY < modelPtr->height) {
x = 0;
- Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, 0,
- masterPtr->ditherY, masterPtr->width,
- masterPtr->height - masterPtr->ditherY);
+ Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, 0,
+ modelPtr->ditherY, modelPtr->width,
+ modelPtr->height - modelPtr->ditherY);
}
- if (y < masterPtr->height) {
+ if (y < modelPtr->height) {
/*
* Tell the core image code that part of the image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y,
- (masterPtr->width - x), (masterPtr->height - y),
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, x, y,
+ (modelPtr->width - x), (modelPtr->height - y),
+ modelPtr->width, modelPtr->height);
}
return TCL_OK;
@@ -1138,8 +1138,8 @@ ImgPhotoCmd(
boolMode = 0;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s transparency get: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -1151,7 +1151,7 @@ ImgPhotoCmd(
/*
* Extract and return the desired value
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
if (boolMode) {
Tcl_SetObjResult(interp, Tcl_NewBooleanObj( ! pixelPtr[3]));
} else {
@@ -1197,8 +1197,8 @@ ImgPhotoCmd(
boolMode = 0;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s transparency set: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -1229,7 +1229,7 @@ ImgPhotoCmd(
* Set new alpha value for the pixel
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
if (boolMode) {
pixelPtr[3] = newVal ? 0 : 255;
} else {
@@ -1247,11 +1247,11 @@ ImgPhotoCmd(
modRegion = TkCreateRegion();
TkUnionRectWithRegion(&setBox, modRegion, modRegion);
if (pixelPtr[3]) {
- TkUnionRectWithRegion(&setBox, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&setBox, modelPtr->validRegion,
+ modelPtr->validRegion);
} else {
- TkSubtractRegion(masterPtr->validRegion, modRegion,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, modRegion,
+ modelPtr->validRegion);
}
TkDestroyRegion(modRegion);
@@ -1260,9 +1260,9 @@ ImgPhotoCmd(
* has (potentially) changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, 1, 1,
- masterPtr->width, masterPtr->height);
- masterPtr->flags &= ~IMAGE_CHANGED;
+ Tk_ImageChanged(modelPtr->tkMaster, x, y, 1, 1,
+ modelPtr->width, modelPtr->height);
+ modelPtr->flags &= ~IMAGE_CHANGED;
return TCL_OK;
}
@@ -1304,10 +1304,10 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?");
return TCL_ERROR;
}
- if ((options.fromX > masterPtr->width)
- || (options.fromY > masterPtr->height)
- || (options.fromX2 > masterPtr->width)
- || (options.fromY2 > masterPtr->height)) {
+ if ((options.fromX > modelPtr->width)
+ || (options.fromY > modelPtr->height)
+ || (options.fromX2 > modelPtr->width)
+ || (options.fromY2 > modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"coordinates for -from option extend outside image", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);
@@ -1321,8 +1321,8 @@ ImgPhotoCmd(
*/
if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) {
- options.fromX2 = masterPtr->width;
- options.fromY2 = masterPtr->height;
+ options.fromX2 = modelPtr->width;
+ options.fromY2 = modelPtr->height;
}
if (options.format == NULL) {
fmtString = GetExtension(Tcl_GetString(options.name));
@@ -1399,7 +1399,7 @@ ImgPhotoCmd(
* Call the handler's file write function to write out the image.
*/
- data = ImgGetPhoto(masterPtr, &block, &options);
+ data = ImgGetPhoto(modelPtr, &block, &options);
format = options.format;
if (oldformat && format) {
format = (Tcl_Obj *) Tcl_GetString(options.format);
@@ -1751,7 +1751,7 @@ ParseSubcommandOptions(
*
* Results:
* A standard Tcl return value. If TCL_ERROR is returned then an error
- * message is left in the masterPtr->interp's result.
+ * message is left in the modelPtr->interp's result.
*
* Side effects:
* Existing instances of the image will be redisplayed to match the new
@@ -1763,7 +1763,7 @@ ParseSubcommandOptions(
static int
ImgPhotoConfigureMaster(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
- PhotoMaster *masterPtr, /* Pointer to data structure describing
+ PhotoMaster *modelPtr, /* Pointer to data structure describing
* overall photo image to (re)configure. */
int objc, /* Number of entries in objv. */
Tcl_Obj *const objv[], /* Pairs of configuration options for image. */
@@ -1822,28 +1822,28 @@ ImgPhotoConfigureMaster(
* the format string influences how "-data" or "-file" is interpreted.
*/
- oldFileString = masterPtr->fileString;
+ oldFileString = modelPtr->fileString;
if (oldFileString == NULL) {
- oldData = masterPtr->dataString;
+ oldData = modelPtr->dataString;
if (oldData != NULL) {
Tcl_IncrRefCount(oldData);
}
} else {
oldData = NULL;
}
- oldFormat = masterPtr->format;
+ oldFormat = modelPtr->format;
if (oldFormat != NULL) {
Tcl_IncrRefCount(oldFormat);
}
- oldPaletteString = masterPtr->palette;
- oldGamma = masterPtr->gamma;
+ oldPaletteString = modelPtr->palette;
+ oldGamma = modelPtr->gamma;
/*
* Process the configuration options specified.
*/
if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs,
- j, args, (char *) masterPtr, flags) != TCL_OK) {
+ j, args, (char *) modelPtr, flags) != TCL_OK) {
ckfree(args);
goto errorExit;
}
@@ -1853,9 +1853,9 @@ ImgPhotoConfigureMaster(
* Regard the empty string for -file, -data or -format as the null value.
*/
- if ((masterPtr->fileString != NULL) && (masterPtr->fileString[0] == 0)) {
- ckfree(masterPtr->fileString);
- masterPtr->fileString = NULL;
+ if ((modelPtr->fileString != NULL) && (modelPtr->fileString[0] == 0)) {
+ ckfree(modelPtr->fileString);
+ modelPtr->fileString = NULL;
}
if (data) {
/*
@@ -1870,10 +1870,10 @@ ImgPhotoConfigureMaster(
} else {
data = NULL;
}
- if (masterPtr->dataString) {
- Tcl_DecrRefCount(masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_DecrRefCount(modelPtr->dataString);
}
- masterPtr->dataString = data;
+ modelPtr->dataString = data;
}
if (format) {
/*
@@ -1887,18 +1887,18 @@ ImgPhotoConfigureMaster(
} else {
format = NULL;
}
- if (masterPtr->format) {
- Tcl_DecrRefCount(masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_DecrRefCount(modelPtr->format);
}
- masterPtr->format = format;
+ modelPtr->format = format;
}
/*
* Set the image to the user-requested size, if any, and make sure storage
* is correctly allocated for this image.
*/
- if (ImgPhotoSetSize(masterPtr, masterPtr->width,
- masterPtr->height) != TCL_OK) {
+ if (ImgPhotoSetSize(modelPtr, modelPtr->width,
+ modelPtr->height) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
@@ -1910,9 +1910,9 @@ ImgPhotoConfigureMaster(
* -file or -data option.
*/
- if ((masterPtr->fileString != NULL)
- && ((masterPtr->fileString != oldFileString)
- || (masterPtr->format != oldFormat))) {
+ if ((modelPtr->fileString != NULL)
+ && ((modelPtr->fileString != oldFileString)
+ || (modelPtr->format != oldFormat))) {
/*
* Prevent file system access in a safe interpreter.
*/
@@ -1926,7 +1926,7 @@ ImgPhotoConfigureMaster(
goto errorExit;
}
- chan = Tcl_OpenFileChannel(interp, masterPtr->fileString, "r", 0);
+ chan = Tcl_OpenFileChannel(interp, modelPtr->fileString, "r", 0);
if (chan == NULL) {
goto errorExit;
}
@@ -1937,13 +1937,13 @@ ImgPhotoConfigureMaster(
if ((Tcl_SetChannelOption(interp, chan,
"-translation", "binary") != TCL_OK) ||
- (MatchFileFormat(interp, chan, masterPtr->fileString,
- masterPtr->format, &imageFormat, &imageWidth,
+ (MatchFileFormat(interp, chan, modelPtr->fileString,
+ modelPtr->format, &imageFormat, &imageWidth,
&imageHeight, &oldformat) != TCL_OK)) {
Tcl_Close(NULL, chan);
goto errorExit;
}
- result = ImgPhotoSetSize(masterPtr, imageWidth, imageHeight);
+ result = ImgPhotoSetSize(modelPtr, imageWidth, imageHeight);
if (result != TCL_OK) {
Tcl_Close(NULL, chan);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -1951,12 +1951,12 @@ ImgPhotoConfigureMaster(
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
goto errorExit;
}
- tempformat = masterPtr->format;
+ tempformat = modelPtr->format;
if (oldformat && tempformat) {
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
}
result = imageFormat->fileReadProc(interp, chan,
- masterPtr->fileString, tempformat, (Tk_PhotoHandle) masterPtr,
+ modelPtr->fileString, tempformat, (Tk_PhotoHandle) modelPtr,
0, 0, imageWidth, imageHeight, 0, 0);
Tcl_Close(NULL, chan);
if (result != TCL_OK) {
@@ -1964,26 +1964,26 @@ ImgPhotoConfigureMaster(
}
Tcl_ResetResult(interp);
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
}
- if ((masterPtr->fileString == NULL) && (masterPtr->dataString != NULL)
- && ((masterPtr->dataString != oldData)
- || (masterPtr->format != oldFormat))) {
+ if ((modelPtr->fileString == NULL) && (modelPtr->dataString != NULL)
+ && ((modelPtr->dataString != oldData)
+ || (modelPtr->format != oldFormat))) {
- if (MatchStringFormat(interp, masterPtr->dataString,
- masterPtr->format, &imageFormat, &imageWidth,
+ if (MatchStringFormat(interp, modelPtr->dataString,
+ modelPtr->format, &imageFormat, &imageWidth,
&imageHeight, &oldformat) != TCL_OK) {
goto errorExit;
}
- if (ImgPhotoSetSize(masterPtr, imageWidth, imageHeight) != TCL_OK) {
+ if (ImgPhotoSetSize(modelPtr, imageWidth, imageHeight) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
goto errorExit;
}
- tempformat = masterPtr->format;
- tempdata = masterPtr->dataString;
+ tempformat = modelPtr->format;
+ tempdata = modelPtr->dataString;
if (oldformat) {
if (tempformat) {
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
@@ -1991,26 +1991,26 @@ ImgPhotoConfigureMaster(
tempdata = (Tcl_Obj *) Tcl_GetString(tempdata);
}
if (imageFormat->stringReadProc(interp, tempdata, tempformat,
- (Tk_PhotoHandle) masterPtr, 0, 0, imageWidth, imageHeight,
+ (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight,
0, 0) != TCL_OK) {
goto errorExit;
}
Tcl_ResetResult(interp);
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
}
/*
* Enforce a reasonable value for gamma.
*/
- if (masterPtr->gamma <= 0) {
- masterPtr->gamma = 1.0;
+ if (modelPtr->gamma <= 0) {
+ modelPtr->gamma = 1.0;
}
- if ((masterPtr->gamma != oldGamma)
- || (masterPtr->palette != oldPaletteString)) {
- masterPtr->flags |= IMAGE_CHANGED;
+ if ((modelPtr->gamma != oldGamma)
+ || (modelPtr->palette != oldPaletteString)) {
+ modelPtr->flags |= IMAGE_CHANGED;
}
/*
@@ -2019,7 +2019,7 @@ ImgPhotoConfigureMaster(
* everywhere that it is used.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgPhotoConfigureInstance(instancePtr);
}
@@ -2028,9 +2028,9 @@ ImgPhotoConfigureMaster(
* Inform the generic image code that the image has (potentially) changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
- masterPtr->flags &= ~IMAGE_CHANGED;
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
+ modelPtr->flags &= ~IMAGE_CHANGED;
if (oldData != NULL) {
Tcl_DecrRefCount(oldData);
@@ -2039,7 +2039,7 @@ ImgPhotoConfigureMaster(
Tcl_DecrRefCount(oldFormat);
}
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
return TCL_OK;
@@ -2121,34 +2121,34 @@ ImgPhotoDelete(
ClientData masterData) /* Pointer to PhotoMaster structure for image.
* Must not have any more instances. */
{
- PhotoMaster *masterPtr = (PhotoMaster *)masterData;
+ PhotoMaster *modelPtr = (PhotoMaster *)masterData;
PhotoInstance *instancePtr;
- while ((instancePtr = masterPtr->instancePtr) != NULL) {
+ while ((instancePtr = modelPtr->instancePtr) != NULL) {
if (instancePtr->refCount > 0) {
Tcl_Panic("tried to delete photo image when instances still exist");
}
Tcl_CancelIdleCall(TkImgDisposeInstance, instancePtr);
TkImgDisposeInstance(instancePtr);
}
- masterPtr->tkMaster = NULL;
- if (masterPtr->imageCmd != NULL) {
- Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd);
+ modelPtr->tkMaster = NULL;
+ if (modelPtr->imageCmd != NULL) {
+ Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd);
}
- if (masterPtr->pix32 != NULL) {
- ckfree(masterPtr->pix32);
+ if (modelPtr->pix32 != NULL) {
+ ckfree(modelPtr->pix32);
}
- if (masterPtr->validRegion != NULL) {
- TkDestroyRegion(masterPtr->validRegion);
+ if (modelPtr->validRegion != NULL) {
+ TkDestroyRegion(modelPtr->validRegion);
}
- if (masterPtr->dataString != NULL) {
- Tcl_DecrRefCount(masterPtr->dataString);
+ if (modelPtr->dataString != NULL) {
+ Tcl_DecrRefCount(modelPtr->dataString);
}
- if (masterPtr->format != NULL) {
- Tcl_DecrRefCount(masterPtr->format);
+ if (modelPtr->format != NULL) {
+ Tcl_DecrRefCount(modelPtr->format);
}
- Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
- ckfree(masterPtr);
+ Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0);
+ ckfree(modelPtr);
}
/*
@@ -2173,11 +2173,11 @@ ImgPhotoCmdDeletedProc(
ClientData clientData) /* Pointer to PhotoMaster structure for
* image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *)clientData;
+ PhotoMaster *modelPtr = (PhotoMaster *)clientData;
- masterPtr->imageCmd = NULL;
- if (masterPtr->tkMaster != NULL) {
- Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
+ modelPtr->imageCmd = NULL;
+ if (modelPtr->tkMaster != NULL) {
+ Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkMaster));
}
}
@@ -2202,7 +2202,7 @@ ImgPhotoCmdDeletedProc(
static int
ImgPhotoSetSize(
- PhotoMaster *masterPtr,
+ PhotoMaster *modelPtr,
int width, int height)
{
unsigned char *newPix32 = NULL;
@@ -2212,11 +2212,11 @@ ImgPhotoSetSize(
TkRegion clipRegion;
PhotoInstance *instancePtr;
- if (masterPtr->userWidth > 0) {
- width = masterPtr->userWidth;
+ if (modelPtr->userWidth > 0) {
+ width = modelPtr->userWidth;
}
- if (masterPtr->userHeight > 0) {
- height = masterPtr->userHeight;
+ if (modelPtr->userHeight > 0) {
+ height = modelPtr->userHeight;
}
if (width > INT_MAX / 4) {
@@ -2230,8 +2230,8 @@ ImgPhotoSetSize(
* failures will leave the photo unchanged.
*/
- if ((width != masterPtr->width) || (height != masterPtr->height)
- || (masterPtr->pix32 == NULL)) {
+ if ((width != modelPtr->width) || (height != modelPtr->height)
+ || (modelPtr->pix32 == NULL)) {
unsigned newPixSize;
if (pitch && height > (int)(UINT_MAX / pitch)) {
@@ -2258,7 +2258,7 @@ ImgPhotoSetSize(
* image size.
*/
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
if ((validBox.x + validBox.width > width)
|| (validBox.y + validBox.height > height)) {
clipBox.x = 0;
@@ -2267,10 +2267,10 @@ ImgPhotoSetSize(
clipBox.height = height;
clipRegion = TkCreateRegion();
TkUnionRectWithRegion(&clipBox, clipRegion, clipRegion);
- TkIntersectRegion(masterPtr->validRegion, clipRegion,
- masterPtr->validRegion);
+ TkIntersectRegion(modelPtr->validRegion, clipRegion,
+ modelPtr->validRegion);
TkDestroyRegion(clipRegion);
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
}
/*
@@ -2286,8 +2286,8 @@ ImgPhotoSetSize(
* or written to a file.
*/
- if ((masterPtr->pix32 != NULL)
- && ((width == masterPtr->width) || (width == validBox.width))) {
+ if ((modelPtr->pix32 != NULL)
+ && ((width == modelPtr->width) || (width == validBox.width))) {
if (validBox.y > 0) {
memset(newPix32, 0, ((size_t) validBox.y * pitch));
}
@@ -2299,20 +2299,20 @@ ImgPhotoSetSize(
memset(newPix32, 0, ((size_t)height * pitch));
}
- if (masterPtr->pix32 != NULL) {
+ if (modelPtr->pix32 != NULL) {
/*
* Copy the common area over to the new array array and free the
* old array.
*/
- if (width == masterPtr->width) {
+ if (width == modelPtr->width) {
/*
* The region to be copied is contiguous.
*/
offset = validBox.y * pitch;
- memcpy(newPix32 + offset, masterPtr->pix32 + offset,
+ memcpy(newPix32 + offset, modelPtr->pix32 + offset,
((size_t)validBox.height * pitch));
} else if ((validBox.width > 0) && (validBox.height > 0)) {
@@ -2321,21 +2321,21 @@ ImgPhotoSetSize(
*/
destPtr = newPix32 + (validBox.y * width + validBox.x) * 4;
- srcPtr = masterPtr->pix32 + (validBox.y * masterPtr->width
+ srcPtr = modelPtr->pix32 + (validBox.y * modelPtr->width
+ validBox.x) * 4;
for (h = validBox.height; h > 0; h--) {
memcpy(destPtr, srcPtr, ((size_t)validBox.width * 4));
destPtr += width * 4;
- srcPtr += masterPtr->width * 4;
+ srcPtr += modelPtr->width * 4;
}
}
- ckfree(masterPtr->pix32);
+ ckfree(modelPtr->pix32);
}
- masterPtr->pix32 = newPix32;
- masterPtr->width = width;
- masterPtr->height = height;
+ modelPtr->pix32 = newPix32;
+ modelPtr->width = width;
+ modelPtr->height = height;
/*
* Dithering will be correct up to the end of the last pre-existing
@@ -2343,27 +2343,27 @@ ImgPhotoSetSize(
*/
if ((validBox.x > 0) || (validBox.y > 0)) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY = 0;
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = 0;
} else if (validBox.width == width) {
- if ((int) validBox.height < masterPtr->ditherY) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY = validBox.height;
+ if ((int) validBox.height < modelPtr->ditherY) {
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = validBox.height;
}
- } else if ((masterPtr->ditherY > 0)
- || ((int) validBox.width < masterPtr->ditherX)) {
- masterPtr->ditherX = validBox.width;
- masterPtr->ditherY = 0;
+ } else if ((modelPtr->ditherY > 0)
+ || ((int) validBox.width < modelPtr->ditherX)) {
+ modelPtr->ditherX = validBox.width;
+ modelPtr->ditherY = 0;
}
}
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
/*
* Now adjust the sizes of the pixmaps for all of the instances.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgPhotoInstanceSetSize(instancePtr);
}
@@ -2764,7 +2764,7 @@ Tk_PhotoPutBlock(
int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *modelPtr = (PhotoMaster *) handle;
Tk_PhotoImageBlock sourceBlock;
unsigned char *memToFree;
int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
@@ -2783,12 +2783,12 @@ Tk_PhotoPutBlock(
compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO;
- if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
- width = masterPtr->userWidth - x;
+ if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) {
+ width = modelPtr->userWidth - x;
}
- if ((masterPtr->userHeight != 0)
- && ((y + height) > masterPtr->userHeight)) {
- height = masterPtr->userHeight - y;
+ if ((modelPtr->userHeight != 0)
+ && ((y + height) > modelPtr->userHeight)) {
+ height = modelPtr->userHeight - y;
}
if ((width <= 0) || (height <= 0)) {
return TCL_OK;
@@ -2809,18 +2809,18 @@ Tk_PhotoPutBlock(
*/
sourceBlock = *blockPtr;
memToFree = NULL;
- if (sourceBlock.pixelPtr >= masterPtr->pix32
- && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width
- * masterPtr->height * 4) {
+ if (sourceBlock.pixelPtr >= modelPtr->pix32
+ && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width
+ * modelPtr->height * 4) {
/*
* Fix 5c51be6411: avoid reading
*
* (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize)
*
- * bytes past the end of masterPtr->pix32[] when
+ * bytes past the end of modelPtr->pix32[] when
*
- * blockPtr->pixelPtr > (masterPtr->pix32 +
- * 4 * masterPtr->width * masterPtr->height -
+ * blockPtr->pixelPtr > (modelPtr->pix32 +
+ * 4 * modelPtr->width * modelPtr->height -
* sourceBlock.height * sourceBlock.pitch)
*/
unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch +
@@ -2842,9 +2842,9 @@ Tk_PhotoPutBlock(
xEnd = x + width;
yEnd = y + height;
- if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
- MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
+ if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width),
+ MAX(yEnd, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -2854,14 +2854,14 @@ Tk_PhotoPutBlock(
}
}
- if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
- && (x < masterPtr->ditherX))) {
+ if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY)
+ && (x < modelPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
- masterPtr->ditherX = x;
- masterPtr->ditherY = y;
+ modelPtr->ditherX = x;
+ modelPtr->ditherY = y;
}
/*
@@ -2879,7 +2879,7 @@ Tk_PhotoPutBlock(
alphaOffset -= sourceBlock.offset[0];
}
if ((greenOffset != 0) || (blueOffset != 0)) {
- masterPtr->flags |= COLOR_IMAGE;
+ modelPtr->flags |= COLOR_IMAGE;
}
/*
@@ -2887,8 +2887,8 @@ Tk_PhotoPutBlock(
* single memmove, we do.
*/
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
- pitch = masterPtr->width * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
+ pitch = modelPtr->width * 4;
/*
* Test to see if we can do the whole write in a single copy. This test is
@@ -2899,7 +2899,7 @@ Tk_PhotoPutBlock(
if ((sourceBlock.pixelSize == 4)
&& (greenOffset == 1) && (blueOffset == 2) && (alphaOffset == 3)
&& (width <= sourceBlock.width) && (height <= sourceBlock.height)
- && ((height == 1) || ((x == 0) && (width == masterPtr->width)
+ && ((height == 1) || ((x == 0) && (width == modelPtr->width)
&& (sourceBlock.pitch == pitch)))
&& (compRule == TK_PHOTO_COMPOSITE_SET)) {
memmove(destLinePtr, sourceBlock.pixelPtr + sourceBlock.offset[0],
@@ -3081,8 +3081,8 @@ Tk_PhotoPutBlock(
rect.width = width;
rect.height = height;
TkUnionRectWithRegion(&rect, workRgn, workRgn);
- TkSubtractRegion(masterPtr->validRegion, workRgn,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, workRgn,
+ modelPtr->validRegion);
TkDestroyRegion(workRgn);
}
@@ -3091,17 +3091,17 @@ Tk_PhotoPutBlock(
* allow for more efficient per-platform implementations. [Bug 919066]
*/
- TkpBuildRegionFromAlphaData(masterPtr->validRegion, (unsigned) x,
+ TkpBuildRegionFromAlphaData(modelPtr->validRegion, (unsigned) x,
(unsigned) y, (unsigned) width, (unsigned) height,
- masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3,
- 4, (unsigned) masterPtr->width * 4);
+ modelPtr->pix32 + (y * modelPtr->width + x) * 4 + 3,
+ 4, (unsigned) modelPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&rect, modelPtr->validRegion,
+ modelPtr->validRegion);
}
/*
@@ -3116,21 +3116,21 @@ Tk_PhotoPutBlock(
* [Patch 1539990]
*/
- if (!(masterPtr->flags & COMPLEX_ALPHA)) {
+ if (!(modelPtr->flags & COMPLEX_ALPHA)) {
int x1;
for (x1=x ; x1<x+width ; x1++) {
unsigned char newAlpha;
- destLinePtr = masterPtr->pix32 + (y*masterPtr->width + x1)*4;
+ destLinePtr = modelPtr->pix32 + (y*modelPtr->width + x1)*4;
newAlpha = destLinePtr[3];
if (newAlpha && newAlpha != 255) {
- masterPtr->flags |= COMPLEX_ALPHA;
+ modelPtr->flags |= COMPLEX_ALPHA;
break;
}
}
}
- } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
+ } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
* rescan if we already knew such pixels existed. To restrict this
@@ -3138,21 +3138,21 @@ Tk_PhotoPutBlock(
* the alpha pixels are.
*/
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
}
/*
* Update each instance.
*/
- Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, x, y, width, height);
+ Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, x, y, width, height);
/*
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height,
+ modelPtr->width, modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3202,7 +3202,7 @@ Tk_PhotoPutZoomedBlock(
int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *modelPtr = (PhotoMaster *) handle;
Tk_PhotoImageBlock sourceBlock;
unsigned char *memToFree;
int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
@@ -3230,12 +3230,12 @@ Tk_PhotoPutZoomedBlock(
if (zoomX <= 0 || zoomY <= 0) {
return TCL_OK;
}
- if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
- width = masterPtr->userWidth - x;
+ if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) {
+ width = modelPtr->userWidth - x;
}
- if ((masterPtr->userHeight != 0)
- && ((y + height) > masterPtr->userHeight)) {
- height = masterPtr->userHeight - y;
+ if ((modelPtr->userHeight != 0)
+ && ((y + height) > modelPtr->userHeight)) {
+ height = modelPtr->userHeight - y;
}
if (width <= 0 || height <= 0) {
return TCL_OK;
@@ -3255,18 +3255,18 @@ Tk_PhotoPutZoomedBlock(
*/
sourceBlock = *blockPtr;
memToFree = NULL;
- if (sourceBlock.pixelPtr >= masterPtr->pix32
- && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width
- * masterPtr->height * 4) {
+ if (sourceBlock.pixelPtr >= modelPtr->pix32
+ && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width
+ * modelPtr->height * 4) {
/*
* Fix 5c51be6411: avoid reading
*
* (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize)
*
- * bytes past the end of masterPtr->pix32[] when
+ * bytes past the end of modelPtr->pix32[] when
*
- * blockPtr->pixelPtr > (masterPtr->pix32 +
- * 4 * masterPtr->width * masterPtr->height -
+ * blockPtr->pixelPtr > (modelPtr->pix32 +
+ * 4 * modelPtr->width * modelPtr->height -
* sourceBlock.height * sourceBlock.pitch)
*/
unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch +
@@ -3287,9 +3287,9 @@ Tk_PhotoPutZoomedBlock(
xEnd = x + width;
yEnd = y + height;
- if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
- MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
+ if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width),
+ MAX(yEnd, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3299,14 +3299,14 @@ Tk_PhotoPutZoomedBlock(
}
}
- if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
- && (x < masterPtr->ditherX))) {
+ if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY)
+ && (x < modelPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
- masterPtr->ditherX = x;
- masterPtr->ditherY = y;
+ modelPtr->ditherX = x;
+ modelPtr->ditherY = y;
}
/*
@@ -3324,7 +3324,7 @@ Tk_PhotoPutZoomedBlock(
alphaOffset -= sourceBlock.offset[0];
}
if ((greenOffset != 0) || (blueOffset != 0)) {
- masterPtr->flags |= COLOR_IMAGE;
+ modelPtr->flags |= COLOR_IMAGE;
}
/*
@@ -3353,7 +3353,7 @@ Tk_PhotoPutZoomedBlock(
* Copy the data into our local 32-bit/pixel array.
*/
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
srcOrigPtr = sourceBlock.pixelPtr + sourceBlock.offset[0];
if (subsampleX < 0) {
srcOrigPtr += (sourceBlock.width - 1) * sourceBlock.pixelSize;
@@ -3362,7 +3362,7 @@ Tk_PhotoPutZoomedBlock(
srcOrigPtr += (sourceBlock.height - 1) * sourceBlock.pitch;
}
- pitch = masterPtr->width * 4;
+ pitch = modelPtr->width * 4;
for (hLeft = height; hLeft > 0; ) {
hCopy = MIN(hLeft, blockHt);
hLeft -= hCopy;
@@ -3449,22 +3449,22 @@ Tk_PhotoPutZoomedBlock(
rect.width = width;
rect.height = 1;
TkUnionRectWithRegion(&rect, workRgn, workRgn);
- TkSubtractRegion(masterPtr->validRegion, workRgn,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, workRgn,
+ modelPtr->validRegion);
TkDestroyRegion(workRgn);
}
- TkpBuildRegionFromAlphaData(masterPtr->validRegion,
+ TkpBuildRegionFromAlphaData(modelPtr->validRegion,
(unsigned)x, (unsigned)y, (unsigned)width, (unsigned)height,
- &masterPtr->pix32[(y * masterPtr->width + x) * 4 + 3], 4,
- (unsigned) masterPtr->width * 4);
+ &modelPtr->pix32[(y * modelPtr->width + x) * 4 + 3], 4,
+ (unsigned) modelPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&rect, modelPtr->validRegion,
+ modelPtr->validRegion);
}
/*
@@ -3477,38 +3477,38 @@ Tk_PhotoPutZoomedBlock(
* builds up large simple-alpha images by single pixels. We don't
* negate COMPLEX_ALPHA in this case. [Bug 1409140]
*/
- if (!(masterPtr->flags & COMPLEX_ALPHA)) {
+ if (!(modelPtr->flags & COMPLEX_ALPHA)) {
unsigned char newAlpha;
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
newAlpha = destLinePtr[3];
if (newAlpha && newAlpha != 255) {
- masterPtr->flags |= COMPLEX_ALPHA;
+ modelPtr->flags |= COMPLEX_ALPHA;
}
}
- } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
+ } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
* rescan if we already knew such pixels existed. To restrict this
* Toggle to only checking the changed pixels requires knowing where
* the alpha pixels are.
*/
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
}
/*
* Update each instance.
*/
- Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y, width, height);
+ Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y, width, height);
/*
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height, modelPtr->width,
+ modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3533,7 +3533,7 @@ Tk_PhotoPutZoomedBlock(
*
* Side effects:
* The pixmap of each instance of this image gets updated. The fields in
- * *masterPtr indicating which area of the image is correctly dithered
+ * *modelPtr indicating which area of the image is correctly dithered
* get updated.
*
*----------------------------------------------------------------------
@@ -3547,14 +3547,14 @@ Tk_DitherPhoto(
* area to be dithered. */
int width, int height) /* Dimensions of the area to be dithered. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) photo;
+ PhotoMaster *modelPtr = (PhotoMaster *) photo;
PhotoInstance *instancePtr;
if ((width <= 0) || (height <= 0)) {
return;
}
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgDitherInstance(instancePtr, x, y, width, height);
}
@@ -3564,23 +3564,23 @@ Tk_DitherPhoto(
* will extend the correctly dithered region.
*/
- if (((y < masterPtr->ditherY)
- || ((y == masterPtr->ditherY) && (x <= masterPtr->ditherX)))
- && ((y + height) > (masterPtr->ditherY))) {
+ if (((y < modelPtr->ditherY)
+ || ((y == modelPtr->ditherY) && (x <= modelPtr->ditherX)))
+ && ((y + height) > (modelPtr->ditherY))) {
/*
* This block starts inside (or immediately after) the correctly
* dithered region, so the first scan line at least will be right.
- * Furthermore this block extends into scanline masterPtr->ditherY.
+ * Furthermore this block extends into scanline modelPtr->ditherY.
*/
- if ((x == 0) && (width == masterPtr->width)) {
+ if ((x == 0) && (width == modelPtr->width)) {
/*
* We are doing the full width, therefore the dithering will be
* correct to the end.
*/
- masterPtr->ditherX = 0;
- masterPtr->ditherY = y + height;
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = y + height;
} else {
/*
* We are doing partial scanlines, therefore the
@@ -3588,11 +3588,11 @@ Tk_DitherPhoto(
* line.
*/
- if (x <= masterPtr->ditherX) {
- masterPtr->ditherX = x + width;
- if (masterPtr->ditherX >= masterPtr->width) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY++;
+ if (x <= modelPtr->ditherX) {
+ modelPtr->ditherX = x + width;
+ if (modelPtr->ditherX >= modelPtr->width) {
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY++;
}
}
}
@@ -3620,29 +3620,29 @@ void
Tk_PhotoBlank(
Tk_PhotoHandle handle) /* Handle for the image to be blanked. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *modelPtr = (PhotoMaster *) handle;
PhotoInstance *instancePtr;
- masterPtr->ditherX = masterPtr->ditherY = 0;
- masterPtr->flags = 0;
+ modelPtr->ditherX = modelPtr->ditherY = 0;
+ modelPtr->flags = 0;
/*
* The image has valid data nowhere.
*/
- if (masterPtr->validRegion != NULL) {
- TkDestroyRegion(masterPtr->validRegion);
+ if (modelPtr->validRegion != NULL) {
+ TkDestroyRegion(modelPtr->validRegion);
}
- masterPtr->validRegion = TkCreateRegion();
+ modelPtr->validRegion = TkCreateRegion();
/*
* Clear out the 32-bit pixel storage array. Clear out the dithering error
* arrays for each instance.
*/
- memset(masterPtr->pix32, 0,
- ((size_t)masterPtr->width * masterPtr->height * 4));
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ memset(modelPtr->pix32, 0,
+ ((size_t)modelPtr->width * modelPtr->height * 4));
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgResetDither(instancePtr);
}
@@ -3651,8 +3651,8 @@ Tk_PhotoBlank(
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
}
/*
@@ -3682,17 +3682,17 @@ Tk_PhotoExpand(
Tk_PhotoHandle handle, /* Handle for the image to be expanded. */
int width, int height) /* Desired minimum dimensions of the image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *modelPtr = (PhotoMaster *) handle;
- if (width <= masterPtr->width) {
- width = masterPtr->width;
+ if (width <= modelPtr->width) {
+ width = modelPtr->width;
}
- if (height <= masterPtr->height) {
- height = masterPtr->height;
+ if (height <= modelPtr->height) {
+ height = modelPtr->height;
}
- if ((width != masterPtr->width) || (height != masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(width, masterPtr->width),
- MAX(height, masterPtr->height)) == TCL_ERROR) {
+ if ((width != modelPtr->width) || (height != modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(width, modelPtr->width),
+ MAX(height, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3700,8 +3700,8 @@ Tk_PhotoExpand(
}
return TCL_ERROR;
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, modelPtr->width,
+ modelPtr->height);
}
return TCL_OK;
}
@@ -3730,10 +3730,10 @@ Tk_PhotoGetSize(
/* The dimensions of the image are returned
* here. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *modelPtr = (PhotoMaster *) handle;
- *widthPtr = masterPtr->width;
- *heightPtr = masterPtr->height;
+ *widthPtr = modelPtr->width;
+ *heightPtr = modelPtr->height;
}
/*
@@ -3762,12 +3762,12 @@ Tk_PhotoSetSize(
* set. */
int width, int height) /* New dimensions for the image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *modelPtr = (PhotoMaster *) handle;
- masterPtr->userWidth = width;
- masterPtr->userHeight = height;
- if (ImgPhotoSetSize(masterPtr, ((width > 0) ? width: masterPtr->width),
- ((height > 0) ? height: masterPtr->height)) == TCL_ERROR) {
+ modelPtr->userWidth = width;
+ modelPtr->userHeight = height;
+ if (ImgPhotoSetSize(modelPtr, ((width > 0) ? width: modelPtr->width),
+ ((height > 0) ? height: modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3775,8 +3775,8 @@ Tk_PhotoSetSize(
}
return TCL_ERROR;
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
return TCL_OK;
}
@@ -3805,9 +3805,9 @@ TkPhotoGetValidRegion(
Tk_PhotoHandle handle) /* Handle for the image whose valid region is
* to obtained. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *modelPtr = (PhotoMaster *) handle;
- return masterPtr->validRegion;
+ return modelPtr->validRegion;
}
/*
@@ -3833,7 +3833,7 @@ TkPhotoGetValidRegion(
static char *
ImgGetPhoto(
- PhotoMaster *masterPtr, /* Handle for the photo image from which image
+ PhotoMaster *modelPtr, /* Handle for the photo image from which image
* data is desired. */
Tk_PhotoImageBlock *blockPtr,
/* Information about the address and layout of
@@ -3843,13 +3843,13 @@ ImgGetPhoto(
unsigned char *pixelPtr;
int x, y, greenOffset, blueOffset, alphaOffset;
- Tk_PhotoGetImage((Tk_PhotoHandle) masterPtr, blockPtr);
+ Tk_PhotoGetImage((Tk_PhotoHandle) modelPtr, blockPtr);
blockPtr->pixelPtr += optPtr->fromY * blockPtr->pitch
+ optPtr->fromX * blockPtr->pixelSize;
blockPtr->width = optPtr->fromX2 - optPtr->fromX;
blockPtr->height = optPtr->fromY2 - optPtr->fromY;
- if (!(masterPtr->flags & COLOR_IMAGE) &&
+ if (!(modelPtr->flags & COLOR_IMAGE) &&
(!(optPtr->options & OPT_BACKGROUND)
|| ((optPtr->background->red == optPtr->background->green)
&& (optPtr->background->red == optPtr->background->blue)))) {
@@ -4030,12 +4030,12 @@ Tk_PhotoGetImage(
/* Information about the address and layout of
* the image data is returned here. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoMaster *modelPtr = (PhotoMaster *) handle;
- blockPtr->pixelPtr = masterPtr->pix32;
- blockPtr->width = masterPtr->width;
- blockPtr->height = masterPtr->height;
- blockPtr->pitch = masterPtr->width * 4;
+ blockPtr->pixelPtr = modelPtr->pix32;
+ blockPtr->width = modelPtr->width;
+ blockPtr->height = modelPtr->height;
+ blockPtr->pitch = modelPtr->width * 4;
blockPtr->pixelSize = 4;
blockPtr->offset[0] = 0;
blockPtr->offset[1] = 1;