Fixed a baad bug in CairoGraphicsContext>>clippingBounds:
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 05 Apr 2016 07:44:27 +0100
changeset 75 e3ca2f982493
parent 74 94902e358396
child 76 f3deda9cea3e
Fixed a baad bug in CairoGraphicsContext>>clippingBounds: Must call `cr clipReset` as `cr clip` can never make clipping bounds larger (see documentation for cairo_clip()). This fixes bard drawing of underlined Text in text editor.
CairoGraphicsContext.st
tests/CairoGraphicsContextTests.st
--- a/CairoGraphicsContext.st	Mon Apr 04 18:47:45 2016 +0100
+++ b/CairoGraphicsContext.st	Tue Apr 05 07:44:27 2016 +0100
@@ -163,9 +163,8 @@
 
     super clippingBounds:aRectangleOrNil.
     cr notNil ifTrue:[ 
-        aRectangleOrNil isNil ifTrue:[ 
-            cr clipReset
-        ] ifFalse:[ 
+        cr clipReset.
+        aRectangleOrNil notNil ifTrue:[ 
             cr rectangleX: aRectangleOrNil left
                         y: aRectangleOrNil top
                     width: aRectangleOrNil width
@@ -176,7 +175,7 @@
 
     "Created: / 15-02-2016 / 21:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 25-03-2016 / 06:58:26 / jv"
-    "Modified: / 27-03-2016 / 00:05:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-04-2016 / 21:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 deviceClippingBounds:aRectangleOrNil
--- a/tests/CairoGraphicsContextTests.st	Mon Apr 04 18:47:45 2016 +0100
+++ b/tests/CairoGraphicsContextTests.st	Tue Apr 05 07:44:27 2016 +0100
@@ -298,6 +298,32 @@
     "Created: / 16-03-2016 / 19:30:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!CairoGraphicsContextTests methodsFor:'tests - manual'!
+
+manual_01
+    "
+    CairoGraphicsContextTests new manual_01
+    "
+
+    |top textView text |
+
+    top := StandardSystemView new.
+    top extent:300@200.
+
+    textView := EditTextView new.
+    textView cairoify.
+    textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
+    top addSubView:textView.
+
+    text := 'Hello ' asText , 'World!!' asText allBold.
+    text allUnderwaved.
+    textView contents: text.
+
+    top open.
+
+    "Created: / 04-04-2016 / 18:45:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !CairoGraphicsContextTests class methodsFor:'documentation'!
 
 version_HG