don't overpaint for clearing a canvas

Just in case clipping is not in place, since we have the right
rectangle handy anyway.
This commit is contained in:
Matthew Flatt 2015-10-06 09:42:28 -06:00
parent d393e1a5bf
commit 216798a08c

View File

@ -45,7 +45,7 @@
(define gc-via-gl? (version-10.11-or-later?)) (define gc-via-gl? (version-10.11-or-later?))
;; Called when a canvas has no backing store ready ;; Called when a canvas has no backing store ready
(define (clear-background wxb) (define (clear-background wxb r)
(let ([wx (->wx wxb)]) (let ([wx (->wx wxb)])
(when wx (when wx
(let ([bg (send wx get-canvas-background-for-clearing)]) (let ([bg (send wx get-canvas-background-for-clearing)])
@ -59,8 +59,7 @@
(adj (color-blue bg)) (adj (color-blue bg))
(adj (color-green bg)) (adj (color-green bg))
1.0) 1.0)
(CGContextFillRect cg (make-NSRect (make-NSPoint 0 0) (CGContextFillRect cg r))
(make-NSSize 32000 32000))))
(tellv ctx restoreGraphicsState))))))) (tellv ctx restoreGraphicsState)))))))
(define-objc-mixin (RacketViewMixin Superclass) (define-objc-mixin (RacketViewMixin Superclass)
@ -73,7 +72,7 @@
(when wx (when wx
(send wx drawing-requested) (send wx drawing-requested)
(unless (send wx paint-or-queue-paint) (unless (send wx paint-or-queue-paint)
(clear-background wxb) (clear-background wxb r)
;; ensure that `nextEventMatchingMask:' returns ;; ensure that `nextEventMatchingMask:' returns
(post-dummy-event)))))) (post-dummy-event))))))
(-a _void (viewWillMoveToWindow: [_id w]) (-a _void (viewWillMoveToWindow: [_id w])
@ -175,7 +174,7 @@
(when wx (when wx
(unless (send wx paint-or-queue-paint) (unless (send wx paint-or-queue-paint)
(unless (send wx during-menu-click?) (unless (send wx during-menu-click?)
(clear-background wxb) (clear-background wxb r)
;; ensure that `nextEventMatchingMask:' returns ;; ensure that `nextEventMatchingMask:' returns
(post-dummy-event)))))) (post-dummy-event))))))
(-a _void (comboBoxWillPopUp: [_id notification]) (-a _void (comboBoxWillPopUp: [_id notification])