SPECIALIZED-ARRAY: uint
IN: opengl
+SYMBOL: gl-scale-factor
+
: gl-color ( color -- ) >rgba-components glColor4d ; inline
: gl-clear-color ( color -- ) >rgba-components glClearColor ;
: with-translation ( loc quot -- )
[ [ gl-translate ] dip call ] do-matrix ; inline
+: gl-scale ( m -- n )
+ gl-scale-factor get-global [ * ] when* ; inline
+
+: gl-unscale ( m -- n )
+ gl-scale-factor get-global [ / ] when* ; inline
+
: fix-coordinates ( point1 point2 -- x1 y1 x2 y2 )
- [ first2 [ >fixnum ] bi@ ] bi@ ;
+ [ first2 [ gl-scale >fixnum ] bi@ ] bi@ ;
: gl-set-clip ( loc dim -- )
fix-coordinates glScissor ;
! Copyright (C) 2006, 2010 Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types alien.data alien.strings
-arrays assocs cocoa kernel math cocoa.messages cocoa.subclassing
-cocoa.classes cocoa.views cocoa.application cocoa.pasteboard
-cocoa.runtime cocoa.types cocoa.windows sequences
-io.encodings.utf8 locals ui ui.private ui.gadgets
-ui.gadgets.private ui.gadgets.worlds ui.gestures
-core-foundation.strings core-graphics core-graphics.types
-threads combinators math.rectangles ;
+arrays assocs cocoa cocoa.application cocoa.classes
+cocoa.pasteboard cocoa.runtime cocoa.subclassing cocoa.types
+cocoa.views combinators core-foundation.strings core-graphics
+core-graphics.types io.encodings.utf8 kernel locals math
+math.rectangles namespaces opengl sequences threads ui.gadgets
+ui.gadgets.private ui.gadgets.worlds ui.gestures ui.private ;
IN: ui.backend.cocoa.views
: send-mouse-moved ( view event -- )
METHOD: void prepareOpenGL [
self 1 -> setWantsBestResolutionOpenGLSurface:
+ self -> backingScaleFactor gl-scale-factor set-global
]
! Initialization