[Webkit-unassigned] [Bug 28076] fast/images/icon-decoding.html needs results for Qt

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 12 01:55:59 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28076





--- Comment #4 from Andras Becsi <becsi.andras at stud.u-szeged.hu>  2009-08-12 01:55:58 PDT ---
Here is a patch for qt which corrects the layout test, but the imlementation
should be changed higher up in QIcon and QPixmap. This is only an expected
behaviour change, which is more compilant to the ICO file format description
(http://www.daubnet.com/en/file-format-ico) which says:

"For general purpose ICOs there should be at least one 32x32 image using the 16
Windows colors."


diff --git a/src/plugins/imageformats/ico/qicohandler.cpp
b/src/plugins/imageformats/ico/qicohandler.cpp
index c9e04a4..77c68b7 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -802,7 +802,25 @@ bool QtIcoHandler::canRead(QIODevice *device)
 bool QtIcoHandler::read(QImage *image)
 {
     bool bSuccess = false;
-    QImage img = m_pICOReader->iconAt(m_currentIconIndex);
+
+    QIODevice *d = device();
+
+    QList<QImage> imgs = m_pICOReader->read(d);
+    QImage img = imgs[m_currentIconIndex];
+    QSize requestedSize(32,32);
+
+    if ( imgs.size() > 1 ){
+
+    // if we have multiple icons in the file we return the first with 32x32
resolution because it is the reference size
+    // FIXME: there should be a proper way of handling all the files in an ICO
file higher up in the abstraction
+    //        ie. to fill the caller QIcon with the icons in the ICO file
automatically, and let the user decide which to use
+        for ( int i=0; i<imgs.size(); ++i )
+            if ( imgs[i].size() == requestedSize ){
+                img = imgs[i];
+                break;
+            }
+
+    }

     // Make sure we only write to \a image when we succeed.
     if (!img.isNull()) {

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list