summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkImgPhInstance.c25
-rw-r--r--tests/canvImg.test3
-rw-r--r--tests/image.test2
-rw-r--r--tests/text.test5
-rw-r--r--tests/textWind.test6
5 files changed, 31 insertions, 10 deletions
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index e209d5d..cbf8222 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -19,6 +19,9 @@
*/
#include "tkImgPhoto.h"
+#ifdef MAC_OSX_TK
+#define TKPUTIMAGE_CAN_BLEND
+#endif
/*
* Declaration for internal Xlib function used here:
@@ -30,7 +33,7 @@ extern int _XInitImageFuncPtrs(XImage *image);
* Forward declarations
*/
-#ifndef MAC_OSX_TK
+#ifndef TKPUTIMAGE_CAN_BLEND
static void BlendComplexAlpha(XImage *bgImg, PhotoInstance *iPtr,
int xOffset, int yOffset, int width, int height);
#endif
@@ -411,7 +414,7 @@ TkImgPhotoGet(
*
*----------------------------------------------------------------------
*/
-#ifndef MAC_OSX_TK
+#ifndef TKPUTIMAGE_CAN_BLEND
#ifndef _WIN32
#define GetRValue(rgb) (UCHAR(((rgb) & red_mask) >> red_shift))
#define GetGValue(rgb) (UCHAR(((rgb) & green_mask) >> green_shift))
@@ -486,7 +489,7 @@ BlendComplexAlpha(
* optimized.
*/
-#if !(defined(_WIN32) || defined(MAC_OSX_TK))
+#if !defined(_WIN32)
if (bgImg->depth < 24) {
unsigned char red_mlen, green_mlen, blue_mlen;
@@ -534,7 +537,7 @@ BlendComplexAlpha(
}
return;
}
-#endif /* !_WIN32 && !MAC_OSX_TK */
+#endif /* !_WIN32 */
for (y = 0; y < height; y++) {
line = (y + yOffset) * iPtr->masterPtr->width;
@@ -577,7 +580,7 @@ BlendComplexAlpha(
}
#undef ALPHA_BLEND
}
-#endif /* MAC_OSX_TK */
+#endif /* TKPUTIMAGE_CAN_BLEND */
/*
*----------------------------------------------------------------------
@@ -609,8 +612,10 @@ TkImgPhotoDisplay(
* to imageX and imageY. */
{
PhotoInstance *instancePtr = clientData;
+#ifndef TKPUTIMAGE_CAN_BLEND
XVisualInfo visInfo = instancePtr->visualInfo;
-
+#endif
+
/*
* If there's no pixmap, it means that an error occurred while creating
* the image instance so it can't be displayed.
@@ -620,14 +625,13 @@ TkImgPhotoDisplay(
return;
}
-#ifdef MAC_OSX_TK
+#ifdef TKPUTIMAGE_CAN_BLEND
/*
- * The Mac version of TkPutImage handles RGBA images directly. There is
+ * If TkPutImage can handle RGBA Ximages directly there is
* no need to call XGetImage or to do the Porter-Duff compositing by hand.
- * We just let the CG graphics library do it, using the graphics hardware.
*/
- unsigned char *rgbaPixels = instancePtr->masterPtr->pix32;
+ unsigned char *rgbaPixels = instancePtr->masterPtr->pix32;
XImage *photo = XCreateImage(display, NULL, 32, ZPixmap, 0, (char*)rgbaPixels,
(unsigned int)instancePtr->width,
(unsigned int)instancePtr->height,
@@ -638,6 +642,7 @@ TkImgPhotoDisplay(
photo->data = NULL;
XDestroyImage(photo);
#else
+
if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA)
&& visInfo.depth >= 15
&& (visInfo.class == DirectColor || visInfo.class == TrueColor)) {
diff --git a/tests/canvImg.test b/tests/canvImg.test
index e16c703..84992f2 100644
--- a/tests/canvImg.test
+++ b/tests/canvImg.test
@@ -722,6 +722,7 @@ test canvImg-9.1 {DisplayImage procedure} -constraints testImageType -setup {
test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup {
.c delete all
+ update
} -body {
image create test foo -variable x
.c create image 50 100 -image foo -tags image -anchor nw
@@ -737,6 +738,7 @@ test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup {
test canvImg-11.1 {TranslateImage procedure} -constraints testImageType -setup {
.c delete all
+ update
} -body {
image create test foo -variable x
.c create image 50 100 -image foo -tags image -anchor nw
@@ -768,6 +770,7 @@ test canvImg-11.3 {ImageChangedProc procedure} -constraints {
testImageType
} -setup {
.c delete all
+ update
} -body {
image create test foo -variable x
image create test foo2 -variable y
diff --git a/tests/image.test b/tests/image.test
index 7322f2f..8121ffd 100644
--- a/tests/image.test
+++ b/tests/image.test
@@ -349,6 +349,7 @@ test image-8.1 {Tk_ImageCmd procedure, "inuse" option} -constraints {
test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup {
.c delete all
imageCleanup
+ update
} -body {
image create test foo -variable x
.c create image 50 50 -image foo
@@ -364,6 +365,7 @@ test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup {
test image-9.2 {Tk_ImageChanged procedure} -constraints testImageType -setup {
.c delete all
imageCleanup
+ update
} -body {
image create test foo -variable x
.c create image 50 50 -image foo
diff --git a/tests/text.test b/tests/text.test
index 021a393..3d89350 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -3033,6 +3033,7 @@ test text-11a.22 {TextWidgetCmd procedure, "sync" option with -command} -setup {
set ::x 0
toplevel .top
pack [text .top.yt]
+ update
set content {}
for {set i 1} {$i < 30} {incr i} {
append content [string repeat "$i " 15] \n
@@ -3059,6 +3060,7 @@ test text-11a.31 {"<<WidgetViewSync>>" event} -setup {
} -body {
toplevel .top
pack [text .top.yt]
+ update
set content {}
for {set i 1} {$i < 300} {incr i} {
append content [string repeat "$i " 15] \n
@@ -3092,6 +3094,7 @@ test text-11a.41 {"sync" "pendingsync" and <<WidgetViewSync>>} -setup {
set res {}
toplevel .top
pack [text .top.yt]
+ update
set content {}
for {set i 1} {$i < 300} {incr i} {
append content [string repeat "$i " 50] \n
@@ -6554,6 +6557,8 @@ test text-27.10 {TextEditCmd procedure, set modified flag} -body {
test text-27.11 {TextEditCmd procedure, set modified flag repeat} -setup {
text .t
pack .t
+# Make sure the Text is mapped before we start
+ update
set ::retval {}
update
} -body {
diff --git a/tests/textWind.test b/tests/textWind.test
index 5f0c9b0..e189663 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -947,6 +947,8 @@ test textWind-11.1 {EmbWinDisplayProc procedure, geometry transforms} -setup {
destroy .f
place forget .t
pack .t
+# Make sure the Text is mapped before we start
+ update
} -body {
.t insert 1.0 "Some sample text"
pack forget .t
@@ -965,6 +967,8 @@ test textWind-11.2 {EmbWinDisplayProc procedure, geometry transforms} -setup {
destroy .t.f
place forget .t
pack .t
+# Make sure the Text is mapped before we start
+ update
} -body {
.t insert 1.0 "Some sample text"
pack forget .t
@@ -984,6 +988,8 @@ test textWind-11.3 {EmbWinDisplayProc procedure, configuration optimization} -se
destroy .f
place forget .t
pack .t
+# Make sure the Text is mapped before we start
+ update
} -body {
.t insert 1.0 "Some sample text"
frame .f -width 30 -height 20 -bg $color