summaryrefslogtreecommitdiff
path: root/noncore/styles/theme/ogfxeffect.cpp
Unidiff
Diffstat (limited to 'noncore/styles/theme/ogfxeffect.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/theme/ogfxeffect.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/noncore/styles/theme/ogfxeffect.cpp b/noncore/styles/theme/ogfxeffect.cpp
index 2071a67..90b45fe 100644
--- a/noncore/styles/theme/ogfxeffect.cpp
+++ b/noncore/styles/theme/ogfxeffect.cpp
@@ -18,27 +18,28 @@
18#include <cmath> 18#include <cmath>
19 19
20//====================================================================== 20//======================================================================
21// 21//
22// Gradient effects 22// Gradient effects
23// 23//
24//====================================================================== 24//======================================================================
25 25
26 26
27QPixmap& OGfxEffect::gradient(QPixmap &pixmap, const QColor &ca, 27QPixmap& OGfxEffect::gradient(QPixmap &pixmap, const QColor &ca,
28 const QColor &cb, GradientType eff, int ncols) 28 const QColor &cb, GradientType eff, int ncols)
29{ 29{
30 QImage image = gradient(pixmap.size(), ca, cb, eff, ncols); 30 if ( !pixmap. isNull ( )) {
31 pixmap.convertFromImage(image); 31 QImage image = gradient(pixmap.size(), ca, cb, eff, ncols);
32 32 pixmap.convertFromImage(image);
33 }
33 return pixmap; 34 return pixmap;
34} 35}
35 36
36QImage OGfxEffect::gradient(const QSize &size, const QColor &ca, 37QImage OGfxEffect::gradient(const QSize &size, const QColor &ca,
37 const QColor &cb, GradientType eff, int /*ncols*/) 38 const QColor &cb, GradientType eff, int /*ncols*/)
38{ 39{
39 int rDiff, gDiff, bDiff; 40 int rDiff, gDiff, bDiff;
40 int rca, gca, bca, rcb, gcb, bcb; 41 int rca, gca, bca, rcb, gcb, bcb;
41 42
42 QImage image(size, 32); 43 QImage image(size, 32);
43 44
44 if (size.width() == 0 || size.height() == 0) { 45 if (size.width() == 0 || size.height() == 0) {
@@ -271,33 +272,34 @@ QImage OGfxEffect::gradient(const QSize &size, const QColor &ca,
271 272
272//====================================================================== 273//======================================================================
273// 274//
274// Blend effects 275// Blend effects
275// 276//
276//====================================================================== 277//======================================================================
277 278
278 279
279QPixmap& OGfxEffect::blend(QPixmap &pixmap, float initial_intensity, 280QPixmap& OGfxEffect::blend(QPixmap &pixmap, float initial_intensity,
280 const QColor &bgnd, GradientType eff, 281 const QColor &bgnd, GradientType eff,
281 bool anti_dir, int /*ncols*/) 282 bool anti_dir, int /*ncols*/)
282{ 283{
283 QImage image = pixmap.convertToImage(); 284 if ( !pixmap. isNull ( )) {
284 OGfxEffect::blend(image, initial_intensity, bgnd, eff, anti_dir); 285 QImage image = pixmap.convertToImage();
285 286 OGfxEffect::blend(image, initial_intensity, bgnd, eff, anti_dir);
286 if ( pixmap. depth ( ) <= 8 )
287 image. convertDepth ( pixmap. depth ( ));
288 287
289 pixmap.convertFromImage(image); 288 if ( pixmap. depth ( ) <= 8 )
289 image. convertDepth ( pixmap. depth ( ));
290 290
291 return pixmap; 291 pixmap.convertFromImage(image);
292 }
293 return pixmap;
292} 294}
293 295
294 296
295QImage& OGfxEffect::blend(QImage &image, float initial_intensity, 297QImage& OGfxEffect::blend(QImage &image, float initial_intensity,
296 const QColor &bgnd, GradientType eff, 298 const QColor &bgnd, GradientType eff,
297 bool anti_dir) 299 bool anti_dir)
298{ 300{
299 if (image.width() == 0 || image.height() == 0) { 301 if (image.width() == 0 || image.height() == 0) {
300 qDebug ( "Invalid image\n" ); 302 qDebug ( "Invalid image\n" );
301 return image; 303 return image;
302 } 304 }
303 305