]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 11 Mar 2009 01:01:34 +0000 (20:01 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 11 Mar 2009 01:01:34 +0000 (20:01 -0500)
29 files changed:
basis/help/lint/lint.factor
basis/images/bitmap/bitmap.factor
basis/images/images.factor
basis/images/tiff/tiff.factor
basis/opengl/textures/textures.factor
basis/ui/gadgets/glass/glass-docs.factor [new file with mode: 0644]
basis/ui/gadgets/glass/glass.factor
basis/ui/gadgets/menus/menus-docs.factor
basis/ui/gadgets/status-bar/status-bar-docs.factor
basis/ui/pens/gradient/gradient.factor
basis/ui/pens/solid/solid.factor
basis/ui/ui-docs.factor
extra/cap/cap.factor
extra/images/viewer/viewer.factor
extra/otug-talk/2bi.png [deleted file]
extra/otug-talk/2bi.tiff [new file with mode: 0644]
extra/otug-talk/2bi_at.png [deleted file]
extra/otug-talk/2bi_at.tiff [new file with mode: 0644]
extra/otug-talk/2bi_star.png [deleted file]
extra/otug-talk/2bi_star.tiff [new file with mode: 0644]
extra/otug-talk/bi.png [deleted file]
extra/otug-talk/bi.tiff [new file with mode: 0644]
extra/otug-talk/bi_at.png [deleted file]
extra/otug-talk/bi_at.tiff [new file with mode: 0644]
extra/otug-talk/bi_star.png [deleted file]
extra/otug-talk/bi_star.tiff [new file with mode: 0644]
extra/otug-talk/otug-talk.factor
extra/slides/slides.factor
extra/tetris/gl/gl.factor

index 57f64459c86c3362397ef78d6c656b2729dc7378..2281c295c394429fa0a9d57e5253e28497e4037c 100755 (executable)
@@ -132,6 +132,11 @@ SYMBOL: vocabs-quot
         [ check-descriptions ]
     } cleave ;
 
+: check-class-description ( word element -- )
+    [ class? not ]
+    [ { $class-description } swap elements empty? not ] bi* and
+    [ "A word that is not a class has a $class-description" throw ] when ;
+
 : all-word-help ( words -- seq )
     [ word-help ] filter ;
 
@@ -153,7 +158,8 @@ M: help-error error.
         dup '[
             _ dup word-help
             [ check-values ]
-            [ nip [ check-nulls ] [ check-see-also ] [ check-markup ] tri ] 2bi
+            [ check-class-description ]
+            [ nip [ check-nulls ] [ check-see-also ] [ check-markup ] tri ] 2tri
         ] check-something
     ] [ drop ] if ;
 
index 88eb984488b02921b813494269feb2425783f8d8..cf16df7d82b596cfec1132caae3abd8a9e784325 100755 (executable)
@@ -108,11 +108,6 @@ M: bitmap-image load-image* ( path bitmap -- bitmap )
     load-bitmap-data process-bitmap-data
     fill-image-slots ;
 
-M: bitmap-image normalize-scan-line-order
-    dup dim>> '[
-        _ first 4 * <sliced-groups> reverse concat
-    ] change-bitmap ;
-
 MACRO: (nbits>bitmap) ( bits -- )
     [ -3 shift ] keep '[
         bitmap-image new
@@ -121,6 +116,7 @@ MACRO: (nbits>bitmap) ( bits -- )
             swap >>width
             swap array-copy [ >>bitmap ] [ >>color-index ] bi
             _ >>bit-count fill-image-slots
+            t >>upside-down?
     ] ;
 
 : bgr>bitmap ( array height width -- bitmap )
index 82576774f49c58e5b4db7e99d8bf7b698796639e..cb44825e62222f10b1f28d73ed1dfc09209866fe 100644 (file)
@@ -27,7 +27,7 @@ R16G16B16 R32G32B32 R16G16B16A16 R32G32B32A32 ;
         { R32G32B32A32 [ 16 ] }
     } case ;
 
-TUPLE: image dim component-order bitmap ;
+TUPLE: image dim component-order upside-down? bitmap ;
 
 : <image> ( -- image ) image new ; inline
 
@@ -82,11 +82,16 @@ M: ARGB normalize-component-order*
 M: ABGR normalize-component-order*
     drop ARGB>RGBA 4 BGR>RGB ;
 
-GENERIC: normalize-scan-line-order ( image -- image )
-
-M: image normalize-scan-line-order ;
+: normalize-scan-line-order ( image -- image )
+    dup upside-down?>> [
+        dup dim>> first 4 * '[
+            _ <groups> reverse concat
+        ] change-bitmap
+        f >>upside-down?
+    ] when ;
 
 : normalize-image ( image -- image )
     [ >byte-array ] change-bitmap
     normalize-component-order
-    normalize-scan-line-order ;
+    normalize-scan-line-order
+    RGBA >>component-order ;
index a50ac0cad98b2c5d950137d71497a6e53d3763fb..2ea1b08e208e98079455b7e3c0ccbb34b934122e 100755 (executable)
@@ -503,7 +503,7 @@ ERROR: unknown-component-order ifd ;
 : ifd>image ( ifd -- image )
     {
         [ [ image-width find-tag ] [ image-length find-tag ] bi 2array ]
-        [ ifd-component-order ]
+        [ ifd-component-order ]
         [ bitmap>> ]
     } cleave tiff-image boa ;
 
index 79af9be48bbce1888a144c0a090738978b173006..48cdafb83703831600e154376bce9e303f70638c 100644 (file)
@@ -11,14 +11,16 @@ IN: opengl.textures
 
 TUPLE: texture loc dim texture-coords texture display-list disposed ;
 
-<PRIVATE
-
 GENERIC: component-order>format ( component-order -- format type )
 
+M: RGB component-order>format drop GL_RGB GL_UNSIGNED_BYTE ;
+M: BGR component-order>format drop GL_BGR GL_UNSIGNED_BYTE ;
 M: RGBA component-order>format drop GL_RGBA GL_UNSIGNED_BYTE ;
 M: ARGB component-order>format drop GL_BGRA_EXT GL_UNSIGNED_INT_8_8_8_8_REV ;
 M: BGRA component-order>format drop GL_BGRA_EXT GL_UNSIGNED_BYTE ;
 
+<PRIVATE
+
 : repeat-last ( seq n -- seq' )
     over peek pad-tail concat ;
 
diff --git a/basis/ui/gadgets/glass/glass-docs.factor b/basis/ui/gadgets/glass/glass-docs.factor
new file mode 100644 (file)
index 0000000..bd9028d
--- /dev/null
@@ -0,0 +1,55 @@
+IN: ui.gadgets.glass
+USING: help.markup help.syntax ui.gadgets math.rectangles ;
+
+HELP: show-glass
+{ $values { "owner" gadget } { "child" gadget } { "visible-rect" rect } }
+{ $description "Displays " { $snippet "child" } " in the glass layer of the window containing " { $snippet "owner" } "."
+  $nl
+  "The child's position is calculated with a heuristic:"
+  { $list
+    "The child must fit inside the window"
+    { "The child must not obscure " { $snippet "visible-rect" } ", which is a rectangle whose origin is relative to " { $snippet "owner" } }
+    { "The child must otherwise be as close as possible to the edges of " { $snippet "visible-rect" } }
+  }
+  "For example, when displaying a menu, " { $snippet "visible-rect" } " is a single point at the mouse location, and when displaying a completion popup, " { $snippet "visible-rect" } " contains the bounds of the text element being completed."
+} ;
+
+HELP: hide-glass
+{ $values { "child" gadget } }
+{ $description "Hides a gadget displayed in a glass layer." } ;
+
+HELP: hide-glass-hook
+{ $values { "gadget" gadget } }
+{ $description "Called when a gadget displayed in a glass layer is hidden. The gadget can perform cleanup tasks here." } ;
+
+HELP: pass-to-popup
+{ $values { "gesture" "a gesture" } { "owner" "the popup's owner" } { "?" "a boolean" } }
+{ $description "Resends the gesture to the popup displayed by " { $snippet "owner" } ". The owner must have a " { $slot "popup" } " slot. Outputs " { $link f } " if the gesture was handled, " { $link t } " otherwise." } ;
+
+HELP: show-popup
+{ $values { "owner" gadget } { "popup" gadget } { "visible-rect" rect } }
+{ $description "Displays " { $snippet "popup" } " in the glass layer of the window containing " { $snippet "owner" } " as a popup."
+  $nl
+  "This word differs from " { $link show-glass } " in two respects:"
+  { $list
+    { "The popup is stored in the owner's " { $slot "popup" } " slot; the owner can call " { $link pass-to-popup } " to pass keyboard gestures to the popup" }
+    { "Pressing " { $snippet "ESC" } " with the popup visible will hide it" }
+  }
+} ;
+
+ARTICLE: "ui.gadgets.glass" "Glass layers"
+"The " { $vocab-link "ui.gadgets.glass" } " vocabulary implements support for displaying gadgets in the glass layer of a window. The gadget can be positioned arbitrarily within the glass layer, and while it is visible, mouse clicks outside of the glass layer are intercepted to hide the glass layer. Multiple glass layers can be active at a time; they behave as if stacked on top of each other."
+$nl
+"This feature is used for completion popups and " { $link "ui.gadgets.menus" } " in the " { $link "ui-tools" } "."
+$nl
+"Displaying a gadget in a glass layer:"
+{ $subsection show-glass }
+"Hiding a gadget in a glass layer:"
+{ $subsection hide-glass }
+"Callback generic invoked on the gadget when its glass layer is hidden:"
+{ $subsection hide-glass-hook }
+"Popup gadgets add support for forwarding keyboard gestures from an owner gadget to the glass layer:"
+{ $subsection show-popup }
+{ $subsection pass-to-popup } ;
+
+ABOUT: "ui.gadgets.glass"
\ No newline at end of file
index a8f438c85eecd66e442a58749f52fc801f003997..af169235b405a94d5c184d2979ff760e0ffe567e 100644 (file)
@@ -71,7 +71,7 @@ popup H{
     { T{ key-down f f "ESC" } [ hide-glass ] }
 } set-gestures
 
-: pass-to-popup ( gesture interactor -- ? )
+: pass-to-popup ( gesture owner -- ? )
     popup>> focusable-child resend-gesture ;
 
 : show-popup ( owner popup visible-rect -- )
index d7297217ed930cd56441d3d404da9195a6fa32c2..ad0881a382b932f2fda74daa6b915860717d2ef2 100644 (file)
@@ -16,7 +16,7 @@ HELP: show-commands-menu
 { $notes "Useful for right-click context menus." } ;
 
 ARTICLE: "ui.gadgets.menus" "Popup menus"
-"The " { $vocab-link "ui.gadgets.menus" } " vocabulary implements popup menus."
+"The " { $vocab-link "ui.gadgets.menus" } " vocabulary displays popup menus in " { $link "ui.gadgets.glass" } "."
 { $subsection <commands-menu> }
 { $subsection show-menu }
 { $subsection show-commands-menu } ;
index f5a6409fcaf79b265ac39dd42e1eccc6f2c19eb0..57c69c2a66984546edfbed75bad97f1888051b33 100644 (file)
@@ -3,7 +3,7 @@ ui.gadgets ui.gadgets.worlds ui ;
 IN: ui.gadgets.status-bar
 
 HELP: show-status
-{ $values { "string" string } { "gadget" gadget } }
+{ $values { "string/f" string } { "gadget" gadget } }
 { $description "Displays a status message in the gadget's world." }
 { $notes "The status message will only be visible if the window was opened with " { $link open-status-window } ", and not " { $link open-window } "." } ;
 
index a137ae022bf915a91c56275017fc65698710f84e..485015b898fb35cfd5467bdace3ebead38f693f5 100644 (file)
@@ -41,4 +41,6 @@ M: gradient draw-interior
         [ last-vertices>> gl-vertex-pointer ]
         [ last-colors>> gl-color-pointer ]
         [ colors>> draw-gradient ]
-    } cleave ;
\ No newline at end of file
+    } cleave ;
+
+M: gradient pen-background 2drop transparent ;
\ No newline at end of file
index 32d400463e74e1a444056cdbe43cc5b632ee61d5..950035e7730dc5ff28e81a6b58fd3eb1c953af0d 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel accessors opengl ui.pens ui.pens.caching ;
+USING: kernel accessors opengl math colors ui.pens ui.pens.caching ;
 IN: ui.pens.solid
 
 TUPLE: solid < caching-pen color interior-vertices boundary-vertices ;
@@ -29,4 +29,4 @@ M: solid draw-boundary
     (gl-rect) ;
 
 M: solid pen-background
-    nip color>> ;
\ No newline at end of file
+    nip color>> dup alpha>> 1 number= [ drop transparent ] unless ;
\ No newline at end of file
index d08dea299edafd4284ec09aeda793d8111997f7d..f2b6154745837f70c758b3548af9f64295ee5f11 100644 (file)
@@ -171,6 +171,7 @@ ARTICLE: "ui-layouts" "Gadget hierarchy and layouts"
 { $subsection "ui-frame-layout" }
 { $subsection "ui-book-layout" }
 "Advanced topics:"
+{ $subsection "ui.gadgets.glass" }
 { $subsection "ui-null-layout" }
 { $subsection "ui-incremental-layout" }
 { $subsection "ui-layout-impl" }
index 1f6244102866a44c1df526c3a803d7d66a090fd2..64696759bb300b8a38ed14f067d27a5540701530 100644 (file)
@@ -1,30 +1,31 @@
 ! Copyright (C) 2008 Doug Coleman, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays byte-arrays kernel math namespaces
-opengl.gl sequences math.vectors ui images.bitmap images.viewer
+opengl.gl sequences math.vectors ui images images.viewer
 models ui.gadgets.worlds ui.gadgets fry alien.syntax ;
 IN: cap
 
 : screenshot-array ( world -- byte-array )
-    dim>> [ first 3 * 4 align ] [ second ] bi * <byte-array> ;
+    dim>> [ first 4 * ] [ second ] bi * <byte-array> ;
 
 : gl-screenshot ( gadget -- byte-array )
     [
-        GL_BACK glReadBuffer
-        GL_PACK_ALIGNMENT 4 glPixelStorei
-        0 0
-    ] dip
-    [ dim>> first2 GL_BGR GL_UNSIGNED_BYTE ]
+        [
+            GL_BACK glReadBuffer
+            GL_PACK_ALIGNMENT 4 glPixelStorei
+            0 0
+        ] dip
+        dim>> first2 GL_RGBA GL_UNSIGNED_BYTE
+    ]
     [ screenshot-array ] bi
     [ glReadPixels ] keep ;
 
 : screenshot ( window -- bitmap )
-    [ gl-screenshot ]
-    [ dim>> first2 ] bi
-    bgr>bitmap ;
-
-: save-screenshot ( window path -- )
-    [ screenshot ] dip save-bitmap ;
+    [ <image> ] dip
+    [ gl-screenshot >>bitmap ] [ dim>> >>dim ] bi
+    RGBA >>component-order
+    t >>upside-down?
+    normalize-image ;
 
 : screenshot. ( window -- )
     [ screenshot <image-gadget> ] [ title>> ] bi open-window ; 
index b920b604308afbf51a160ce492d9a3b791328d5a..4eaa98495328e5f9f94067cb87a2784d0e870855 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2007 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors images images.loader io.pathnames kernel
-namespaces opengl opengl.gl sequences strings ui ui.gadgets
+USING: accessors images images.loader io.pathnames kernel namespaces
+opengl opengl.gl opengl.textures sequences strings ui ui.gadgets
 ui.gadgets.panes ui.render ;
 IN: images.viewer
 
@@ -12,8 +12,8 @@ M: image-gadget pref-dim*
 
 : draw-image ( image -- )
     0 0 glRasterPos2i 1.0 -1.0 glPixelZoom
-    [ dim>> first2 GL_RGBA GL_UNSIGNED_BYTE ]
-    [ bitmap>> ] bi glDrawPixels ;
+    [ dim>> first2 ] [ component-order>> component-order>format ] [ bitmap>> ] tri
+    glDrawPixels ;
 
 M: image-gadget draw-gadget* ( gadget -- )
     image>> draw-image ;
diff --git a/extra/otug-talk/2bi.png b/extra/otug-talk/2bi.png
deleted file mode 100644 (file)
index 8f431f8..0000000
Binary files a/extra/otug-talk/2bi.png and /dev/null differ
diff --git a/extra/otug-talk/2bi.tiff b/extra/otug-talk/2bi.tiff
new file mode 100644 (file)
index 0000000..16c0777
Binary files /dev/null and b/extra/otug-talk/2bi.tiff differ
diff --git a/extra/otug-talk/2bi_at.png b/extra/otug-talk/2bi_at.png
deleted file mode 100644 (file)
index 55d42c2..0000000
Binary files a/extra/otug-talk/2bi_at.png and /dev/null differ
diff --git a/extra/otug-talk/2bi_at.tiff b/extra/otug-talk/2bi_at.tiff
new file mode 100644 (file)
index 0000000..e41ab98
Binary files /dev/null and b/extra/otug-talk/2bi_at.tiff differ
diff --git a/extra/otug-talk/2bi_star.png b/extra/otug-talk/2bi_star.png
deleted file mode 100644 (file)
index 0fff376..0000000
Binary files a/extra/otug-talk/2bi_star.png and /dev/null differ
diff --git a/extra/otug-talk/2bi_star.tiff b/extra/otug-talk/2bi_star.tiff
new file mode 100644 (file)
index 0000000..f457ce5
Binary files /dev/null and b/extra/otug-talk/2bi_star.tiff differ
diff --git a/extra/otug-talk/bi.png b/extra/otug-talk/bi.png
deleted file mode 100644 (file)
index 2470c9f..0000000
Binary files a/extra/otug-talk/bi.png and /dev/null differ
diff --git a/extra/otug-talk/bi.tiff b/extra/otug-talk/bi.tiff
new file mode 100644 (file)
index 0000000..ad0ce97
Binary files /dev/null and b/extra/otug-talk/bi.tiff differ
diff --git a/extra/otug-talk/bi_at.png b/extra/otug-talk/bi_at.png
deleted file mode 100644 (file)
index 282f2f1..0000000
Binary files a/extra/otug-talk/bi_at.png and /dev/null differ
diff --git a/extra/otug-talk/bi_at.tiff b/extra/otug-talk/bi_at.tiff
new file mode 100644 (file)
index 0000000..07d25bc
Binary files /dev/null and b/extra/otug-talk/bi_at.tiff differ
diff --git a/extra/otug-talk/bi_star.png b/extra/otug-talk/bi_star.png
deleted file mode 100644 (file)
index e94e371..0000000
Binary files a/extra/otug-talk/bi_star.png and /dev/null differ
diff --git a/extra/otug-talk/bi_star.tiff b/extra/otug-talk/bi_star.tiff
new file mode 100644 (file)
index 0000000..17f3350
Binary files /dev/null and b/extra/otug-talk/bi_star.tiff differ
index 16ee2b740b0cb764d42026013e0db3e7d5cbd18e..2ce307ce207b45fdea574d5aa87ae36b6ae1e39f 100644 (file)
@@ -1,41 +1,14 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: slides help.markup math arrays hashtables namespaces
-sequences kernel sequences parser memoize io.encodings.binary
-locals kernel.private tools.vocabs.browser assocs quotations
- tools.vocabs tools.annotations tools.crossref
-help.topics math.functions compiler.tree.optimizer
-compiler.cfg.optimizer fry
-ui.gadgets.panes tetris tetris.game combinators generalizations
-multiline sequences.private ;
+USING: slides help.markup math arrays hashtables namespaces sequences
+kernel sequences parser memoize io.encodings.binary locals
+kernel.private tools.vocabs.browser assocs quotations tools.vocabs
+tools.annotations tools.crossref help.topics math.functions
+compiler.tree.optimizer compiler.cfg.optimizer fry ui.gadgets.panes
+tetris tetris.game combinators generalizations multiline
+sequences.private ;
 IN: otug-talk
 
-USING: cairo cairo.ffi cairo.gadgets accessors
-io.backend ui.gadgets ;
-
-TUPLE: png-gadget < cairo-gadget surface ;
-
-: <png-gadget> ( file -- gadget )
-    png-gadget new-gadget
-    swap normalize-path
-    cairo_image_surface_create_from_png >>surface ; inline
-
-M: png-gadget pref-dim* ( gadget -- )
-    surface>>
-    [ cairo_image_surface_get_width ]
-    [ cairo_image_surface_get_height ]
-    bi 2array ;
-
-M: png-gadget render-cairo* ( gadget -- )
-    cr swap surface>> 0 0 cairo_set_source_surface
-    cr cairo_paint ;
-
-M: png-gadget ungraft* ( gadget -- )
-    surface>> cairo_surface_destroy ;
-
-: $bitmap ( element -- )
-    [ first <png-gadget> gadget. ] ($block) ;
-
 : $tetris ( element -- )
     drop [ <default-tetris> <tetris-gadget> gadget. ] ($block) ;
 
@@ -105,11 +78,11 @@ CONSTANT: otug-slides
     }
     { $slide "Data flow combinators - cleave family"
         { { $link bi } ", " { $link tri } ", " { $link cleave } }
-        { $bitmap "resource:extra/otug-talk/bi.png" }
+        { $image "resource:extra/otug-talk/bi.tiff" }
     }
     { $slide "Data flow combinators - cleave family"
         { { $link 2bi } ", " { $link 2tri } ", " { $link 2cleave } }
-        { $bitmap "resource:extra/otug-talk/2bi.png" }
+        { $image "resource:extra/otug-talk/2bi.tiff" }
     }
     { $slide "Data flow combinators"
         "First, let's define a data type:"
@@ -128,19 +101,19 @@ CONSTANT: otug-slides
     }
     { $slide "Data flow combinators - spread family"
         { { $link bi* } ", " { $link tri* } ", " { $link spread } }
-        { $bitmap "resource:extra/otug-talk/bi_star.png" }
+        { $image "resource:extra/otug-talk/bi_star.tiff" }
     }
     { $slide "Data flow combinators - spread family"
         { { $link 2bi* } }
-        { $bitmap "resource:extra/otug-talk/2bi_star.png" }
+        { $image "resource:extra/otug-talk/2bi_star.tiff" }
     }
     { $slide "Data flow combinators - apply family"
         { { $link bi@ } ", " { $link tri@ } ", " { $link napply } }
-        { $bitmap "resource:extra/otug-talk/bi_at.png" }
+        { $image "resource:extra/otug-talk/bi_at.tiff" }
     }
     { $slide "Data flow combinators - apply family"
         { { $link 2bi@ } }
-        { $bitmap "resource:extra/otug-talk/2bi_at.png" }
+        { $image "resource:extra/otug-talk/2bi_at.tiff" }
     }
     { $slide "Shuffle words"
         "When data flow combinators are not enough"
index 6a5b7ab8160dd337fa0151a0a571e361933f7701..752d0b3ffacd148213e2c1a8bcb2a0f277f48a55 100755 (executable)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays hashtables help.markup help.stylesheet io
 io.styles kernel math models namespaces sequences ui ui.gadgets
-ui.gadgets.books ui.gadgets.panes ui.gestures ui.pens.gradient ui.render
+ui.gadgets.books ui.gadgets.panes ui.gestures ui.pens.gradient
 parser accessors colors ;
 IN: slides
 
@@ -98,6 +98,7 @@ TUPLE: slides < book ;
     parse-definition strip-tease [ parsed ] each ; parsing
 
 \ slides H{
+    { T{ button-down } [ request-focus ] }
     { T{ key-down f f "DOWN" } [ next-page ] }
     { T{ key-down f f "UP" } [ prev-page ] }
 } set-gestures
index 70300779b58dfe34776f0af02a7c24951a814745..f8c901ff562a4bd34f60de5d6cb437d5c19dcd79 100644 (file)
@@ -35,7 +35,7 @@ IN: tetris.gl
 : scale-board ( width height board -- )
     [ width>> ] [ height>> ] bi swapd [ / ] dup 2bi* 1 glScalef ;
 
-: (draw-tetris) ( width height tetris -- )
+: draw-tetris ( width height tetris -- )
     #! width and height are in pixels
     GL_MODELVIEW [
         {
@@ -44,7 +44,4 @@ IN: tetris.gl
             [ next-piece draw-next-piece ]
             [ current-piece draw-piece ]
         } cleave
-    ] do-matrix ;
-
-: draw-tetris ( width height tetris -- )
-    origin get [ (draw-tetris) ] with-translation ;
+    ] do-matrix ;
\ No newline at end of file