<commit_before>! Copyright (C) 2007, 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors images images.loader io.pathnames kernel
models namespaces opengl opengl.gl opengl.textures sequences
strings ui ui.gadgets ui.gadgets.panes ui.images ui.render
constructors locals combinators.short-circuit 
literals ;
FROM: gpu.textures.private => get-texture-int ;
IN: images.viewer

TUPLE: image-gadget < gadget image texture ;
<PRIVATE
M: image-gadget pref-dim* image>> dim>> ;

: (image-gadget-texture) ( gadget -- texture )
    dup image>> { 0 0 } <texture> >>texture texture>> ;
: image-gadget-texture ( gadget -- texture )
    dup texture>> [ ] [ (image-gadget-texture) ] ?if ;

M: image-gadget draw-gadget* ( gadget -- )
    dup image>> [
        [ dim>> ] [ image-gadget-texture ] bi draw-scaled-texture
    ] [
        drop
    ] if ;

: delete-current-texture ( image-gadget -- )
    [ texture>> [ texture>> [ delete-texture ] when* ] when* ]
    [ f >>texture drop ] bi ;<commit_msg>gl-texture-int is now in opengl.textures<commit_after>! Copyright (C) 2007, 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors images images.loader io.pathnames kernel
models namespaces opengl opengl.gl opengl.textures sequences
strings ui ui.gadgets ui.gadgets.panes ui.images ui.render
constructors locals combinators.short-circuit 
literals ;
IN: images.viewer

TUPLE: image-gadget < gadget image texture ;
<PRIVATE
M: image-gadget pref-dim* image>> dim>> ;

: (image-gadget-texture) ( gadget -- texture )
    dup image>> { 0 0 } <texture> >>texture texture>> ;
: image-gadget-texture ( gadget -- texture )
    dup texture>> [ ] [ (image-gadget-texture) ] ?if ;

M: image-gadget draw-gadget* ( gadget -- )
    dup image>> [
        [ dim>> ] [ image-gadget-texture ] bi draw-scaled-texture
    ] [
        drop
    ] if ;

: delete-current-texture ( image-gadget -- )
    [ texture>> [ texture>> [ delete-texture ] when* ] when* ]
    [ f >>texture drop ] bi ;
{'fraction_non_alphanumeric': 0.1411589895988113, 'fraction_numerical': 0.009905894006934125, 'mean_word_length': 3.307036247334755, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1764400', 'n_tokens_mistral': 693, 'n_tokens_neox': 690, 'n_words': 179}