Update of /cvsroot/pure-data/externals/gem2pdp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22211
Modified Files: pix_2pdp.cpp pix_2pdp.h Log Message: accept the upside-down flag of Gem's image
Index: pix_2pdp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/gem2pdp/pix_2pdp.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pix_2pdp.cpp 11 Oct 2005 02:37:22 -0000 1.3 --- pix_2pdp.cpp 11 Oct 2005 15:34:35 -0000 1.4 *************** *** 29,32 **** --- 29,33 ---- gem_ysize = 0; gem_csize = 0; + gem_upsidedown = 0; }
*************** *** 39,42 **** --- 40,44 ---- gem_csize = image.csize; gem_format = image.format; + gem_upsidedown = image.upsidedown; }
*************** *** 58,62 ****
pY = m_data; ! pY2 = m_data + gem_xsize; pV = m_data+psize; pU = m_data+psize+(psize>>2); --- 60,64 ----
pY = m_data; ! pY2 = m_data + gem_xsize; pV = m_data+psize; pU = m_data+psize+(psize>>2); *************** *** 69,79 **** case GL_BGR: case GL_BGRA: ! for ( py=0; py<gem_ysize; py++) { for ( px=0; px<gem_xsize; px++) { // the way to access the pixels: (C=chRed, chBlue, ...) // image[Y * xsize * csize + X * csize + C] ! helper = py*gem_xsize*gem_csize + px*gem_csize; g1=gem_image[helper+chRed]; // R g2=gem_image[helper+chGreen]; // G --- 71,82 ---- case GL_BGR: case GL_BGRA: ! for ( py=0; py<gem_ysize; py++) { + const t_int py2=(gem_upsidedown)?py:(gem_ysize-py); for ( px=0; px<gem_xsize; px++) { // the way to access the pixels: (C=chRed, chBlue, ...) // image[Y * xsize * csize + X * csize + C] ! helper = py2*gem_xsize*gem_csize + px*gem_csize; g1=gem_image[helper+chRed]; // R g2=gem_image[helper+chGreen]; // G *************** *** 98,101 **** --- 101,109 ---- unsigned char *pixel = gem_image; unsigned char *pixel2 = gem_image + gem_xsize * gem_csize; + const int row_length = gem_xsize* gem_csize; + if(0==gem_upsidedown){ + pixel=gem_image+row_length * (gem_ysize-1); + pixel2=gem_image+row_length * (gem_ysize-2); + } while (row--){ int col=cols; *************** *** 114,120 **** pU++; pV++; } ! pixel += gem_xsize * gem_csize; ! pixel2 += gem_xsize * gem_csize; ! pY += gem_xsize; pY2 += gem_xsize; } pdp_packet_pass_if_valid(m_pdpoutlet, &m_packet0); --- 122,133 ---- pU++; pV++; } ! if(gem_upsidedown){ ! pixel += row_length; ! pixel2 += row_length; ! } else { ! pixel -= 3*row_length; ! pixel2 -= 3*row_length; ! } ! pY += gem_xsize; pY2 += gem_xsize; } pdp_packet_pass_if_valid(m_pdpoutlet, &m_packet0); *************** *** 125,131 **** for ( py=0; py<gem_ysize; py++) { for ( px=0; px<gem_xsize; px++) { ! *pY = gem_image[py*gem_xsize*gem_csize + px*gem_csize] << 7; pY++; if ( (px%2==0) && (py%2==0) ) --- 138,145 ---- for ( py=0; py<gem_ysize; py++) { + const t_int py2=(gem_upsidedown)?py:(gem_ysize-py); for ( px=0; px<gem_xsize; px++) { ! *pY = gem_image[py2*gem_xsize*gem_csize + px*gem_csize] << 7; pY++; if ( (px%2==0) && (py%2==0) )
Index: pix_2pdp.h =================================================================== RCS file: /cvsroot/pure-data/externals/gem2pdp/pix_2pdp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pix_2pdp.h 17 Jun 2005 13:45:22 -0000 1.1 --- pix_2pdp.h 11 Oct 2005 15:34:35 -0000 1.2 *************** *** 43,47 **** int gem_csize; int gem_format; ! // pdp data t_outlet *m_pdpoutlet; --- 43,48 ---- int gem_csize; int gem_format; ! int gem_upsidedown; ! // pdp data t_outlet *m_pdpoutlet;