[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/runtime/kstyles/oxygen
From:       Matthew Woehlke <mw_triad () users ! sourceforge ! net>
Date:       2007-10-26 22:55:44
Message-ID: 1193439344.867444.7173.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 729782 by mwoehlke:

make glow "bias" right for size != 7


 M  +5 -5      helper.cpp  
 M  +1 -1      helper.h  
 M  +6 -6      lib/helper.cpp  
 M  +3 -1      lib/helper.h  


--- trunk/KDE/kdebase/runtime/kstyles/oxygen/helper.cpp #729781:729782
@@ -149,7 +149,7 @@
         p.drawPixmap(0, 0, slabPixmap);
 
         // glow
-        QPixmap gp = glow(glowColor, size*3, 21);
+        QPixmap gp = glow(glowColor, 21, size*3);
         p.drawPixmap(0, 0, gp);
 
         p.end();
@@ -244,13 +244,13 @@
 }
 
 void OxygenStyleHelper::drawInverseGlow(QPainter &p, const QColor &color,
-                                        int pad, int size) const
+                                        int pad, int size, int rsize) const
 {
     QRectF r(pad, pad, size, size);
     double m = double(size)*0.5;
 
     const double width = 3.0;
-    const double bias = 0.5;
+    const double bias = _glowBias * 7.0 / double(rsize);
     double k0 = (m-width) / (m-bias);
     QRadialGradient glowGradient(pad+m, pad+m, m-bias);
     for (int i = 0; i < 8; i++) { // inverse parabolic gradient
@@ -346,7 +346,7 @@
         slabTileSet->render(QRect(0,0,14,14), &p);
 
         // glow
-        QPixmap gp = glow(glowColor, size*2, 14);
+        QPixmap gp = glow(glowColor, 14, size*2);
         p.drawPixmap(0, 0, gp);
 
         p.end();
@@ -557,7 +557,7 @@
         p.setWindow(2,2,10,10);
 
         // glow
-        drawInverseGlow(p, glowColor, 3, 8);
+        drawInverseGlow(p, glowColor, 3, 8, size);
 
         p.end();
 
--- trunk/KDE/kdebase/runtime/kstyles/oxygen/helper.h #729781:729782
@@ -68,7 +68,7 @@
     SlabCache* slabCache(const QColor&);
 
     void drawInverseShadow(QPainter&, const QColor&, int pad, int size, double fuzz) const;
-    void drawInverseGlow(QPainter&, const QColor&, int pad, int size) const;
+    void drawInverseGlow(QPainter&, const QColor&, int pad, int size, int rsize) const;
     void drawHole(QPainter &p, const QColor&, double shade) const;
     void drawSlab(QPainter&, const QColor&, double shade) const;
 
--- trunk/KDE/kdebase/runtime/kstyles/oxygen/lib/helper.cpp #729781:729782
@@ -303,7 +303,7 @@
     return *pixmap;
 }
 
-QPixmap OxygenHelper::glow(const QColor &color, int rsize, int vsize)
+QPixmap OxygenHelper::glow(const QColor &color, int size, int rsize)
 {
     QPixmap pixmap(rsize, rsize);
     pixmap.fill(QColor(0,0,0,0));
@@ -311,13 +311,13 @@
     QPainter p(&pixmap);
     p.setRenderHints(QPainter::Antialiasing);
     p.setPen(Qt::NoPen);
-    p.setWindow(0,0,vsize,vsize);
+    p.setWindow(0,0,size,size);
 
-    QRectF r(0, 0, vsize, vsize);
-    double m = double(vsize)*0.5;
+    QRectF r(0, 0, size, size);
+    double m = double(size)*0.5;
 
     const double width = 3.0;
-    const double bias = 0.9; // TODO should depend on rsize, vsize
+    const double bias = _glowBias * double(size) / double(rsize);
     double k0 = (m-width+bias) / m;
     QRadialGradient glowGradient(m, m, m);
     for (int i = 0; i < 8; i++) { // inverse parabolic gradient
@@ -361,7 +361,7 @@
         p.drawPixmap(0, 0, slabPixmap);
 
         // glow
-        QPixmap gp = glow(glowColor, size*3, 21);
+        QPixmap gp = glow(glowColor, 21, size*3);
         p.drawPixmap(0, 0, gp);
 
         p.end();
--- trunk/KDE/kdebase/runtime/kstyles/oxygen/lib/helper.h #729781:729782
@@ -29,6 +29,8 @@
 #include <QtGui/QLinearGradient>
 #include <QtCore/QCache>
 
+#define _glowBias 0.9 // not likely to be configurable
+
 // WARNING - OxygenHelper must be a K_GLOBAL_STATIC!
 class OxygenHelper
 {
@@ -64,7 +66,7 @@
 
 protected:
     void drawShadow(QPainter&, const QColor&, int size) const;
-    static QPixmap glow(const QColor&, int rsize, int vsize);
+    static QPixmap glow(const QColor&, int size, int rsize);
 
     static const double _shadowGain;
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic