~ubuntu-branches/ubuntu/saucy/hplip/saucy-proposed

« back to all changes in this revision

Viewing changes to prnt/hpcups/HPCupsFilter.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-05-26 11:20:39 UTC
  • mfrom: (1.5.6) (31.1.3 precise)
  • Revision ID: package-import@ubuntu.com-20120526112039-bevxczegxnbyr5m7
Tags: 3.12.4-1
* New upstream release
* Switch to source/format 3.0 (quilt) - drop dpatch
* Refreshed debian/patches
* dh_autoreconf debian/autogen.sh & set local-options single-debian-patch
* Update to debian/compat -> 9
* Fix "hardened build flags" patch from Moritz - thanks (Closes: #667828)
* Fix "duplex descriptor uninitialized" patch from Matej (Closes: #583273)
* Fix "please migrate to kde-runtime" patch from Pino (Closes: #666544)

Show diffs side-by-side

added added

removed removed

Lines of Context:
735
735
        int    k = 0;
736
736
        BYTE   *pIn = m_pPrinterBuffer;
737
737
        BYTE   kVal = 0;
738
 
        BYTE   b;
 
738
        BYTE   white=0;
739
739
        BYTE   *rgb = rgbRaster;
740
740
        BYTE   *black   = kRaster;
741
741
        memset (kRaster, 0, cups_header->cupsWidth);
745
745
            rgb[0] = *pIn++;
746
746
            rgb[1] = *pIn++;
747
747
            rgb[2] = *pIn++;
748
 
            b = *pIn++;
749
 
 
750
 
            if (b != 0 && b != 0xFF) {
751
 
 
752
 
#ifdef __linux
753
 
              //  rgb[0] -= (255 - b);
754
 
              //  rgb[1] -= (255 - b);
755
 
              //  rgb[2] -= (255 - b);
 
748
            white = *pIn++;
 
749
 
 
750
            if(white == 0)
 
751
            {
 
752
                //If W component is 0 (means black is 1) then no need of having RGB for that pixel.
 
753
                //ghostscript >= 8.71 sends both W and RGB for black pixel(i.e RGBW=(0,0,0,0)).
 
754
                                kVal |= pixel_value[k];
 
755
                                rgb[0] = 0xFF;
 
756
                                rgb[1] = 0xFF;
 
757
                                rgb[2] = 0xFF;
 
758
            }
 
759
            else if(white == 0xFF)
 
760
            {
 
761
                kVal |= 0;
 
762
            }
 
763
            else
 
764
            {
756
765
              int cr,cg,cb;
757
 
              cr = rgb[0] - (int)(255 - b);
 
766
              cr = rgb[0] - (int)(255 - white);
758
767
              rgb[0] = cr >= 0 ? cr : 0;
759
768
 
760
 
              cg = rgb[1] - (int)(255 - b);
 
769
              cg = rgb[1] - (int)(255 - white);
761
770
              rgb[1] = cg >= 0 ? cg : 0;
762
771
 
763
 
              cb = rgb[2] - (int)(255 - b);
764
 
              rgb[2] = cb >= 0 ? cb : 0;  
765
 
#else  // This alternate path is for Mac....
766
 
 
767
 
                rgb[0] &= b;
768
 
                rgb[1] &= b;
769
 
                rgb[2] &= b;
770
 
#endif
 
772
              cb = rgb[2] - (int)(255 - white);
 
773
              rgb[2] = cb >= 0 ? cb : 0;
771
774
            }
772
 
            else
773
 
                kVal |= (b == 0) ? pixel_value[k] : 0;
774
 
           // else if (rgb[0] == rgb[1] && rgb[1] ==rgb[2])
775
 
              //  kVal |= (rgb[0] == 0) ? pixel_value[k] : 0;
 
775
 
776
776
            rgb += 3;
777
777
            if (k == 7) {
778
778
                *black++ = kVal;