Diffstat (limited to 'noncore/graphics/drawpad/filltool.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/filltool.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/noncore/graphics/drawpad/filltool.cpp b/noncore/graphics/drawpad/filltool.cpp index 0177e1c..2a39d04 100644 --- a/noncore/graphics/drawpad/filltool.cpp +++ b/noncore/graphics/drawpad/filltool.cpp | |||
@@ -37,3 +37,3 @@ void FillTool::mousePressEvent(QMouseEvent* e) | |||
37 | 37 | ||
38 | m_image = m_pDrawPadCanvas->currentPage()->convertToImage(); | 38 | m_image = m_pDrawPadCanvas->currentPage()->pixmap()->convertToImage(); |
39 | m_fillRgb = m_pDrawPad->brush().color().rgb(); | 39 | m_fillRgb = m_pDrawPad->brush().color().rgb(); |
@@ -42,2 +42,4 @@ void FillTool::mousePressEvent(QMouseEvent* e) | |||
42 | if (m_oldRgb != m_fillRgb) { | 42 | if (m_oldRgb != m_fillRgb) { |
43 | m_pDrawPadCanvas->backupPage(); | ||
44 | |||
43 | if (m_pDrawPad->antiAliasing()) { | 45 | if (m_pDrawPad->antiAliasing()) { |
@@ -60,6 +62,4 @@ void FillTool::mousePressEvent(QMouseEvent* e) | |||
60 | 62 | ||
61 | m_pDrawPadCanvas->currentPage()->convertFromImage(m_image); | 63 | m_pDrawPadCanvas->currentPage()->pixmap()->convertFromImage(m_image); |
62 | m_pDrawPadCanvas->viewport()->update(); | 64 | m_pDrawPadCanvas->viewport()->update(); |
63 | |||
64 | m_pDrawPadCanvas->backupPage(); | ||
65 | } | 65 | } |
@@ -113,27 +113,27 @@ void FillTool::fillMaskLine(int x, int y) | |||
113 | if (m_mask.pixelIndex(x, y) == 0) { | 113 | if (m_mask.pixelIndex(x, y) == 0) { |
114 | if (rgbDistance(m_image.pixel(x, y), m_oldRgb) < FILL_THRESHOLD) { | 114 | if (rgbDistance(m_image.pixel(x, y), m_oldRgb) < FILL_THRESHOLD) { |
115 | int x1, x2; | 115 | int x1, x2; |
116 | 116 | ||
117 | x1 = x - 1; | 117 | x1 = x - 1; |
118 | x2 = x + 1; | 118 | x2 = x + 1; |
119 | 119 | ||
120 | while ((x1 >= 0) && (rgbDistance(m_image.pixel(x1, y), m_oldRgb) < FILL_THRESHOLD)) { | 120 | while ((x1 >= 0) && (rgbDistance(m_image.pixel(x1, y), m_oldRgb) < FILL_THRESHOLD)) { |
121 | x1--; | 121 | x1--; |
122 | } | 122 | } |
123 | 123 | ||
124 | while ((x2 < m_image.width()) && (rgbDistance(m_image.pixel(x2, y), m_oldRgb) < FILL_THRESHOLD)) { | 124 | while ((x2 < m_image.width()) && (rgbDistance(m_image.pixel(x2, y), m_oldRgb) < FILL_THRESHOLD)) { |
125 | x2++; | 125 | x2++; |
126 | } | 126 | } |
127 | 127 | ||
128 | for (int i = x1 + 1; i < x2; i++) { | 128 | for (int i = x1 + 1; i < x2; i++) { |
129 | m_mask.setPixel(i, y, 1); | 129 | m_mask.setPixel(i, y, 1); |
130 | } | 130 | } |
131 | 131 | ||
132 | for (int i = x1 + 1; i < x2; i++) { | 132 | for (int i = x1 + 1; i < x2; i++) { |
133 | fillMaskLine(i, y - 1); | 133 | fillMaskLine(i, y - 1); |
134 | } | 134 | } |
135 | 135 | ||
136 | for (int i = x1 + 1; i < x2; i++) { | 136 | for (int i = x1 + 1; i < x2; i++) { |
137 | fillMaskLine(i, y + 1); | 137 | fillMaskLine(i, y + 1); |
138 | } | 138 | } |
139 | } | 139 | } |