summaryrefslogtreecommitdiff
authorzecke <zecke>2002-11-03 11:14:01 (UTC)
committer zecke <zecke>2002-11-03 11:14:01 (UTC)
commit57e4563332689305ac247ca2e259b37c3592f389 (patch) (unidiff)
treeb9b20a5a115c9aff7163db1a517a32d19a293b34
parent5ec23891e1c5b7bc571d86326b511d1a48b14c45 (diff)
downloadopie-57e4563332689305ac247ca2e259b37c3592f389.zip
opie-57e4563332689305ac247ca2e259b37c3592f389.tar.gz
opie-57e4563332689305ac247ca2e259b37c3592f389.tar.bz2
include fixlet
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/theme/ogfxeffect.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/styles/theme/ogfxeffect.cpp b/noncore/styles/theme/ogfxeffect.cpp
index cc5bbcd..2071a67 100644
--- a/noncore/styles/theme/ogfxeffect.cpp
+++ b/noncore/styles/theme/ogfxeffect.cpp
@@ -1,80 +1,82 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> 2 Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
3 (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org> 3 (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org>
4 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> 4 (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org>
5 5
6*/ 6*/
7 7
8// $Id$ 8// $Id$
9 9
10#include <qimage.h> 10#include <qimage.h>
11#include <qpainter.h> 11#include <qpainter.h>
12 12
13#include <qpe/qmath.h> 13#include <qpe/qmath.h>
14 14
15#include "ogfxeffect.h" 15#include "ogfxeffect.h"
16 16
17#include <cstdlib>
18#include <cmath>
17 19
18//====================================================================== 20//======================================================================
19// 21//
20// Gradient effects 22// Gradient effects
21// 23//
22//====================================================================== 24//======================================================================
23 25
24 26
25QPixmap& OGfxEffect::gradient(QPixmap &pixmap, const QColor &ca, 27QPixmap& OGfxEffect::gradient(QPixmap &pixmap, const QColor &ca,
26 const QColor &cb, GradientType eff, int ncols) 28 const QColor &cb, GradientType eff, int ncols)
27{ 29{
28 QImage image = gradient(pixmap.size(), ca, cb, eff, ncols); 30 QImage image = gradient(pixmap.size(), ca, cb, eff, ncols);
29 pixmap.convertFromImage(image); 31 pixmap.convertFromImage(image);
30 32
31 return pixmap; 33 return pixmap;
32} 34}
33 35
34QImage OGfxEffect::gradient(const QSize &size, const QColor &ca, 36QImage OGfxEffect::gradient(const QSize &size, const QColor &ca,
35 const QColor &cb, GradientType eff, int /*ncols*/) 37 const QColor &cb, GradientType eff, int /*ncols*/)
36{ 38{
37 int rDiff, gDiff, bDiff; 39 int rDiff, gDiff, bDiff;
38 int rca, gca, bca, rcb, gcb, bcb; 40 int rca, gca, bca, rcb, gcb, bcb;
39 41
40 QImage image(size, 32); 42 QImage image(size, 32);
41 43
42 if (size.width() == 0 || size.height() == 0) { 44 if (size.width() == 0 || size.height() == 0) {
43 qDebug ( "WARNING: OGfxEffect::gradient: invalid image" ); 45 qDebug ( "WARNING: OGfxEffect::gradient: invalid image" );
44 return image; 46 return image;
45 } 47 }
46 48
47 register int x, y; 49 register int x, y;
48 50
49 rDiff = (rcb = cb.red()) - (rca = ca.red()); 51 rDiff = (rcb = cb.red()) - (rca = ca.red());
50 gDiff = (gcb = cb.green()) - (gca = ca.green()); 52 gDiff = (gcb = cb.green()) - (gca = ca.green());
51 bDiff = (bcb = cb.blue()) - (bca = ca.blue()); 53 bDiff = (bcb = cb.blue()) - (bca = ca.blue());
52 54
53 if( eff == VerticalGradient || eff == HorizontalGradient ){ 55 if( eff == VerticalGradient || eff == HorizontalGradient ){
54 56
55 uint *p; 57 uint *p;
56 uint rgb; 58 uint rgb;
57 59
58 register int rl = rca << 16; 60 register int rl = rca << 16;
59 register int gl = gca << 16; 61 register int gl = gca << 16;
60 register int bl = bca << 16; 62 register int bl = bca << 16;
61 63
62 if( eff == VerticalGradient ) { 64 if( eff == VerticalGradient ) {
63 65
64 int rcdelta = ((1<<16) / size.height()) * rDiff; 66 int rcdelta = ((1<<16) / size.height()) * rDiff;
65 int gcdelta = ((1<<16) / size.height()) * gDiff; 67 int gcdelta = ((1<<16) / size.height()) * gDiff;
66 int bcdelta = ((1<<16) / size.height()) * bDiff; 68 int bcdelta = ((1<<16) / size.height()) * bDiff;
67 69
68 for ( y = 0; y < size.height(); y++ ) { 70 for ( y = 0; y < size.height(); y++ ) {
69 p = (uint *) image.scanLine(y); 71 p = (uint *) image.scanLine(y);
70 72
71 rl += rcdelta; 73 rl += rcdelta;
72 gl += gcdelta; 74 gl += gcdelta;
73 bl += bcdelta; 75 bl += bcdelta;
74 76
75 rgb = qRgb( (rl>>16), (gl>>16), (bl>>16) ); 77 rgb = qRgb( (rl>>16), (gl>>16), (bl>>16) );
76 78
77 for( x = 0; x < size.width(); x++ ) { 79 for( x = 0; x < size.width(); x++ ) {
78 *p = rgb; 80 *p = rgb;
79 p++; 81 p++;
80 } 82 }