racket/draw

get-recorded-procedure on record-dc seems to drop `set-clipping-rect`

Closed this issue · 0 comments

This is not a regression from 7.4.

The program:

#lang racket
(require pict racket/draw)

(define (thing dc)
  (define b (send dc get-brush))
  (send dc set-brush "black" 'solid)
  (send dc draw-rectangle 0 0 100 100)
  (send dc set-brush b)
  ;; whiteout
  (define r (send dc get-clipping-region))
  (send dc set-clipping-rect 0 0 50 50)
  (send dc erase)
  (send dc set-clipping-region r))


(define bit (make-object bitmap% 100 100))
(thing (send bit make-dc))
bit

(define dc2 (new record-dc% [width 100] [height 100]))
(thing dc2)
(send dc2 get-recorded-datum)


(define x (send dc2 get-recorded-procedure))
(define bit1 (make-object bitmap% 100 100))
(x (send bit1 make-dc))
bit1

Produces the following in drracket:

Screen Shot 2020-01-15 at 1 01 02 PM

The first image is what I would expect. The second image seems to be the result of the clipping rect not being set. (In general, any drawing I do after calling erase still happens). Oddly the call to set-clipping-region that corrisponds to set-clipping-rect appears in the recorded datum.