]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge remote branch 'origin/native-image-loader' into gtk-image-loader
authorPhilipp Brüschweiler <blei42@gmail.com>
Sat, 17 Jul 2010 09:26:45 +0000 (11:26 +0200)
committerPhilipp Brüschweiler <blei42@gmail.com>
Sat, 17 Jul 2010 09:26:45 +0000 (11:26 +0200)
1  2 
basis/cocoa/messages/messages.factor
basis/opengl/textures/textures.factor

index 4d786aaf720f68b395b510e2a516b9513443db46,4b2c2f2a33cecbc8a5441c8f4cecf567356017f0..b607682e761f4756b10bb8d1762c68d58f9915e4
@@@ -109,7 -109,7 +109,7 @@@ H
      { "d" c:double }
      { "B" c:bool }
      { "v" c:void }
-     { "*" c:c-string }
+     { "*" c:void* }
      { "?" unknown_type }
      { "@" id }
      { "#" Class }
@@@ -216,7 -216,7 +216,7 @@@ ERROR: no-objc-type name 
      objc-methods get set-at ;
  
  : each-method-in-class ( class quot -- )
 -    [ { uint } [ class_copyMethodList ] [ ] with-out-parameters ] dip
 +    [ { uint } [ class_copyMethodList ] with-out-parameters ] dip
      over 0 = [ 3drop ] [
          [ <direct-void*-array> ] dip
          [ each ] [ drop (free) ] 2bi
index f33ea9e47db26812d600a72b753d4d92cead9af4,bba41653042da751686322c7d15dc00fcac20c14..0aaa9dcf9bc786f3b0fb0c0f63325142ffa68faf
@@@ -312,12 -312,21 +312,21 @@@ TUPLE: single-texture < disposable imag
      [ init-texture texture-coords>> gl-texture-coord-pointer ] tri
      swap gl-fill-rect ;
  
+ : set-blend-mode ( texture -- )
+     image>> dup has-alpha?
+     [ premultiplied-alpha?>> [ GL_ONE GL_ONE_MINUS_SRC_ALPHA glBlendFunc ] when ]
+     [ drop GL_BLEND glDisable ] if ;
+ : reset-blend-mode ( texture -- )
+     image>> dup has-alpha?
+     [ premultiplied-alpha?>> [ GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc ] when ]
+     [ drop GL_BLEND glEnable ] if ;
  : draw-textured-rect ( dim texture -- )
      [
-         [ image>> has-alpha? [ GL_BLEND glDisable ] unless ]
+         [ set-blend-mode ]
          [ (draw-textured-rect) GL_TEXTURE_2D 0 glBindTexture ]
-         [ image>> has-alpha? [ GL_BLEND glEnable ] unless ]
-         tri
+         [ reset-blend-mode ] tri
      ] with-texturing ;
  
  : texture-coords ( texture -- coords )
@@@ -406,7 -415,7 +415,7 @@@ PRIVATE
      [ [ max-texture-size tesselate ] dip <multi-texture> ] if ;
  
  : get-texture-float ( target level enum -- value )
 -    { float } [ glGetTexLevelParameterfv ] [ ] with-out-parameters ; inline
 +    { float } [ glGetTexLevelParameterfv ] with-out-parameters ; inline
  
  : get-texture-int ( target level enum -- value )
 -    { int } [ glGetTexLevelParameteriv ] [ ] with-out-parameters ; inline
 +    { int } [ glGetTexLevelParameteriv ] with-out-parameters ; inline