[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenox/konq-embed/kdesrc/khtml/patches
From: Uli Luckas <u.luckas () road-gmbh ! de>
Date: 2007-08-15 13:12:53
Message-ID: 1187183573.345400.11448.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 700400 by luckas:
This pazch actually fixes the google logo (see r700055)
Actually commit 700055 was based on a wrong analysis. The real problem with the google logo is,
that it is a background image and before this patch, background images were not scaled at all.
M +58 -12 image_scaling.patch
--- trunk/kdenox/konq-embed/kdesrc/khtml/patches/image_scaling.patch #700399:700400
@@ -155,11 +155,63 @@
QString m_strSelectedURL;
QString m_strSelectedURLTarget;
-diff -u -r ../../../../khtml.org/rendering/render_box.cpp ./rendering/render_box.cpp
+diff -u -r ../../../../khtml.org/rendering/render_box.h ./rendering/render_box.h
+--- ../../../../khtml.org/rendering/render_box.h
++++ ./rendering/render_box.h
+@@ -160,6 +160,11 @@
+ void restructureParentFlow();
+
+
++ /*
++ * Cache for scaled background image
++ */
++ QPixmap resizeCache;
++
+ // the actual height of the contents + borders + padding (border-box)
+ int m_height;
+ int m_y;
+diff -u -r ../../../../khtml.org/rendering/render_box.cpp ./rendering/render_box.
--- ../../../../khtml.org/rendering/render_box.cpp
+++ ./rendering/render_box.cpp
-@@ -1070,7 +1070,10 @@
+@@ -431,8 +431,9 @@
+
+ // CSS2 chapter 14.2.1
+
+- int pixw = bg->pixmap_size().width();
+- int pixh = bg->pixmap_size().height();
++ int scaleFactor = style()->scalingFactor();
++ int pixw = bg->pixmap_size().width() * scaleFactor / 100;
++ int pixh = bg->pixmap_size().height() * scaleFactor / 100;
+ if (bgLayer->backgroundAttachment())
+ {
+ //scroll
+@@ -535,9 +536,21 @@
+ cx=b.x();cy=b.y();cw=b.width();ch=b.height();
+ }
+
+- if (cw>0 && ch>0)
+- p->drawTiledPixmap(cx, cy, cw, ch, bg->tiled_pixmap(c), sx, sy);
+-
++ if (cw>0 && ch>0) {
++ if ( resizeCache.isNull() || resizeCache.width() != pixw || resizeCache.height() != pixh) {
++ const QPixmap& pix = bg->tiled_pixmap(c);
++ if (scaleFactor == 100) {
++ resizeCache = pix;
++ } else {
++ resizeCache = pix.convertToImage().smoothScale(pixw, pixh);
++ }
++ }
++// if (style()->scalingFactor() != 100) {
++// sx = sx * style()->scalingFactor() / 100;
++// sy = sy * style()->scalingFactor() / 100;
++// }
++ p->drawTiledPixmap(cx, cy, cw, ch, resizeCache, sx, sy);
++ }
}
+ }
+
+@@ -1070,7 +1083,10 @@
+ }
// fall through
default:
- return intrinsicWidth();
@@ -170,7 +222,7 @@
}
}
-@@ -1109,7 +1109,10 @@
+@@ -1109,7 +1125,10 @@
// fall through
}
default:
@@ -235,7 +287,7 @@
// ### make the font stuff _really_ work!!!!
--- rendering/render_image.cpp
+++ rendering/render_image.cpp.patched
-@@ -298,19 +298,23 @@
+@@ -298,17 +298,19 @@
if ( (cWidth != intrinsicWidth() || cHeight != intrinsicHeight()) &&
pix.width() > 0 && pix.height() > 0 && i->valid_rect().isValid())
{
@@ -251,18 +303,12 @@
- matrix.scale( (float)(cWidth)/intrinsicWidth(),
- (float)(cHeight)/intrinsicHeight() );
- resizeCache = pix.xForm( matrix );
-- scaledrect.setWidth( ( cWidth*scaledrect.width() ) / intrinsicWidth() );
-- scaledrect.setHeight( ( cHeight*scaledrect.height() ) / intrinsicHeight() );
+// QWMatrix matrix;
+// matrix.scale( (float)(cWidth)/intrinsicWidth(),
+// (float)(cHeight)/intrinsicHeight() );
+// resizeCache = pix.xForm( matrix );
+ QImage qi = pix.convertToImage();
+ resizeCache = qi.smoothScale(cWidth,cHeight);
-+ scaledrect.setRect( scaledrect.x() * style()->scalingFactor() / 100,
-+ scaledrect.y() * style()->scalingFactor() / 100,
-+ ( cWidth*scaledrect.width() ) / intrinsicWidth(),
-+ ( cHeight*scaledrect.height() ) / intrinsicHeight() );
+ scaledrect.setWidth( ( cWidth*scaledrect.width() ) / intrinsicWidth() );
+ scaledrect.setHeight( ( cHeight*scaledrect.height() ) / intrinsicHeight() );
// qDebug("resizeCache size: %d/%d", resizeCache.width(), resizeCache.height());
- // qDebug("valid: %d/%d, scaled: %d/%d",
- // i->valid_rect().width(), i->valid_rect().height(),
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic