summaryrefslogtreecommitdiff
authorleseb <leseb>2002-11-14 19:34:55 (UTC)
committer leseb <leseb>2002-11-14 19:34:55 (UTC)
commit4b28f45cd1f6a72f41219786c7fb411523a6d622 (patch) (unidiff)
tree1970f579a6e1bb3de20e0cb18eab169691542ae7
parentf27919a0b1c36c568a0a7d4480e3a37e3f6e67af (diff)
downloadopie-4b28f45cd1f6a72f41219786c7fb411523a6d622.zip
opie-4b28f45cd1f6a72f41219786c7fb411523a6d622.tar.gz
opie-4b28f45cd1f6a72f41219786c7fb411523a6d622.tar.bz2
Should fix bug 0000448
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/filltool.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/noncore/graphics/drawpad/filltool.cpp b/noncore/graphics/drawpad/filltool.cpp
index 2a39d04..b47aa60 100644
--- a/noncore/graphics/drawpad/filltool.cpp
+++ b/noncore/graphics/drawpad/filltool.cpp
@@ -15,48 +15,53 @@
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18#include "page.h" 18#include "page.h"
19 19
20#include <qimage.h> 20#include <qimage.h>
21 21
22const int FILL_THRESHOLD = 65536; 22const int FILL_THRESHOLD = 65536;
23 23
24FillTool::FillTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 24FillTool::FillTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
25 : Tool(drawPad, drawPadCanvas) 25 : Tool(drawPad, drawPadCanvas)
26{ 26{
27} 27}
28 28
29FillTool::~FillTool() 29FillTool::~FillTool()
30{ 30{
31} 31}
32 32
33void FillTool::mousePressEvent(QMouseEvent* e) 33void FillTool::mousePressEvent(QMouseEvent* e)
34{ 34{
35 int x = e->x(); 35 int x = e->x();
36 int y = e->y(); 36 int y = e->y();
37 37
38 m_image = m_pDrawPadCanvas->currentPage()->pixmap()->convertToImage(); 38 m_image = m_pDrawPadCanvas->currentPage()->pixmap()->convertToImage();
39
40 if (m_image.depth() <= 8) {
41 m_image = m_image.convertDepth(32);
42 }
43
39 m_fillRgb = m_pDrawPad->brush().color().rgb(); 44 m_fillRgb = m_pDrawPad->brush().color().rgb();
40 m_oldRgb = m_image.pixel(x, y); 45 m_oldRgb = m_image.pixel(x, y);
41 46
42 if (m_oldRgb != m_fillRgb) { 47 if (m_oldRgb != m_fillRgb) {
43 m_pDrawPadCanvas->backupPage(); 48 m_pDrawPadCanvas->backupPage();
44 49
45 if (m_pDrawPad->antiAliasing()) { 50 if (m_pDrawPad->antiAliasing()) {
46 m_mask.create(m_image.width(), m_image.height(), 8, 2); 51 m_mask.create(m_image.width(), m_image.height(), 8, 2);
47 m_mask.fill(0); 52 m_mask.fill(0);
48 53
49 fillMaskLine(x, y); 54 fillMaskLine(x, y);
50 55
51 for (int i = 0; i < m_image.width(); i++) { 56 for (int i = 0; i < m_image.width(); i++) {
52 for (int j = 0; j < m_image.height(); j++) { 57 for (int j = 0; j < m_image.height(); j++) {
53 if (m_mask.pixelIndex(i, j) == 1) { 58 if (m_mask.pixelIndex(i, j) == 1) {
54 setInterpolatedPixel(i, j); 59 setInterpolatedPixel(i, j);
55 } 60 }
56 } 61 }
57 } 62 }
58 63
59 } else { 64 } else {
60 fillLine(x, y); 65 fillLine(x, y);
61 } 66 }
62 67