Bug 127189 - [test case] Konqueror sometimes shows gibberish instead of image if using background-image (for small images)
Summary: [test case] Konqueror sometimes shows gibberish instead of image if using bac...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-12 10:15 UTC by jordan.osete
Modified: 2006-05-21 14:05 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Disable pretiling. (549 bytes, patch)
2006-05-19 09:57 UTC, Allan Sandfeld
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jordan.osete 2006-05-12 10:15:41 UTC
Version:           3.5.2 (using KDE 3.5.2, Debian Package 4:3.5.2-2+b1 (testing/unstable))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-1-k7

If the image is loaded with an img tag (with src pointing to the image) it shows ok, but if it is loaded with background-image, it shows gibberish.
It seems to appear only with small images, regardless of wether it is loaded with data:urls or not.
Here is a page showing that problem:
http://ministeyr.free.fr/konqueror/gibberish.php

The background image should always be white, but it shows gibberish on the first two divs.
Comment 1 Tommi Tervo 2006-05-16 14:34:52 UTC
*** Bug 127444 has been marked as a duplicate of this bug. ***
Comment 2 Allan Sandfeld 2006-05-19 09:14:10 UTC
What X11 driver do you use? 

We have had problems with tiled painting in nvidia chipset (because we unlike everyone else use the tiled painting call, rather than tiling ourself).
Comment 3 Tommi Tervo 2006-05-19 09:44:12 UTC
I'm using radeon xorg driver (9200 chipset) and I see that gibberish.
Comment 4 Allan Sandfeld 2006-05-19 09:57:03 UTC
Created attachment 16171 [details]
Disable pretiling.

Yeah. Turned out to be our pre-tiling that breaks. Disabling fixes the bug
Comment 5 Allan Sandfeld 2006-05-19 10:27:34 UTC
Okay.. replacing copyBlt by bitBlt fixes the bug. The question is if copyBlt is broken in Qt 3.3
Comment 6 Maksim Orlovich 2006-05-19 16:23:47 UTC
bitBlt is wrong for images with alpha, you -need- to use copyBlt for them
Comment 7 Allan Sandfeld 2006-05-21 14:05:43 UTC
SVN commit 543129 by carewolf:

Make sure copyBlt doesn't fail because of different depth.
BUG:127189


 M  +8 -7      loader.cpp  


--- branches/KDE/3.5/kdelibs/khtml/misc/loader.cpp #543128:543129
@@ -489,7 +489,6 @@
 #define BGMINWIDTH      32
 #define BGMINHEIGHT     32
 
-
 const QPixmap &CachedImage::tiled_pixmap(const QColor& newc)
 {
     static QRgb bgTransparent = qRgba( 0, 0, 0, 0xFF );
@@ -511,11 +510,12 @@
     QSize s(pixmap_size());
     int w = r.width();
     int h = r.height();
+    assert(s.width() == r.width() && s.height() == s.height());
 
     const QPixmap* src; //source for pretiling, if any
     //See whether we can - and should - pre-blend
     if (isvalid && (r.hasAlphaChannel() || r.mask() )) {
-        bg = new QPixmap(w, h);
+        bg = new QPixmap(w, h, r.depth());
         bg->fill(newc);
         bitBlt(bg, 0, 0, &r);
         bgColor = newc.rgb();
@@ -529,15 +529,16 @@
     if ( w*h < 8192 )
     {
         if ( r.width() < BGMINWIDTH )
-            w = ((BGMINWIDTH  / s.width())+1) * s.width();
+            w = ((BGMINWIDTH-1) / s.width() + 1) * s.width();
         if ( r.height() < BGMINHEIGHT )
-            h = ((BGMINHEIGHT / s.height())+1) * s.height();
+            h = ((BGMINHEIGHT-1) / s.height() + 1) * s.height();
     }
-
     if ( w != r.width() || h != r.height() )
     {
-	QPixmap* oldbg = bg;
-        bg = new QPixmap(w, h);
+//         kdDebug() << "pre-tiling " << s.width() << "," << s.height() << " to " << w << "," << h << endl;
+        QPixmap* oldbg = bg;
+        bg = new QPixmap(w, h, r.depth());
+
         //Tile horizontally on the first stripe
         for (int x = 0; x < w; x += r.width())
             copyBlt(bg, x, 0, src, 0, 0, r.width(), r.height());