1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-12 01:17:55 +03:00

improve roundness algorithm

--during searching the plasma theme roundness,
opacity values for pixels > 200 are considered
to be in panel background part. This fixes also
the Oxygen theme case and provides a better roundness
value now
This commit is contained in:
Michail Vourlakos 2019-06-12 23:02:45 +03:00
parent 734c08ffda
commit 1d5bce41d4

View File

@ -313,16 +313,17 @@ int Theme::roundness(const QImage &svgImage, Plasma::Types::Location edge)
int round{0};
int maxOpacity = qAlpha(svgImage.pixel(49,0));
int maxOpacity = qMin(qAlpha(svgImage.pixel(49,0)), 200);
if (edge == Plasma::Types::BottomEdge || edge == Plasma::Types::RightEdge || edge == Plasma::Types::TopEdge) {
//! TOPLEFT corner
//! first LEFT pixel found
QRgb *line = (QRgb *)svgImage.scanLine(discovRow);
for (int col=0; col<50; ++col) {
QRgb pixelData = line[col];
if (qAlpha(pixelData) != maxOpacity) {
if (qAlpha(pixelData) < maxOpacity) {
discovCol++;
round++;
} else {
@ -336,7 +337,7 @@ int Theme::roundness(const QImage &svgImage, Plasma::Types::Location edge)
for (int col=99; col>50; --col) {
QRgb pixelData = line[col];
if (qAlpha(pixelData) != maxOpacity) {
if (qAlpha(pixelData) < maxOpacity) {
discovCol--;
round++;
} else {