summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordonal.k.fellows@manchester.ac.uk <dkf>2004-10-26 13:15:07 (GMT)
committerdonal.k.fellows@manchester.ac.uk <dkf>2004-10-26 13:15:07 (GMT)
commit5830b7d4f709758a3925190b88ebf69845c71377 (patch)
tree3ac49ba01df01ed987ab98e03f908435a0256200 /generic
parentf4b91a9af92e36c917517da7f8b8d2427e562ea5 (diff)
downloadtk-5830b7d4f709758a3925190b88ebf69845c71377.zip
tk-5830b7d4f709758a3925190b88ebf69845c71377.tar.gz
tk-5830b7d4f709758a3925190b88ebf69845c71377.tar.bz2
Attempt to fix [Bug 919066] by allowing the code that creates the region
much more knowledge of the platform functions available to it.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkImgPhoto.c40
-rw-r--r--generic/tkInt.h7
2 files changed, 17 insertions, 30 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index b997f28..66ed41f 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.49 2004/08/04 14:47:33 dkf Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.50 2004/10/26 13:15:09 dkf Exp $
*/
#include "tkInt.h"
@@ -4558,34 +4558,16 @@ Tk_PhotoPutBlock(interp, handle, blockPtr, x, y, width, height, compRule)
TkDestroyRegion(workRgn);
}
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3;
- for (y1 = 0; y1 < height; y1++) {
- x1 = 0;
- destPtr = destLinePtr;
- while (x1 < width) {
- /* search for first non-transparent pixel */
- while ((x1 < width) && !*destPtr) {
- x1++;
- destPtr += 4;
- }
- end = x1;
- /* search for first transparent pixel */
- while ((end < width) && *destPtr) {
- end++;
- destPtr += 4;
- }
- if (end > x1) {
- rect.x = x + x1;
- rect.y = y + y1;
- rect.width = end - x1;
- rect.height = 1;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
- }
- x1 = end;
- }
- destLinePtr += masterPtr->width * 4;
- }
+ /*
+ * Factorize out the main part of the building of the region
+ * data to allow for more efficient per-platform
+ * implementations. [Bug 919066]
+ */
+
+ TkpBuildRegionFromAlphaData(masterPtr->validRegion, (unsigned) x,
+ (unsigned) y, (unsigned) width, (unsigned) height,
+ masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3,
+ 4, (unsigned) masterPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 4909404..58482f9 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: $Id: tkInt.h,v 1.63 2004/10/05 22:04:44 hobbs Exp $
+ * RCS: $Id: tkInt.h,v 1.64 2004/10/26 13:15:09 dkf Exp $
*/
#ifndef _TKINT
@@ -1176,6 +1176,11 @@ EXTERN void TkCreateExitHandler _ANSI_ARGS_((Tcl_ExitProc *proc,
EXTERN void TkDeleteExitHandler _ANSI_ARGS_((Tcl_ExitProc *proc,
ClientData clientData));
EXTERN Tcl_ExitProc TkFinalize;
+EXTERN void TkpBuildRegionFromAlphaData _ANSI_ARGS_((
+ TkRegion region, unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height,
+ unsigned char *dataPtr, unsigned int pixelStride,
+ unsigned int lineStride));
/*
* Unsupported commands.