svn merge ^/trunk/blender -r48658:48674
authorCampbell Barton <ideasman42@gmail.com>
Fri, 6 Jul 2012 09:24:47 +0000 (09:24 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 6 Jul 2012 09:24:47 +0000 (09:24 +0000)
1  2 
source/blender/editors/space_node/drawnode.c
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/intern/rna_space.c

index d28e3ac5507871b872a76ac31a23afc76482161a,5596e9151c7aedf464458f8929a58d67fb38b613..31485463f4f674795f9b231dd2b49bd9c04348ec
@@@ -2987,12 -2942,34 +2987,30 @@@ void draw_nodespace_back_pix(const bCon
                        x = (ar->winx - snode->zoom * ibuf->x) / 2 + snode->xof;
                        y = (ar->winy - snode->zoom * ibuf->y) / 2 + snode->yof;
                        
 -                      if (!ibuf->rect) {
 -                              if (color_manage)
 -                                      ibuf->profile = IB_PROFILE_LINEAR_RGB;
 -                              else
 -                                      ibuf->profile = IB_PROFILE_NONE;
 -                              IMB_rect_from_float(ibuf);
 -                      }
  
 -                      if (ibuf->rect) {
 +                      view_settings = IMB_view_settings_get_effective(win, &snode->view_settings);
 +                      display_buffer = IMB_display_buffer_acquire(ibuf, view_settings, &win->display_settings, &cache_handle);
 +
 +                      if (display_buffer) {
-                               if (snode->flag & SNODE_SHOW_ALPHA) {
+                               if (snode->flag & (SNODE_SHOW_R | SNODE_SHOW_G | SNODE_SHOW_B)) {
+                                       int ofs;
+                                       if      (snode->flag & SNODE_SHOW_R) ofs = 1;
+                                       else if (snode->flag & SNODE_SHOW_G) ofs = 2;
+                                       else                                 ofs = 3;
+                                       if (ENDIAN_ORDER == B_ENDIAN) {
+                                               ofs = 3 - ofs;
+                                       }
+                                       glPixelZoom(snode->zoom, snode->zoom);
+                                       /* swap bytes, so alpha is most significant one, then just draw it as luminance int */
+                                       glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ((unsigned char *)ibuf->rect) + ofs);
+                                       glPixelZoom(1.0f, 1.0f);
+                               }
+                               else if (snode->flag & SNODE_SHOW_ALPHA) {
                                        glPixelZoom(snode->zoom, snode->zoom);
                                        /* swap bytes, so alpha is most significant one, then just draw it as luminance int */
                                        if (ENDIAN_ORDER == B_ENDIAN)