SOURCES: koffice-gmagick.patch (NEW) - port to new GraphicsMagick; untested

arekm arekm at pld-linux.org
Fri Aug 1 11:11:51 CEST 2008


Author: arekm                        Date: Fri Aug  1 09:11:51 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- port to new GraphicsMagick; untested

---- Files affected:
SOURCES:
   koffice-gmagick.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/koffice-gmagick.patch
diff -u /dev/null SOURCES/koffice-gmagick.patch:1.1
--- /dev/null	Fri Aug  1 11:11:52 2008
+++ SOURCES/koffice-gmagick.patch	Fri Aug  1 11:11:45 2008
@@ -0,0 +1,141 @@
+--- koffice-1.6.3/filters/krita/gmagick/kis_image_magick_converter.cc.org	2008-08-01 00:44:03.911882893 +0200
++++ koffice-1.6.3/filters/krita/gmagick/kis_image_magick_converter.cc	2008-08-01 11:08:43.918137184 +0200
+@@ -182,17 +182,25 @@
+ 
+             image -> addAnnotation(annotation);
+         }
+-        for(int i = 0; i < src->generic_profiles; i++)
+-        {
++	const char *profile_name;
++	size_t profile_length;
++	const unsigned char * profile_info;
++	ImageProfileIterator profile_iterator;
++
++	profile_iterator=AllocateImageProfileIterator(src);
++	while(NextImageProfile(profile_iterator,&profile_name,&profile_info,
++				&profile_length) != MagickFail)
++	{
+             QByteArray rawdata;
+             rawdata.resize(length);
+-            memcpy(rawdata.data(), src->generic_profile[i].info, src->generic_profile[i].length);
++            memcpy(rawdata.data(), profile_info, profile_length);
+             
+-            KisAnnotation* annotation = new KisAnnotation(QString(src->generic_profile[i].name), "", rawdata);
++            KisAnnotation* annotation = new KisAnnotation(QString(profile_name), "", rawdata);
+             Q_CHECK_PTR(annotation);
+ 
+             image -> addAnnotation(annotation);
+         }
++	DeallocateImageProfileIterator(profile_iterator);
+         
+         const ImageAttribute* imgAttr = GetImageAttribute(src, NULL);
+         while(imgAttr)
+@@ -480,7 +488,7 @@
+             Q_UINT8 opacity = OPACITY_OPAQUE;
+             const ImageAttribute * attr = GetImageAttribute(image, "[layer-opacity]");
+             if (attr != 0) {
+-                opacity = Q_UINT8_MAX - Downscale(QString(attr->value).toInt());
++                opacity = Q_UINT8_MAX - ScaleQuantumToChar(QString(attr->value).toInt());
+             }
+ 
+             KisPaintLayerSP layer = 0;
+@@ -534,17 +542,17 @@
+                         while (!hiter.isDone())
+                         {
+                             Q_UINT8 *ptr= hiter.rawData();
+-                            *(ptr++) = Downscale(pp->red); // cyan
+-                            *(ptr++) = Downscale(pp->green); // magenta
+-                            *(ptr++) = Downscale(pp->blue); // yellow
+-                            *(ptr++) = Downscale(indexes[x]); // Black
++                            *(ptr++) = ScaleQuantumToChar(pp->red); // cyan
++                            *(ptr++) = ScaleQuantumToChar(pp->green); // magenta
++                            *(ptr++) = ScaleQuantumToChar(pp->blue); // yellow
++                            *(ptr++) = ScaleQuantumToChar(indexes[x]); // Black
+ // XXX: Warning! This ifdef messes up the paren matching big-time!
+ #ifdef HAVE_MAGICK6
+                             if (image->matte != MagickFalse) {
+ #else
+                             if (image->matte == true) {
+ #endif
+-                                *(ptr++) = OPACITY_OPAQUE - Downscale(pp->opacity);
++                                *(ptr++) = OPACITY_OPAQUE - ScaleQuantumToChar(pp->opacity);
+                             }
+                             else {
+                                 *(ptr++) = OPACITY_OPAQUE;
+@@ -578,10 +586,10 @@
+                             {
+                                 Q_UINT8 *ptr= hiter.rawData();
+                                 // XXX: not colorstrategy and bitdepth independent
+-                                *(ptr++) = Downscale(pp->blue);
+-                                *(ptr++) = Downscale(pp->green);
+-                                *(ptr++) = Downscale(pp->red);
+-                                *(ptr++) = OPACITY_OPAQUE - Downscale(pp->opacity);
++                                *(ptr++) = ScaleQuantumToChar(pp->blue);
++                                *(ptr++) = ScaleQuantumToChar(pp->green);
++                                *(ptr++) = ScaleQuantumToChar(pp->red);
++                                *(ptr++) = OPACITY_OPAQUE - ScaleQuantumToChar(pp->opacity);
+ 
+                                 pp++;
+                                 ++hiter;
+@@ -608,8 +616,8 @@
+                             {
+                                 Q_UINT8 *ptr= hiter.rawData();
+                                 // XXX: not colorstrategy and bitdepth independent
+-                                *(ptr++) = Downscale(pp->blue);
+-                                *(ptr++) = OPACITY_OPAQUE - Downscale(pp->opacity);
++                                *(ptr++) = ScaleQuantumToChar(pp->blue);
++                                *(ptr++) = OPACITY_OPAQUE - ScaleQuantumToChar(pp->opacity);
+ 
+                                 pp++;
+                                 ++hiter;
+@@ -812,13 +820,13 @@
+                     while (!it.isDone()) {
+ 
+                         Q_UINT8 * d = it.rawData();
+-                        pp -> red = Upscale(d[PIXEL_CYAN]);
+-                        pp -> green = Upscale(d[PIXEL_MAGENTA]);
+-                        pp -> blue = Upscale(d[PIXEL_YELLOW]);
++                        pp -> red = ScaleCharToQuantum(d[PIXEL_CYAN]);
++                        pp -> green = ScaleCharToQuantum(d[PIXEL_MAGENTA]);
++                        pp -> blue = ScaleCharToQuantum(d[PIXEL_YELLOW]);
+                         if (alpha)
+-                            pp -> opacity = Upscale(OPACITY_OPAQUE - d[PIXEL_CMYK_ALPHA]);
++                            pp -> opacity = ScaleCharToQuantum(OPACITY_OPAQUE - d[PIXEL_CMYK_ALPHA]);
+ 
+-                        indexes[x]= Upscale(d[PIXEL_BLACK]);
++                        indexes[x]= ScaleCharToQuantum(d[PIXEL_BLACK]);
+ 
+                         x++;
+                         pp++;
+@@ -848,11 +856,11 @@
+                     while (!it.isDone()) {
+ 
+                         Q_UINT8 * d = it.rawData();
+-                        pp -> red = Upscale(d[PIXEL_RED]);
+-                        pp -> green = Upscale(d[PIXEL_GREEN]);
+-                        pp -> blue = Upscale(d[PIXEL_BLUE]);
++                        pp -> red = ScaleCharToQuantum(d[PIXEL_RED]);
++                        pp -> green = ScaleCharToQuantum(d[PIXEL_GREEN]);
++                        pp -> blue = ScaleCharToQuantum(d[PIXEL_BLUE]);
+                         if (alpha)
+-                            pp -> opacity = Upscale(OPACITY_OPAQUE - d[PIXEL_ALPHA]);
++                            pp -> opacity = ScaleCharToQuantum(OPACITY_OPAQUE - d[PIXEL_ALPHA]);
+ 
+                         pp++;
+                         ++it;
+@@ -879,11 +887,11 @@
+                 else {
+                     while (!it.isDone()) {
+                         Q_UINT8 * d = it.rawData();
+-                        pp -> red = Upscale(d[PIXEL_GRAY]);
+-                        pp -> green = Upscale(d[PIXEL_GRAY]);
+-                        pp -> blue = Upscale(d[PIXEL_GRAY]);
++                        pp -> red = ScaleCharToQuantum(d[PIXEL_GRAY]);
++                        pp -> green = ScaleCharToQuantum(d[PIXEL_GRAY]);
++                        pp -> blue = ScaleCharToQuantum(d[PIXEL_GRAY]);
+                         if (alpha)
+-                            pp -> opacity = Upscale(OPACITY_OPAQUE - d[PIXEL_GRAY_ALPHA]);
++                            pp -> opacity = ScaleCharToQuantum(OPACITY_OPAQUE - d[PIXEL_GRAY_ALPHA]);
+ 
+                         pp++;
+                         ++it;
================================================================


More information about the pld-cvs-commit mailing list