Commit 68b55bb7 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fixed the Experiment Brush to work in wrap-around mode

Now all the brushes are knows to work in Wrap-Around Mode.
parent 1f4c5b12
......@@ -80,7 +80,6 @@ void KisFloodFillBenchmark::benchmarkFlood()
{
KisFillPainter fillPainter(m_device);
//setupPainter(&fillPainter);
fillPainter.setBounds( QRect(0,0,GMP_IMAGE_WIDTH,GMP_IMAGE_HEIGHT) );
fillPainter.setPaintColor( fg );
fillPainter.setBackgroundColor( bg );
......
......@@ -64,7 +64,6 @@ void KisGradientBenchmark::benchmarkGradient()
Q_ASSERT(kograd);
KisGradientPainter fillPainter(m_device);
//setupPainter(&fillPainter);
fillPainter.setBounds( QRect(0,0,GMP_IMAGE_WIDTH,GMP_IMAGE_HEIGHT) );
fillPainter.setGradient(kograd);
fillPainter.beginTransaction(i18n("Gradient Fill"));
......
......@@ -84,10 +84,6 @@ KisPaintOp * KisPaintOpRegistry::paintOp(const QString & id, const KisPaintOpSet
return 0;
}
if (!painter->bounds().isValid() && image) {
painter->setBounds(image->bounds());
}
Q_ASSERT(settings);
KisPaintOpFactory* f = value(id);
......
......@@ -83,7 +83,6 @@ struct KisPainter::Private {
QVector<QRect> dirtyRects;
KisPaintOp* paintOp;
QRect bounds;
KoColor paintColor;
KoColor backgroundColor;
const KisFilterConfiguration* generator;
......@@ -155,7 +154,6 @@ void KisPainter::init()
d->fillStyle = FillStyleNone;
d->strokeStyle = StrokeStyleBrush;
d->antiAliasPolygonFill = true;
d->bounds = QRect();
d->progressUpdater = 0;
d->gradient = 0;
d->maskPainter = 0;
......@@ -1176,11 +1174,6 @@ void KisPainter::fillPainterPath(const QPainterPath& path, const QRect &requeste
fillRect &= requestedRect;
}
// Clip to the image bounds.
if (d->bounds.isValid()) {
fillRect &= d->bounds;
}
switch (fillStyle) {
default:
// Fall through
......@@ -1278,12 +1271,6 @@ void KisPainter::drawPainterPath(const QPainterPath& path, const QPen& pen)
// Expand the rectangle to allow for anti-aliasing.
fillRect.adjust(-1, -1, 1, 1);
// Clip to the image bounds.
if (d->bounds.isValid()) {
fillRect &= d->bounds;
}
d->fillPainter->fillRect(fillRect, paintColor(), OPACITY_OPAQUE_U8);
if (d->polygonMaskImage.isNull() || (d->maskPainter == 0)) {
......@@ -2377,16 +2364,6 @@ quint8 KisPainter::opacity() const
return quint8(d->paramInfo.opacity * 255.0f);
}
void KisPainter::setBounds(const QRect & bounds)
{
d->bounds = bounds;
}
QRect KisPainter::bounds()
{
return d->bounds;
}
void KisPainter::setCompositeOp(const KoCompositeOp * op)
{
d->compositeOp = op;
......
......@@ -683,12 +683,6 @@ public:
/// Returns the opacity that is used in painting
quint8 opacity() const;
/// Sets the bounds of the painter area; if not set, the painter
/// will happily paint where you ask it, making the paint device
/// larger as it goes
void setBounds(const QRect & bounds);
QRect bounds();
/// Set the composite op for this painter
void setCompositeOp(const KoCompositeOp * op);
const KoCompositeOp * compositeOp();
......
......@@ -118,7 +118,6 @@ void KisPatternGenerator::generate(KisProcessingInformation dstInfo,
gc.setWidth(size.width());
gc.setHeight(size.height());
gc.setFillStyle(KisFillPainter::FillStylePattern);
gc.setBounds(QRect(dstInfo.topLeft(), size));
gc.fillRect(QRect(dstInfo.topLeft(), size), pattern);
gc.end();
......
......@@ -81,9 +81,7 @@ void HatchingBrush::hatch(KisPaintDeviceSP dev, qreal x, qreal y, double width,
width_ = width;
m_painter.setMaskImageSize(width_, height_);
QRect limits(QPoint(0,0), QPoint(width_, height_));
m_painter.setBounds(limits);
/* dx and dy are the separation between lines in the x and y axis
dx = separation / sin(angle*M_PI/180); csc = 1/sin(angle) */
dy = fabs(separation / cos(angle*M_PI/180)); // sec = 1/cos(angle)
......
......@@ -199,7 +199,6 @@ void KisToolSelectBrush::applyToSelection(QPainterPath selection) {
KisPixelSelectionSP tmpSel = new KisPixelSelection();
KisPainter painter(tmpSel);
painter.setBounds(currentImage()->bounds());
painter.setPaintColor(KoColor(Qt::black, tmpSel->colorSpace()));
painter.setPaintOpPreset(currentPaintOpPreset(), currentImage());
painter.setAntiAliasPolygonFill(selectionOptionWidget()->antiAliasSelection());
......
......@@ -73,7 +73,6 @@ void KisToolSelectElliptical::finishEllipse(const QRectF &rect)
KisPixelSelectionSP tmpSel = new KisPixelSelection();
KisPainter painter(tmpSel);
painter.setBounds(currentImage()->bounds());
painter.setPaintColor(KoColor(Qt::black, tmpSel->colorSpace()));
painter.setPaintOpPreset(currentPaintOpPreset(), currentImage()); // And now the painter owns the op and will destroy it.
painter.setAntiAliasPolygonFill(m_widgetHelper.optionWidget()->antiAliasSelection());
......
......@@ -119,7 +119,6 @@ void KisToolSelectOutline::mouseReleaseEvent(KoPointerEvent *event)
KisPixelSelectionSP tmpSel = KisPixelSelectionSP(new KisPixelSelection());
KisPainter painter(tmpSel);
painter.setBounds(currentImage()->bounds());
painter.setPaintColor(KoColor(Qt::black, tmpSel->colorSpace()));
painter.setPaintOpPreset(currentPaintOpPreset(), currentImage());
painter.setAntiAliasPolygonFill(selectionOptionWidget()->antiAliasSelection());
......
......@@ -96,7 +96,6 @@ void KisToolSelectPath::LocalTool::addPathShape(KoPathShape* pathShape)
KisPixelSelectionSP tmpSel = KisPixelSelectionSP(new KisPixelSelection());
KisPainter painter(tmpSel);
painter.setBounds(m_selectionTool->currentImage()->bounds());
painter.setPaintColor(KoColor(Qt::black, tmpSel->colorSpace()));
painter.setFillStyle(KisPainter::FillStyleForegroundColor);
painter.setStrokeStyle(KisPainter::StrokeStyleNone);
......
......@@ -73,7 +73,6 @@ void KisToolSelectPolygonal::finishPolyline(const QVector<QPointF> &points)
KisPixelSelectionSP tmpSel = new KisPixelSelection();
KisPainter painter(tmpSel);
painter.setBounds(currentImage()->bounds());
painter.setPaintColor(KoColor(Qt::black, tmpSel->colorSpace()));
painter.setPaintOpPreset(currentPaintOpPreset(), currentImage()); // And now the painter owns the op and will destroy it.
painter.setAntiAliasPolygonFill(m_widgetHelper.optionWidget()->antiAliasSelection());
......
......@@ -119,7 +119,6 @@ KisResourcesSnapshot::~KisResourcesSnapshot()
void KisResourcesSnapshot::setupPainter(KisPainter* painter)
{
painter->setBounds(m_d->bounds->bounds());
painter->setPaintColor(m_d->currentFgColor);
painter->setBackgroundColor(m_d->currentBgColor);
painter->setGenerator(m_d->currentGenerator);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment