Diffstat (limited to 'noncore/apps/opie-reader/StyleConsts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/StyleConsts.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/StyleConsts.cpp b/noncore/apps/opie-reader/StyleConsts.cpp index f47acee..77c9d3b 100644 --- a/noncore/apps/opie-reader/StyleConsts.cpp +++ b/noncore/apps/opie-reader/StyleConsts.cpp | |||
@@ -1,94 +1,108 @@ | |||
1 | 1 | ||
2 | #include <qimage.h> | 2 | #include <qimage.h> |
3 | #include "StyleConsts.h" | 3 | #include "StyleConsts.h" |
4 | 4 | ||
5 | GraphicLink::~GraphicLink() { delete graphic; } | 5 | GraphicLink::~GraphicLink() { delete graphic; } |
6 | 6 | ||
7 | pmstore::~pmstore() | 7 | pmstore::~pmstore() |
8 | { | 8 | { |
9 | //// odebug << "Deleting image" << oendl; | 9 | //// qDebug("Deleting image"); |
10 | delete graphic; | 10 | delete graphic; |
11 | } | 11 | } |
12 | 12 | ||
13 | CStyle::~CStyle() | 13 | CStyle::~CStyle() |
14 | { | 14 | { |
15 | if (graphic != NULL) | 15 | if (graphic != NULL) |
16 | { | 16 | { |
17 | if (--(graphic->count) == 0) | 17 | if (--(graphic->count) == 0) |
18 | { | 18 | { |
19 | delete graphic; | 19 | delete graphic; |
20 | } | 20 | } |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | CStyle::CStyle(const CStyle& rhs) : graphic(NULL) | 24 | CStyle::CStyle(const CStyle& rhs) : graphic(NULL) |
25 | { | 25 | { |
26 | *this = rhs; | 26 | *this = rhs; |
27 | } | 27 | } |
28 | 28 | ||
29 | CStyle& CStyle::operator=(const CStyle& rhs) | 29 | CStyle& CStyle::operator=(const CStyle& rhs) |
30 | { | 30 | { |
31 | if (rhs.graphic != NULL) | 31 | if (rhs.graphic != NULL) |
32 | { | 32 | { |
33 | (rhs.graphic->count)++; | 33 | (rhs.graphic->count)++; |
34 | if (graphic != NULL) | 34 | if (graphic != NULL) |
35 | { | 35 | { |
36 | if (--(graphic->count) == 0) | 36 | if (--(graphic->count) == 0) |
37 | { | 37 | { |
38 | delete graphic; | 38 | delete graphic; |
39 | } | 39 | } |
40 | } | 40 | } |
41 | graphic = rhs.graphic; | 41 | graphic = rhs.graphic; |
42 | } | 42 | } |
43 | else | 43 | else |
44 | { | 44 | { |
45 | if (graphic != NULL) | 45 | if (graphic != NULL) |
46 | { | 46 | { |
47 | if (--(graphic->count) == 0) | 47 | if (--(graphic->count) == 0) |
48 | { | 48 | { |
49 | delete graphic; | 49 | delete graphic; |
50 | } | 50 | } |
51 | graphic = NULL; | 51 | graphic = NULL; |
52 | } | 52 | } |
53 | } | 53 | } |
54 | sty = rhs.sty; | 54 | sty = rhs.sty; |
55 | return *this; | 55 | return *this; |
56 | } | 56 | } |
57 | 57 | ||
58 | void CStyle::clearPicture() | 58 | void CStyle::clearPicture() |
59 | { | 59 | { |
60 | if (graphic != NULL) | 60 | if (graphic != NULL) |
61 | { | 61 | { |
62 | if (--(graphic->count) == 0) | 62 | if (--(graphic->count) == 0) |
63 | { | 63 | { |
64 | delete graphic; | 64 | delete graphic; |
65 | } | 65 | } |
66 | graphic = NULL; | 66 | graphic = NULL; |
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | void CStyle::unset() | 70 | void CStyle::unset() |
71 | { | 71 | { |
72 | sty.unset(); | 72 | sty.unset(); |
73 | if (graphic != NULL) | 73 | if (graphic != NULL) |
74 | { | 74 | { |
75 | if (--(graphic->count) == 0) | 75 | if (--(graphic->count) == 0) |
76 | { | 76 | { |
77 | delete graphic; | 77 | delete graphic; |
78 | } | 78 | } |
79 | graphic = NULL; | 79 | graphic = NULL; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | void CStyle::setPicture(bool canScale, QImage* _g, bool il, unsigned long tgt) | 83 | void CStyle::setPicture(bool canScale, QImage* _g, bool il, unsigned long tgt) |
84 | { | 84 | { |
85 | if (graphic != NULL) | 85 | if (graphic != NULL) |
86 | { | 86 | { |
87 | if (--(graphic->count) == 0) | 87 | if (--(graphic->count) == 0) |
88 | { | 88 | { |
89 | delete graphic; | 89 | delete graphic; |
90 | } | 90 | } |
91 | graphic = NULL; | 91 | graphic = NULL; |
92 | } | 92 | } |
93 | if (_g != NULL) graphic = new pmstore(canScale, _g, il, tgt); | 93 | if (_g != NULL) graphic = new pmstore(canScale, _g, il, tgt); |
94 | } | 94 | } |
95 | |||
96 | void CStyle::invert() | ||
97 | { | ||
98 | qDebug("Before:<%02x%02x%02x>", sty.bred, sty.bgreen, sty.bblue); | ||
99 | qDebug("Before:<%02x%02x%02x>", sty.red, sty.green, sty.blue); | ||
100 | sty.bred = 255-sty.bred; | ||
101 | sty.bgreen = 255-sty.bgreen; | ||
102 | sty.bblue = 255-sty.bblue; | ||
103 | sty.red = 255-sty.red; | ||
104 | sty.green = 255-sty.green; | ||
105 | sty.blue = 255-sty.blue; | ||
106 | qDebug("After:<%02x%02x%02x>", sty.bred, sty.bgreen, sty.bblue); | ||
107 | qDebug("After:<%02x%02x%02x>", sty.red, sty.green, sty.blue); | ||
108 | } | ||