From 0742b95f262dacba096b9725c1de51c35afafc52 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 3 Dec 2004 13:16:34 +0000 Subject: Alpha blending fixes. [Patch 848161] --- ChangeLog | 7 +++++++ generic/tkImgPhoto.c | 52 ++++++++++++++++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index d1e8a65..f2e8791 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-12-03 Donal K. Fellows + + * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): + Make overlay compositing where the target is empty no longer set + the target to magical gray, and also make sure that the + complex-alpha flag is toggled when necessary. [Patch 848161] + 2004-12-02 Jeff Hobbs *** 8.4.9 TAGGED FOR RELEASE *** 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. */ -- cgit v0.12