summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-12-03 13:16:34 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-12-03 13:16:34 (GMT)
commit0742b95f262dacba096b9725c1de51c35afafc52 (patch)
treec991c94678c5ecaecd933b9d98119dc41e84f8aa /generic/tkImgPhoto.c
parentb485d4c0cff17fb07e95e212baf071285fe3895c (diff)
downloadtk-0742b95f262dacba096b9725c1de51c35afafc52.zip
tk-0742b95f262dacba096b9725c1de51c35afafc52.tar.gz
tk-0742b95f262dacba096b9725c1de51c35afafc52.tar.bz2
Alpha blending fixes. [Patch 848161]
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index f9445af..05b0e57 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.11 2004/12/02 02:07:42 hobbs Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.12 2004/12/03 13:16:35 dkf Exp $
*/
#include "tkInt.h"
@@ -4454,20 +4454,20 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
* Combine according to the compositing rule.
*/
switch (compRule) {
- case TK_PHOTO_COMPOSITE_SET:
- *destPtr++ = srcPtr[0];
- *destPtr++ = srcPtr[greenOffset];
- *destPtr++ = srcPtr[blueOffset];
- *destPtr++ = alpha;
- break;
-
case TK_PHOTO_COMPOSITE_OVERLAY:
if (!destPtr[3]) {
/*
- * There must be a better way to select a
- * background colour!
+ * The destination is entirely
+ * blank, so set it to the source,
+ * just as if we used the SET
+ * compositing rule.
*/
- destPtr[0] = destPtr[1] = destPtr[2] = 0xd9;
+ case TK_PHOTO_COMPOSITE_SET:
+ *destPtr++ = srcPtr[0];
+ *destPtr++ = srcPtr[greenOffset];
+ *destPtr++ = srcPtr[blueOffset];
+ *destPtr++ = alpha;
+ break;
}
if (alpha) {
@@ -4583,6 +4583,12 @@ Tk_PhotoPutBlock(handle, blockPtr, x, y, width, height, compRule)
}
/*
+ * Check if display code needs alpha blending...
+ */
+
+ ToggleComplexAlphaIfNeeded(masterPtr);
+
+ /*
* Update each instance.
*/
@@ -4768,19 +4774,19 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
}
switch (compRule) {
- case TK_PHOTO_COMPOSITE_SET:
- *destPtr++ = srcPtr[0];
- *destPtr++ = srcPtr[greenOffset];
- *destPtr++ = srcPtr[blueOffset];
- *destPtr++ = alpha;
- break;
case TK_PHOTO_COMPOSITE_OVERLAY:
if (!destPtr[3]) {
/*
- * There must be a better way to select a
- * background colour!
+ * The destination is entirely blank,
+ * so set it to the source, just as if
+ * we used the SET compositing rule.
*/
- destPtr[0] = destPtr[1] = destPtr[2] = 0xd9;
+ case TK_PHOTO_COMPOSITE_SET:
+ *destPtr++ = srcPtr[0];
+ *destPtr++ = srcPtr[greenOffset];
+ *destPtr++ = srcPtr[blueOffset];
+ *destPtr++ = alpha;
+ break;
}
if (alpha) {
int Alpha = destPtr[3];
@@ -4869,6 +4875,12 @@ Tk_PhotoPutZoomedBlock(handle, blockPtr, x, y, width, height, zoomX, zoomY,
}
/*
+ * Check if display code needs alpha blending...
+ */
+
+ ToggleComplexAlphaIfNeeded(masterPtr);
+
+ /*
* Update each instance.
*/