diff options
-rw-r--r-- | doc/text.n | 2 | ||||
-rw-r--r-- | generic/tkFont.c | 14 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 34 | ||||
-rw-r--r-- | library/fontchooser.tcl | 3 | ||||
-rw-r--r-- | tests/font.test | 10 | ||||
-rw-r--r-- | tests/imgPhoto.test | 12 |
6 files changed, 52 insertions, 23 deletions
@@ -537,7 +537,7 @@ character of that display line. \fB\-rmargincolor \fIcolor\fR . \fIColor\fR specifies the background color to use in regions that do not -contain characters because they are indented by \fB\-rmargin1\fR. It may +contain characters because they are indented by \fB\-rmargin\fR. It may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is specified as an empty string, then the color used is specified by the \fB-background\fR tag option (or, if this is also diff --git a/generic/tkFont.c b/generic/tkFont.c index 4183686..86fdd87 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -3151,14 +3151,13 @@ TkIntersectAngledTextLayout( cy[0] = cy[1] = chunkPtr->y - fontPtr->fm.ascent; cx[1] = cx[2] = chunkPtr->x + chunkPtr->displayWidth; cy[2] = cy[3] = chunkPtr->y + fontPtr->fm.descent; - if ( !PointInQuadrilateral(cx, cy, rx[0], ry[0]) || - !PointInQuadrilateral(cx, cy, rx[1], ry[1]) || - !PointInQuadrilateral(cx, cy, rx[2], ry[2]) || - !PointInQuadrilateral(cx, cy, rx[3], ry[3])) { - goto notReverseInside; - } + if ( PointInQuadrilateral(cx, cy, rx[0], ry[0]) && + PointInQuadrilateral(cx, cy, rx[1], ry[1]) && + PointInQuadrilateral(cx, cy, rx[2], ry[2]) && + PointInQuadrilateral(cx, cy, rx[3], ry[3])) { + return 0; + } } - return 0; /* * If we're overlapping now, we must be partially in and out of at least @@ -3166,7 +3165,6 @@ TkIntersectAngledTextLayout( * rectangle that is touching or crossing a line segment of a chunk. */ - notReverseInside: chunkPtr = layoutPtr->chunks; for (i=0 ; i<layoutPtr->numChunks ; i++,chunkPtr++) { diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 1fec208..cb46c41 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -625,7 +625,24 @@ ImgPhotoCmd( } /* + * Copy the image data over using Tk_PhotoPutZoomedBlock. + */ + + block.pixelPtr += options.fromX * block.pixelSize + + options.fromY * block.pitch; + block.width = options.fromX2 - options.fromX; + block.height = options.fromY2 - options.fromY; + result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr, + &block, options.toX, options.toY, options.toX2 - options.toX, + options.toY2 - options.toY, options.zoomX, options.zoomY, + options.subsampleX, options.subsampleY, + options.compositingRule); + + /* * Set the destination image size if the -shrink option was specified. + * This has to be done _after_ copying the data. Otherwise, if source + * and destination are the same image, block.pixelPtr would point to + * an invalid memory block (bug [5239fd749b]). */ if (options.options & OPT_SHRINK) { @@ -637,20 +654,9 @@ ImgPhotoCmd( return TCL_ERROR; } } - - /* - * Copy the image data over using Tk_PhotoPutZoomedBlock. - */ - - block.pixelPtr += options.fromX * block.pixelSize - + options.fromY * block.pitch; - block.width = options.fromX2 - options.fromX; - block.height = options.fromY2 - options.fromY; - return Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr, - &block, options.toX, options.toY, options.toX2 - options.toX, - options.toY2 - options.toY, options.zoomX, options.zoomY, - options.subsampleX, options.subsampleY, - options.compositingRule); + Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, + masterPtr->width, masterPtr->height); + return result; case PHOTO_DATA: { char *data; diff --git a/library/fontchooser.tcl b/library/fontchooser.tcl index 8f91ade..5395acb 100644 --- a/library/fontchooser.tcl +++ b/library/fontchooser.tcl @@ -65,6 +65,9 @@ proc ::tk::fontchooser::Show {} { wm transient $S(W) [winfo toplevel $S(-parent)] tk::PlaceWindow $S(W) widget $S(-parent) } + set S(fonts) [lsort -dictionary [font families]] + set S(fonts,lcase) {} + foreach font $S(fonts) { lappend S(fonts,lcase) [string tolower $font]} wm deiconify $S(W) } diff --git a/tests/font.test b/tests/font.test index 23e09c4..62afa5a 100644 --- a/tests/font.test +++ b/tests/font.test @@ -1956,6 +1956,16 @@ test font-31.6 {Tk_IntersectTextLayout procedure: ignore spaces at eol} -body { .t.c itemconfig text -width 0 return $x } -result {} +test font-31.7 {TkIntersectAngledTextLayout procedure: bug [514ff64dd0]} -body { + csetup "This is line one\nand line two\nand line three here" + .t.c itemconfigure text -angle 90 + # Coordinates of the rectangle to check can be hardcoded: + # The goal of this test is to check whether the overlap detection algorithm + # works when the rectangle is entirely included in a chunk of the text layout. + # The text has been rotated 90 degrees around it's upper left corner, + # so it's enough to check with a small rectangle with small negative y coords. + .t.c find overlapping 5 -7 7 -5 +} -result {1} destroy .t.c diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test index 4bff5cc..0126ad9 100644 --- a/tests/imgPhoto.test +++ b/tests/imgPhoto.test @@ -820,6 +820,18 @@ test imgPhoto-4.75 {<photo> read command: filename starting with '-'} -constrain image delete photo1 file delete ./-teapotPhotoFile } -result {} +test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -constraints { + hasTeapotPhoto +} -setup { + imageCleanup + image create photo photo1 -file $teapotPhotoFile +} -body { + # non-regression test for bug [5239fd749b] - shall just not crash + photo1 copy photo1 -to 0 0 2000 1000 + photo1 copy photo1 -subsample 2 2 -shrink +} -cleanup { + imageCleanup +} -result {} test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -constraints { hasTeapotPhoto |