cap: use locals to make screenshot simpler.

clean-macosx-x86-32
John Benediktsson 2019-05-20 20:15:53 -07:00
parent bca952ebd2
commit 056d8acad4
1 changed files with 9 additions and 10 deletions

View File

@ -1,8 +1,8 @@
! Copyright (C) 2008 Doug Coleman, Joe Groff. ! Copyright (C) 2008 Doug Coleman, Joe Groff.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors byte-arrays images images.normalization USING: accessors byte-arrays images images.normalization
images.viewer kernel math namespaces opengl opengl.gl sequences images.viewer kernel locals math namespaces opengl opengl.gl
ui ui.backend ui.gadgets.worlds ; sequences ui ui.gadgets.worlds ;
IN: cap IN: cap
<PRIVATE <PRIVATE
@ -27,12 +27,11 @@ IN: cap
PRIVATE> PRIVATE>
: screenshot ( window -- bitmap ) :: screenshot ( window -- bitmap )
[ <image> <image>
gl-scale-factor get-global [ 2.0 = >>2x? ] when* gl-scale-factor get-global [ 2.0 = >>2x? ] when*
] dip window gl-screenshot >>bitmap
[ gl-screenshot >>bitmap ] window dim>> [ gl-scale >fixnum ] map >>dim
[ dim>> [ gl-scale >fixnum ] map >>dim ] bi
ubyte-components >>component-type ubyte-components >>component-type
RGBA >>component-order RGBA >>component-order
t >>upside-down? t >>upside-down?