Commit 516abf27 authored by Sven Langkamp's avatar Sven Langkamp
Browse files

set the simple mode for brush outlines

CCBUG:273904
parent 1a14585e
......@@ -27,7 +27,7 @@
#include <KoColorSpace.h>
KisOutlineGenerator::KisOutlineGenerator(const KoColorSpace* cs, quint8 defaultOpacity)
: m_cs(cs), m_defaultOpacity(defaultOpacity)
: m_cs(cs), m_defaultOpacity(defaultOpacity), m_simple(false)
{
}
......@@ -60,8 +60,7 @@ QVector<QPolygon> KisOutlineGenerator::outline(quint8* buffer, qint32 xOffset, q
QPolygon path;
path << QPoint(x + xOffset, y + yOffset);
// XXX: Unused? (BSAR)
// bool clockwise = edge == BottomEdge;
bool clockwise = edge == BottomEdge;
qint32 row = y, col = x;
EdgeType currentEdge = edge;
......@@ -78,7 +77,8 @@ QVector<QPolygon> KisOutlineGenerator::outline(quint8* buffer, qint32 xOffset, q
nextOutlineEdge(&currentEdge, &row, &col, buffer, width, height);
} while (row != y || col != x || currentEdge != edge);
paths.push_back(path);
if(!m_simple || !clockwise)
paths.push_back(path);
}
}
}
......@@ -176,3 +176,8 @@ void KisOutlineGenerator::appendCoordinate(QPolygon * path, int x, int y, EdgeTy
}
*path << QPoint(x, y);
}
void KisOutlineGenerator::setSimpleOutline(bool simple)
{
m_simple = simple;
}
......@@ -55,7 +55,13 @@ public:
* @returns list of polygons around every non-transparent area
**/
QVector<QPolygon> outline(quint8* buffer, qint32 xOffset, qint32 yOffset, qint32 width, qint32 height);
/**
* Set the generator to produce simpile outline, skipping outline that are fully enclosed
* @param simple set simple mode, if true enclosed outline will be skipped
**/
void setSimpleOutline(bool simple);
private:
enum EdgeType {
......@@ -74,6 +80,7 @@ private:
const KoColorSpace* m_cs;
quint8 m_defaultOpacity;
bool m_simple;
};
#endif // KIS_OUTLINE_GENERATOR_H
......@@ -46,6 +46,7 @@ void KisBoundary::generateBoundary()
return;
KisOutlineGenerator generator(d->m_device->colorSpace(), OPACITY_TRANSPARENT_U8);
generator.setSimpleOutline(true);
d->m_boundary = generator.outline(d->m_device->data(), 0, 0, d->m_device->bounds().width(), d->m_device->bounds().height());
d->path = QPainterPath();
......
Supports Markdown
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