]> www.fi.muni.cz Git - evince.git/commitdiff
:ThumbColorMap): unused now, remove.
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>
Sat, 8 May 2004 13:51:12 +0000 (13:51 +0000)
committerMartin Kretzschmar <mkretzschmar@src.gnome.org>
Sat, 8 May 2004 13:51:12 +0000 (13:51 +0000)
* xpdf/Thumb.cc (ThumbColorMap::ThumbColorMap): unused now, remove.

* xpdf/Thumb.h: ditto.

pdf/xpdf/Thumb.cc
pdf/xpdf/Thumb.h

index 63bbdf709cd57b6a96d9c4698051e4cdf0d59b92..bc735b8f4b4f6bcc04f008d0297290afd93d165f 100644 (file)
 #include "GfxState.h"
 #include "Thumb.h"
 
-static GHashTable *cmhash = NULL;
-
-/*
- * ThumbColorMap
- */
-ThumbColorMap::ThumbColorMap(int bitsA,
-                             Object *obj,
-                             GfxColorSpace *csA) :
-  bits(bitsA),
-  str(NULL),
-  cs(csA), 
-  length(0)
-{
-        Object obj1, obj2; 
-        GfxIndexedColorSpace *iCS;
-        GfxSeparationColorSpace *sepCS;
-        int maxPixel;
-        Dict *streamDict;
-        int n;
-        int baseNComps; 
-
-        ok = gFalse;
-        maxPixel = (1 << bits) - 1;
-
-        do {
-                if (!obj->isStream ()) {
-                        printf ("Error: Invalid object of type %s\n",
-                                obj->getTypeName ()); 
-                        break; 
-                }
-                str = obj->getStream(); 
-
-                streamDict = obj->streamGetDict ();
-
-                streamDict->lookupNF ("Filter", &obj1);
-                if (!obj1.isArray ()) {
-                        printf ("Error: Invalid filter object of type %s\n",
-                                obj1.getTypeName ()); 
-                        break;                         
-                }
-
-                str = str->addFilters(obj);
-
-               streamDict->lookup ("Length", &obj1);
-               if (obj1.isNull ())
-               {
-                       printf ("Error: No Length object\n"); 
-                        break; 
-               }
-               if (!obj1.isInt ()) {
-                       printf ("Error: Invalid Width object %s\n",
-                               obj1.getTypeName ());
-                       obj1.free ();
-                       break;
-               }
-               length = obj1.getInt ();
-               obj1.free ();
-
-                nComps = cs->getNComps();
-
-                if (cs->getMode () == csIndexed) {
-                        iCS = (GfxIndexedColorSpace *)cs;
-                        baseNComps = iCS->getBase ()->getNComps ();
-                        str->reset(); 
-                        if (iCS->getBase ()->getMode () == csDeviceGray) {
-                                gray = (double *)gmalloc(sizeof(double) * (iCS->getIndexHigh () + 1));
-                                for (n = 0; n <= iCS->getIndexHigh (); n++) {
-                                        double comp = (double)str->getChar(); 
-                                        //printf ("Gray pixel [%03d] = %02x\n", n, (int)comp); 
-                                        gray[n] = comp / (double)iCS->getIndexHigh (); 
-                                }
-                        }
-                        else if (iCS->getBase ()->getMode () == csDeviceRGB) {
-                                rgb = (GfxRGB *)gmalloc(sizeof(GfxRGB) * (iCS->getIndexHigh () + 1));
-                                for (n = 0; n <= iCS->getIndexHigh (); n++) {
-                                        double comp_r = (double)str->getChar(); 
-                                        double comp_g = (double)str->getChar(); 
-                                        double comp_b = (double)str->getChar(); 
-//                                        printf ("RGB pixel [0x%02x] = (%02x,%02x,%02x)\n",
-//                                                n, (int)comp_r, (int)comp_g, (int)comp_b); 
-                                        rgb[n].r = comp_r / (double)iCS->getIndexHigh (); 
-                                        rgb[n].g = comp_g / (double)iCS->getIndexHigh (); 
-                                        rgb[n].b = comp_b / (double)iCS->getIndexHigh (); 
-                                }
-                        }
-                        else if (iCS->getBase ()->getMode () == csDeviceCMYK) {
-                                cmyk = (GfxCMYK *)gmalloc(sizeof(GfxCMYK) * (iCS->getIndexHigh () + 1));
-                                for (n = 0; n <= iCS->getIndexHigh (); n++) {
-                                        double comp_c = (double)str->getChar(); 
-                                        double comp_m = (double)str->getChar(); 
-                                        double comp_y = (double)str->getChar(); 
-                                        double comp_k = (double)str->getChar(); 
-                                        //printf ("CMYK pixel [%03d] = (%02x,%02x,%02x,%02x)\n",
-                                        //        n, (int)comp_c, (int)comp_m, (int)comp_y, (int)comp_k); 
-                                        cmyk[n].c = comp_c / (double)iCS->getIndexHigh (); 
-                                        cmyk[n].m = comp_m / (double)iCS->getIndexHigh (); 
-                                        cmyk[n].y = comp_y / (double)iCS->getIndexHigh (); 
-                                        cmyk[n].k = comp_k / (double)iCS->getIndexHigh (); 
-                                }
-                        }
-                }
-                else if (cs->getMode () == csSeparation) {
-                        sepCS = (GfxSeparationColorSpace *)cs; 
-                        /* FIXME: still to do */
-                }
-
-                ok = gTrue;
-        }
-        while (0); 
-}
-
-ThumbColorMap *
-ThumbColorMap::lookupColorMap(XRef *xref, int bits, Object *obj, GfxColorSpace *cs)
-{
-       Object obj1; 
-       ThumbColorMap *cm; 
-       gchar *key;
-       
-       if (!cmhash)
-               cmhash = g_hash_table_new(NULL, g_int_equal); 
-
-       key = g_strdup_printf ("%d %d R", obj->getRefNum (), obj->getRefGen ());
-
-       if (!(cm = (ThumbColorMap *)g_hash_table_lookup (cmhash, &key))) {
-               cm = new ThumbColorMap(bits, obj->fetch(xref, &obj1), cs);
-               obj1.free(); 
-               g_hash_table_insert(cmhash, &key, cm); 
-       }
-
-       g_free (key); 
-
-       return cm; 
-}
-
-void
-ThumbColorMap::getGray(Guchar *x, double *outgray)
-{
-       *outgray = gray[*x];
-}
-
-void
-ThumbColorMap::getRGB(Guchar *x, GfxRGB *outrgb)
-{
-       outrgb->r = rgb[*x].r;
-       outrgb->g = rgb[*x].g;
-       outrgb->b = rgb[*x].b;
-}
-
-void
-ThumbColorMap::getCMYK(Guchar *x, GfxCMYK *outcmyk)
-{
-       outcmyk->c = cmyk[*x].c;
-       outcmyk->m = cmyk[*x].m;
-       outcmyk->y = cmyk[*x].y;
-       outcmyk->k = cmyk[*x].k;
-}
-
-ThumbColorMap::~ThumbColorMap()
-{
-        delete str;
-        gfree((void *)gray); 
-}
-
 /*
  * Thumb
  */
index 6644464ee94d6433cebbc538330161130f9840b0..2042acd3ac791b9e8c446c793ae993509f4bc454 100644 (file)
 
 class XRef;
 class GfxColorSpace;
-class GfxRGB;
-class GfxCMYK;
-class GfxColor;
-
-/*
- * ThumbColorMap
- */
-class ThumbColorMap {
-
-      public:
-        ThumbColorMap(int bitsA, Object *obj, GfxColorSpace *csA);
-        ~ThumbColorMap();
-        
-        GBool isOk() {return ok; };
-        
-        GfxColorSpace *getColorSpace() { return cs; }; 
-        
-        int getNumPixelComps() { return nComps; }; 
-        int getBits() { return bits; }; 
-        
-        void getGray(Guchar *x, double *gray);
-        void getRGB(Guchar *x, GfxRGB *rgb);
-        void getCMYK(Guchar *x, GfxCMYK *cmyk);
-        //void getColor(Guchar *x, GfxColor *color);
-
-       static ThumbColorMap *lookupColorMap(XRef *xref, int bitsA, Object *obj, GfxColorSpace *csA); 
-
-      private:
-        GBool ok; 
-        int bits;
-        Stream *str;
-        GfxColorSpace *cs;
-        int nComps;
-        int length;
-        union {
-                double *gray;
-                GfxRGB *rgb;
-                GfxCMYK *cmyk;
-                GfxColor *colors; 
-        };
-};
-
-/*
- * ThumbColorMaps
- */
 
 /* FIXME: Should have a class to avoid reading same colormap for every thumb */