]> gitweb.factorcode.org Git - factor.git/commitdiff
cap: use locals to make screenshot simpler.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 21 May 2019 03:15:53 +0000 (20:15 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 21 May 2019 03:15:53 +0000 (20:15 -0700)
extra/cap/cap.factor

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