summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkImgPhoto.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index e1d83ef..c6c5e2c 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -17,7 +17,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.15 2006/03/15 23:11:01 dkf Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.16 2006/03/16 00:42:55 dkf Exp $
*/
#include "tkInt.h"
@@ -188,6 +188,13 @@ typedef struct PhotoMaster {
#define COMPLEX_ALPHA 4
/*
+ * Flag to OR with the compositing rule to indicate that the source, despite
+ * having an alpha channel, has simple alpha.
+ */
+
+#define SOURCE_IS_SIMPLE_ALPHA_PHOTO 0x10000000
+
+/*
* The following data structure represents all of the instances of
* a photo image in windows on a given screen that are using the
* same colormap.
@@ -840,6 +847,15 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
/*
+ * Hack to pass through the message that the place we're coming from
+ * has a simple alpha channel.
+ */
+
+ if (!(((PhotoMaster *) srcHandle)->flags & COMPLEX_ALPHA)) {
+ options.compositingRule |= SOURCE_IS_SIMPLE_ALPHA_PHOTO;
+ }
+
+ /*
* Fill in default values for unspecified parameters.
*/
@@ -4337,9 +4353,11 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
unsigned char *srcPtr, *srcLinePtr;
unsigned char *destPtr, *destLinePtr;
int pitch;
+ int sourceIsSimplePhoto = compRule & SOURCE_IS_SIMPLE_ALPHA_PHOTO;
XRectangle rect;
masterPtr = (PhotoMaster *) handle;
+ compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO;
if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
width = masterPtr->userWidth - x;
@@ -4386,6 +4404,7 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
alphaOffset = blockPtr->offset[3];
if ((alphaOffset >= blockPtr->pixelSize) || (alphaOffset < 0)) {
alphaOffset = 0;
+ sourceIsSimplePhoto = 1;
} else {
alphaOffset -= blockPtr->offset[0];
}
@@ -4586,7 +4605,7 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
* Check if display code needs alpha blending...
*/
- if (alphaOffset != 0 || masterPtr->flags & COMPLEX_ALPHA) {
+ if (!sourceIsSimplePhoto || masterPtr->flags & COMPLEX_ALPHA) {
/*
* Note that we skip in the single pixel case if we can. This speeds
* up code that builds up large simple-alpha images by single pixels,
@@ -4666,7 +4685,7 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
unsigned char *destPtr, *destLinePtr;
int pitch;
int xRepeat, yRepeat;
- int blockXSkip, blockYSkip;
+ int blockXSkip, blockYSkip, sourceIsSimplePhoto;
XRectangle rect;
if (zoomX==1 && zoomY==1 && subsampleX==1 && subsampleY==1) {
@@ -4674,6 +4693,8 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
return;
}
+ sourceIsSimplePhoto = compRule & SOURCE_IS_SIMPLE_ALPHA_PHOTO;
+ compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO;
masterPtr = (PhotoMaster *) handle;
if (zoomX <= 0 || zoomY <= 0) {
@@ -4724,6 +4745,7 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
alphaOffset = blockPtr->offset[3];
if ((alphaOffset >= blockPtr->pixelSize) || (alphaOffset < 0)) {
alphaOffset = 0;
+ sourceIsSimplePhoto = 1;
} else {
alphaOffset -= blockPtr->offset[0];
}
@@ -4897,7 +4919,7 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
* Check if display code needs alpha blending...
*/
- if (alphaOffset != 0 || masterPtr->flags & COMPLEX_ALPHA) {
+ if (!sourceIsSimplePhoto || masterPtr->flags & COMPLEX_ALPHA) {
/*
* Note that we skip in the single pixel case if we can. This speeds
* up code that builds up large simple-alpha images by single pixels,