mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 05:42:32 +00:00
Fix Eraser brush preview problems when the brush size is changed with the slider
This commit is contained in:
parent
c6de475556
commit
a94fbe7fd8
@ -41,6 +41,7 @@ using namespace doc;
|
|||||||
|
|
||||||
std::vector<gfx::Color> BrushPreview::m_savedPixels;
|
std::vector<gfx::Color> BrushPreview::m_savedPixels;
|
||||||
int BrushPreview::m_savedPixelsIterator;
|
int BrushPreview::m_savedPixelsIterator;
|
||||||
|
int BrushPreview::m_savedPixelsLimit;
|
||||||
|
|
||||||
BrushPreview::BrushPreview(Editor* editor)
|
BrushPreview::BrushPreview(Editor* editor)
|
||||||
: m_editor(editor)
|
: m_editor(editor)
|
||||||
@ -328,6 +329,8 @@ void BrushPreview::forEachBrushPixel(
|
|||||||
// little dot inside the active pixel)
|
// little dot inside the active pixel)
|
||||||
if (m_editor->zoom().scale() >= 4.0)
|
if (m_editor->zoom().scale() >= 4.0)
|
||||||
(this->*pixelDelegate)(g, screenPos, color);
|
(this->*pixelDelegate)(g, screenPos, color);
|
||||||
|
|
||||||
|
m_savedPixelsLimit = m_savedPixelsIterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrushPreview::traceCrossPixels(
|
void BrushPreview::traceCrossPixels(
|
||||||
@ -462,12 +465,14 @@ void BrushPreview::drawPixelDelegate(ui::Graphics* gfx, const gfx::Point& pt, gf
|
|||||||
void BrushPreview::clearPixelDelegate(ui::Graphics* g, const gfx::Point& pt, gfx::Color color)
|
void BrushPreview::clearPixelDelegate(ui::Graphics* g, const gfx::Point& pt, gfx::Color color)
|
||||||
{
|
{
|
||||||
if (m_savedPixelsIterator < (int)m_savedPixels.size()) {
|
if (m_savedPixelsIterator < (int)m_savedPixels.size()) {
|
||||||
if (m_clippingRegion.contains(pt))
|
if (m_oldClippingRegion.contains(pt)) {
|
||||||
g->putPixel(m_savedPixels[m_savedPixelsIterator++], pt.x, pt.y);
|
if (m_clippingRegion.contains(pt))
|
||||||
else if (!m_oldClippingRegion.isEmpty() &&
|
g->putPixel(m_savedPixels[m_savedPixelsIterator], pt.x, pt.y);
|
||||||
m_oldClippingRegion.contains(pt))
|
++m_savedPixelsIterator;
|
||||||
m_savedPixelsIterator++;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASSERT(m_savedPixelsIterator <= m_savedPixelsLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -96,6 +96,7 @@ namespace app {
|
|||||||
|
|
||||||
static std::vector<gfx::Color> m_savedPixels;
|
static std::vector<gfx::Color> m_savedPixels;
|
||||||
static int m_savedPixelsIterator;
|
static int m_savedPixelsIterator;
|
||||||
|
static int m_savedPixelsLimit;
|
||||||
|
|
||||||
gfx::Region m_clippingRegion;
|
gfx::Region m_clippingRegion;
|
||||||
gfx::Region m_oldClippingRegion;
|
gfx::Region m_oldClippingRegion;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user