summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-01-06 09:22:29 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-01-06 09:22:29 (GMT)
commit647d64253b5c0c4ad94711d033771789bbc6bc6c (patch)
tree2757587ce119934387f19e8713ab8aee47378a33
parent8d93348cffe3865ce4da133b780e231e7686bca5 (diff)
downloadtk-647d64253b5c0c4ad94711d033771789bbc6bc6c.zip
tk-647d64253b5c0c4ad94711d033771789bbc6bc6c.tar.gz
tk-647d64253b5c0c4ad94711d033771789bbc6bc6c.tar.bz2
Apply [Patch 1539990] to speed up Tk_PhotoPutBlock in one case.
-rw-r--r--ChangeLog26
-rw-r--r--generic/tkImgPhoto.c25
2 files changed, 30 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 295572e..dcfc8c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,12 @@
+2009-01-06 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock): Optimize a common case for
+ photo image building. [Patch 1539990] (jepler)
+
2009-01-06 Pat Thoyts <patthoyts@users.sourceforge.net>
- * win/tkWinDialog.c: Use task modal for messagebox instead of
- system modal [Bug 2484771] (ferrieux,thoyts,mjanssen)
+ * win/tkWinDialog.c: Use task modal for messagebox instead of system
+ modal. [Bug 2484771] (ferrieux,thoyts,mjanssen)
2009-01-03 Donal K. Fellows <dkf@users.sf.net>
@@ -16,17 +21,16 @@
2008-12-31 David Gravereaux <davygrvy@pobox.com>
- * win/rules.vc: small bug not setting SYMBOLS macro fixed.
+ * win/rules.vc: Small bug not setting SYMBOLS macro fixed.
2008-12-31 Joe English <jenglish@users.sourceforge.net>
- * generic/ttk/ttkDefaultTheme.c: Fix color palette for
- radiobutton and checkbutton indicators. Fixes [Bug 2003310];
- also makes "alt" theme check/radiobuttons look like Windows 98,
- as intended.
- * library/ttk/altTheme.tcl: Specify dark gray -bordercolor
- to soften edges.
- * tests/ttk/{checkbutton,radiobutton}.test: split out of ttk.test.
+ * generic/ttk/ttkDefaultTheme.c: Fix color palette for radiobutton and
+ checkbutton indicators. Fixes [Bug 2003310]; also makes "alt" theme
+ check/radiobuttons look like Windows 98, as intended.
+ * library/ttk/altTheme.tcl: Specify dark gray -bordercolor to soften
+ edges.
+ * tests/ttk/{checkbutton,radiobutton}.test: Split out of ttk.test.
2008-12-28 Donal K. Fellows <dkf@users.sf.net>
@@ -114,7 +118,7 @@
2008-12-12 Pat Thoyts <patthoyts@users.sourceforge.net>
- * library/demos/fontchoose.tcl: Simple fontchooser demo
+ * library/demos/fontchoose.tcl: Simple fontchooser demo.
* library/demos/widget:
2008-12-11 Jan Nijtmans <nijtmans@users.sf.net>
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 1513607..4722095 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.88 2008/11/18 23:49:43 nijtmans Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.89 2009/01/06 09:22:30 dkf Exp $
*/
#include "tkImgPhoto.h"
@@ -2849,21 +2849,26 @@ Tk_PhotoPutBlock(
* Check if display code needs alpha blending...
*/
- if (!sourceIsSimplePhoto && (width == 1) && (height == 1)) {
+ if (!sourceIsSimplePhoto && (height == 1)) {
/*
- * Optimize the single pixel case if we can. This speeds up code that
- * builds up large simple-alpha images by single pixels. We don't
- * negate COMPLEX_ALPHA in this case. [Bug 1409140]
+ * Optimize the single span case if we can. This speeds up code that
+ * builds up large simple-alpha images by scan-lines or individual
+ * pixels. We don't negate COMPLEX_ALPHA in this case. [Bug 1409140]
+ * [Patch 1539990]
*/
if (!(masterPtr->flags & COMPLEX_ALPHA)) {
- unsigned char newAlpha;
+ register unsigned int x1;
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
- newAlpha = destLinePtr[3];
+ for (x1=x ; x<x+width ; x1++) {
+ register unsigned char newAlpha;
- if (newAlpha && newAlpha != 255) {
- masterPtr->flags |= COMPLEX_ALPHA;
+ destLinePtr = masterPtr->pix32 + (y*masterPtr->width + x1)*4;
+ newAlpha = destLinePtr[3];
+ if (newAlpha && newAlpha != 255) {
+ masterPtr->flags |= COMPLEX_ALPHA;
+ break;
+ }
}
}
} else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {