From 694652590f22787357e3c6c71c453a5b0643b257 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 9 Apr 2009 08:18:26 -0500 Subject: [PATCH 1/2] download word throneeds to ws an error if the request did not return a success code (reported by Chris Double) --- basis/http/client/client.factor | 2 +- basis/http/http-tests.factor | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/basis/http/client/client.factor b/basis/http/client/client.factor index 805929d27b..307fdd5031 100644 --- a/basis/http/client/client.factor +++ b/basis/http/client/client.factor @@ -165,7 +165,7 @@ ERROR: download-failed response ; present file-name "?" split1 drop "/" ?tail drop ; : download-to ( url file -- ) - binary [ [ write ] with-http-get drop ] with-file-writer ; + binary [ [ write ] with-http-get check-response drop ] with-file-writer ; : download ( url -- ) dup download-name download-to ; diff --git a/basis/http/http-tests.factor b/basis/http/http-tests.factor index da50a6f85f..45ad132677 100644 --- a/basis/http/http-tests.factor +++ b/basis/http/http-tests.factor @@ -392,4 +392,7 @@ SYMBOL: a [ "OK" ] [ "data" "http://localhost/a" add-port http-post nip ] unit-test -[ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test \ No newline at end of file +! Check that download throws errors (reported by Chris Double) +[ "http://localhost/tweet_my_twat" add-port download ] must-fail + +[ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test From 9efa1e0c3126a4faca3748743407d8dc3de3fc5d Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 9 Apr 2009 08:23:05 -0500 Subject: [PATCH 2/2] Don't use glTexSubImage2D unless we really have to --- basis/opengl/textures/textures.factor | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/basis/opengl/textures/textures.factor b/basis/opengl/textures/textures.factor index e13e99e10f..1900deb5b8 100755 --- a/basis/opengl/textures/textures.factor +++ b/basis/opengl/textures/textures.factor @@ -36,10 +36,12 @@ TUPLE: single-texture image dim loc texture-coords texture display-list disposed [ next-power-of-2 ] map ] unless ; -: (tex-image) ( image -- ) - [ GL_TEXTURE_2D 0 GL_RGBA ] dip - [ dim>> adjust-texture-dim first2 0 ] - [ component-order>> component-order>format f ] bi +: (tex-image) ( image bitmap -- ) + [ + [ GL_TEXTURE_2D 0 GL_RGBA ] dip + [ dim>> adjust-texture-dim first2 0 ] + [ component-order>> component-order>format ] bi + ] dip glTexImage2D ; : (tex-sub-image) ( image -- ) @@ -53,7 +55,9 @@ TUPLE: single-texture image dim loc texture-coords texture display-list disposed gen-texture [ GL_TEXTURE_BIT [ GL_TEXTURE_2D swap glBindTexture - [ (tex-image) ] [ (tex-sub-image) ] bi + non-power-of-2-textures? get + [ dup bitmap>> (tex-image) ] + [ [ f (tex-image) ] [ (tex-sub-image) ] bi ] if ] do-attribs ] keep ;