summaryrefslogtreecommitdiffstats
path: root/mandriva/2010.2/other/ksplash-engine-moodin/moodin-drawing_and_scaling_fixes.patch
blob: a856e993249503670c6c784506fdb8948cbd19a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
diff -p -up moodin/src/cache.cpp.orig moodin/src/cache.cpp
diff -p -up moodin/src/magiclabel.h.orig moodin/src/magiclabel.h
diff -p -up moodin/src/cache.h.orig moodin/src/cache.h
diff -p -up moodin/src/thememoodin.cpp.orig moodin/src/thememoodin.cpp
--- moodin/src/thememoodin.cpp.orig	2008-02-26 17:46:36.000000000 -0300
+++ moodin/src/thememoodin.cpp	2008-02-26 17:47:26.000000000 -0300
@@ -88,11 +88,11 @@ void ThemeMoodin::readSettings()
   mLabelShadowOffset = cfg->readPointEntry("LabelShadowOffset", &pos);
   QSize size(1280, 1024);
   mBaseResolution = cfg->readSizeEntry("BaseResolution", &size);
-  //For svg image use a negative size => force to create it.
+/*  //For svg image use a negative size => force to create it.
   if(!mUsersBackground && (mBackgroundImage.endsWith(".svg") || mBackgroundImage.endsWith(".svgz"))) {
 	  mBaseResolution=QSize();
   }
-
+*/
   mTranslate = cfg->readBoolEntry("Translate", true);
   mLineUpImages = cfg->readBoolEntry("LineUpImages", false);
 
@@ -325,7 +325,13 @@ EffectWidget* ThemeMoodin::createEffectW
   fw->setFixedSize(image->size());
   fw->setImage(image);
   fw->setStart(mBeginOpacity);
-  fw->show();
+  //fw->show();
+
+  for (EffectWidget *f = mEffectWidgets.first(); f; f = mEffectWidgets.next())
+  {
+     connect(f, SIGNAL(cacheNeedsUpdate()), fw, SLOT(updateCache()));
+     connect(fw, SIGNAL(cacheNeedsUpdate()), f, SLOT(updateCache()));
+  }
 
   return fw;
 }
@@ -358,7 +364,10 @@ void ThemeMoodin::slotSetPixmap(const QS
   EffectWidget *fw = mEffectWidgets.at(n);
 
   if (fw)
+  {
+    fw->show();
     fw->start();
+  }
 
   repaint(false);
 }
diff -p -up moodin/src/thememoodin.h.orig moodin/src/thememoodin.h
diff -p -up moodin/src/magiclabel.cpp.orig moodin/src/magiclabel.cpp
diff -p -up moodin/src/effectwidget.h.orig moodin/src/effectwidget.h
--- moodin/src/effectwidget.h.orig	2008-02-26 17:46:36.000000000 -0300
+++ moodin/src/effectwidget.h	2008-02-26 17:48:33.000000000 -0300
@@ -45,10 +45,12 @@ class EffectWidget : public QWidget
   void resizeEvent(QResizeEvent *);
   void moveEvent(QMoveEvent *);
 
-  void updateCache();
+signals:
+  void cacheNeedsUpdate();
 
  public slots:
   void timerTick();
+  void updateCache();
 
  private:
   static QImage *bgImage;
@@ -64,6 +66,7 @@ class EffectWidget : public QWidget
   float
     beginOpacity,
     endOpacity;
+  bool bgUpdated;
 };
 
 #endif
diff -p -up moodin/src/scaler.h.orig moodin/src/scaler.h
diff -p -up moodin/src/effectwidget.cpp.orig moodin/src/effectwidget.cpp
--- moodin/src/effectwidget.cpp.orig	2008-02-26 17:46:36.000000000 -0300
+++ moodin/src/effectwidget.cpp	2008-02-26 17:46:40.000000000 -0300
@@ -34,6 +34,8 @@ EffectWidget::EffectWidget(QWidget* pare
   setBackgroundMode(NoBackground);
   setBackgroundOrigin(QWidget::ParentOrigin);
   updateCache();
+
+  bgUpdated = false;
 }
 
 
@@ -157,7 +159,17 @@ void EffectWidget::paintEvent(QPaintEven
 
   QImage upper = image->copy();
   QImage lower = background.copy();
-  KImageEffect::blendOnLower(upper, lower, KImageEffect::Centered, (currentStep + 1 == totalSteps) ? 1.0 : endOpacity / float(totalSteps) * float(currentStep) + beginOpacity);
+
+  if ((currentStep + 1 == totalSteps) && !bgUpdated)
+  {
+      bgUpdated = true;
+      KImageEffect::blendOnLower(upper, lower, KImageEffect::Centered, 1.0);
+      QPoint p(mapToGlobal(QPoint(0,0)));
+      bitBlt(bgImage, p.x(), p.y(), &lower, 0, 0, -1, -1, 0);
+      emit cacheNeedsUpdate();
+  }
+  else
+      KImageEffect::blendOnLower(upper, lower, KImageEffect::Centered, endOpacity / float(totalSteps) * float(currentStep) + beginOpacity);
 
   bitBlt(this, 0, 0, &lower);
 }
diff -p -up moodin/src/scaler.cpp.orig moodin/src/scaler.cpp
--- moodin/src/scaler.cpp.orig	2008-02-26 17:46:36.000000000 -0300
+++ moodin/src/scaler.cpp	2008-02-26 17:47:44.000000000 -0300
@@ -15,16 +15,7 @@
 
 Scaler::Scaler(QSize baseResolution, QSize targetResolution)
 {
-  if(mBaseResolution.isValid())
-  {	  
-    mBaseResolution = baseResolution;
-    mSvgFile =false;
-  }
-  else
-  {
-    mBaseResolution = targetResolution;
-    mSvgFile = true;
-  }
+  mBaseResolution = baseResolution;
   mTargetResolution = targetResolution;
 }
 
@@ -53,7 +44,7 @@ void Scaler::autoCoords(QPoint* pt, cons
 
 void Scaler::scaleCoords(QPoint* pt)
 {
-  if (!mSvgFile && (mBaseResolution == mTargetResolution))
+  if (mBaseResolution == mTargetResolution)
     return;
 
   int ox = pt->x();
@@ -104,7 +95,7 @@ bool Scaler::scaleSize(QFont* f)
 
 bool Scaler::resolutionDiff()
 {
-  return (mSvgFile || (mBaseResolution != mTargetResolution));
+  return (mBaseResolution != mTargetResolution);
 }