From 056d8acad44a1ebc5222d649452a6555c747d7ec Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 20 May 2019 20:15:53 -0700 Subject: [PATCH] cap: use locals to make screenshot simpler. --- extra/cap/cap.factor | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/extra/cap/cap.factor b/extra/cap/cap.factor index 42139db359..3a21b4d4f2 100644 --- a/extra/cap/cap.factor +++ b/extra/cap/cap.factor @@ -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 -: screenshot ( window -- bitmap ) - [ +:: screenshot ( window -- bitmap ) + 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 -- )