rackt/draw: fix internal error on too-large bitmap

This commit is contained in:
Matthew Flatt 2014-06-12 07:37:48 +01:00
parent cef5b2cf07
commit 71bbe6ca9c
2 changed files with 20 additions and 10 deletions

View File

@ -196,17 +196,22 @@
(max (*i scale h) 1))])
(cairo_surface_flush s)
(cond
[b&w?
;; Init transparent white:
(transparent-white! s w h)]
[alpha?
;; Init transparent:
(bytes-fill! (cairo_image_surface_get_data s) 0)]
[(cairo_image_surface_get_data s)
(cond
[b&w?
;; Init transparent white:
(transparent-white! s w h)]
[alpha?
;; Init transparent:
(bytes-fill! (cairo_image_surface_get_data s) 0)]
[else
;; Init all white, 255 alpha:
(bytes-fill! (cairo_image_surface_get_data s) 255)])
(cairo_surface_mark_dirty s)
s]
[else
;; Init all white, 255 alpha:
(bytes-fill! (cairo_image_surface_get_data s) 255)])
(cairo_surface_mark_dirty s)
s)
;; bitmap creation failed
#f]))
#f
(* 1.0 scale))]
[([(make-alts path-string? input-port?) filename]

View File

@ -811,6 +811,11 @@
load-file
p)))
;; ----------------------------------------
;; No error on too-large bitmap:
(st #f (make-bitmap 1000000 1000000) ok?)
;; ----------------------------------------
(report-errs)