summaryrefslogtreecommitdiff
path: root/noncore/styles/theme/ogfxeffect.cpp
Side-by-side diff
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 @@
#include <cmath>
//======================================================================
//
// Gradient effects
//
//======================================================================
QPixmap& OGfxEffect::gradient(QPixmap &pixmap, const QColor &ca,
const QColor &cb, GradientType eff, int ncols)
{
- QImage image = gradient(pixmap.size(), ca, cb, eff, ncols);
- pixmap.convertFromImage(image);
-
+ if ( !pixmap. isNull ( )) {
+ QImage image = gradient(pixmap.size(), ca, cb, eff, ncols);
+ pixmap.convertFromImage(image);
+ }
return pixmap;
}
QImage OGfxEffect::gradient(const QSize &size, const QColor &ca,
const QColor &cb, GradientType eff, int /*ncols*/)
{
int rDiff, gDiff, bDiff;
int rca, gca, bca, rcb, gcb, bcb;
QImage image(size, 32);
if (size.width() == 0 || size.height() == 0) {
@@ -271,33 +272,34 @@ QImage OGfxEffect::gradient(const QSize &size, const QColor &ca,
//======================================================================
//
// Blend effects
//
//======================================================================
QPixmap& OGfxEffect::blend(QPixmap &pixmap, float initial_intensity,
const QColor &bgnd, GradientType eff,
bool anti_dir, int /*ncols*/)
{
- QImage image = pixmap.convertToImage();
- OGfxEffect::blend(image, initial_intensity, bgnd, eff, anti_dir);
-
- if ( pixmap. depth ( ) <= 8 )
- image. convertDepth ( pixmap. depth ( ));
+ if ( !pixmap. isNull ( )) {
+ QImage image = pixmap.convertToImage();
+ OGfxEffect::blend(image, initial_intensity, bgnd, eff, anti_dir);
- pixmap.convertFromImage(image);
+ if ( pixmap. depth ( ) <= 8 )
+ image. convertDepth ( pixmap. depth ( ));
- return pixmap;
+ pixmap.convertFromImage(image);
+ }
+ return pixmap;
}
QImage& OGfxEffect::blend(QImage &image, float initial_intensity,
const QColor &bgnd, GradientType eff,
bool anti_dir)
{
if (image.width() == 0 || image.height() == 0) {
qDebug ( "Invalid image\n" );
return image;
}