[x11] - fix 30bit color depth that makes dock invisible with broken transparency

work/m_layershell
Jonas Latza 3 years ago committed by Michail Vourlakos
parent de61ff48ad
commit ccbf079113

@ -125,10 +125,10 @@ void PanelBackground::updateMaxOpacity(Plasma::Svg *svg)
//! calculating the mid opacity (this is needed in order to handle Oxygen //! calculating the mid opacity (this is needed in order to handle Oxygen
//! that has different opacity levels in the same center element) //! that has different opacity levels in the same center element)
for (int row=0; row<2; ++row) { for (int row=0; row<2; ++row) {
QRgb *line = (QRgb *)center.scanLine(row); QRgba64 *line = (QRgba64 *)center.scanLine(row);
for (int col=0; col<CENTERWIDTH; ++col) { for (int col=0; col<CENTERWIDTH; ++col) {
QRgb pixelData = line[col]; QRgba64 pixelData = line[col];
alphasum += ((float)qAlpha(pixelData)/(float)255); alphasum += ((float)qAlpha(pixelData)/(float)255);
} }
} }
@ -171,11 +171,11 @@ void PanelBackground::updateRoundnessFromMask(Plasma::Svg *svg)
if (topLeftCorner) { if (topLeftCorner) {
//! TOPLEFT corner //! TOPLEFT corner
QRgb *line = (QRgb *)corner.scanLine(baseRow); QRgba64 *line = (QRgba64 *)corner.scanLine(baseRow);
QRgb basePoint = line[baseCol]; QRgba64 basePoint = line[baseCol];
QRgb *isRoundedLine = (QRgb *)corner.scanLine(0); QRgba64 *isRoundedLine = (QRgba64 *)corner.scanLine(0);
QRgb isRoundedPoint = isRoundedLine[0]; QRgba64 isRoundedPoint = isRoundedLine[0];
//! If there is roundness, if that point is not fully transparent then //! If there is roundness, if that point is not fully transparent then
//! there is no roundness //! there is no roundness
@ -184,8 +184,8 @@ void PanelBackground::updateRoundnessFromMask(Plasma::Svg *svg)
if (qAlpha(basePoint) > 0) { if (qAlpha(basePoint) > 0) {
//! calculate the mask baseLine length //! calculate the mask baseLine length
for(int c = baseCol; c>=0; --c) { for(int c = baseCol; c>=0; --c) {
QRgb *l = (QRgb *)corner.scanLine(baseRow); QRgba64 *l = (QRgba64 *)corner.scanLine(baseRow);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) > 0) { if (qAlpha(point) > 0) {
baseLineLength ++; baseLineLength ++;
@ -202,8 +202,8 @@ void PanelBackground::updateRoundnessFromMask(Plasma::Svg *svg)
int tailLimitR = baseRow; int tailLimitR = baseRow;
for (int r = baseRow-1; r>=0; --r) { for (int r = baseRow-1; r>=0; --r) {
QRgb *line = (QRgb *)corner.scanLine(r); QRgba64 *line = (QRgba64 *)corner.scanLine(r);
QRgb fpoint = line[baseCol]; QRgba64 fpoint = line[baseCol];
if (qAlpha(fpoint) == 0) { if (qAlpha(fpoint) == 0) {
//! a line that is not part of the roundness because its first pixel is fully transparent //! a line that is not part of the roundness because its first pixel is fully transparent
break; break;
@ -215,8 +215,8 @@ void PanelBackground::updateRoundnessFromMask(Plasma::Svg *svg)
int c = qMax(0, corner.width() - baseLineLength); int c = qMax(0, corner.width() - baseLineLength);
for (int r = baseRow-1; r>=0; --r) { for (int r = baseRow-1; r>=0; --r) {
QRgb *line = (QRgb *)corner.scanLine(r); QRgba64 *line = (QRgba64 *)corner.scanLine(r);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) != 255) { if (qAlpha(point) != 255) {
tailLimitR = r; tailLimitR = r;
@ -234,11 +234,11 @@ void PanelBackground::updateRoundnessFromMask(Plasma::Svg *svg)
} else { } else {
//! BOTTOMRIGHT CORNER //! BOTTOMRIGHT CORNER
//! it should be TOPRIGHT corner in that case //! it should be TOPRIGHT corner in that case
QRgb *line = (QRgb *)corner.scanLine(baseRow); QRgba64 *line = (QRgba64 *)corner.scanLine(baseRow);
QRgb basePoint = line[baseCol]; QRgba64 basePoint = line[baseCol];
QRgb *isRoundedLine = (QRgb *)corner.scanLine(corner.height()-1); QRgba64 *isRoundedLine = (QRgba64 *)corner.scanLine(corner.height()-1);
QRgb isRoundedPoint = isRoundedLine[corner.width()-1]; QRgba64 isRoundedPoint = isRoundedLine[corner.width()-1];
//! If there is roundness, if that point is not fully transparent then //! If there is roundness, if that point is not fully transparent then
//! there is no roundness //! there is no roundness
@ -247,8 +247,8 @@ void PanelBackground::updateRoundnessFromMask(Plasma::Svg *svg)
if (qAlpha(basePoint) > 0) { if (qAlpha(basePoint) > 0) {
//! calculate the mask baseLine length //! calculate the mask baseLine length
for(int c = baseCol; c<corner.width(); ++c) { for(int c = baseCol; c<corner.width(); ++c) {
QRgb *l = (QRgb *)corner.scanLine(baseRow); QRgba64 *l = (QRgba64 *)corner.scanLine(baseRow);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) > 0) { if (qAlpha(point) > 0) {
baseLineLength ++; baseLineLength ++;
@ -265,8 +265,8 @@ void PanelBackground::updateRoundnessFromMask(Plasma::Svg *svg)
int tailLimitR = 0; int tailLimitR = 0;
for (int r = baseRow+1; r<=corner.height(); ++r) { for (int r = baseRow+1; r<=corner.height(); ++r) {
QRgb *line = (QRgb *)corner.scanLine(r); QRgba64 *line = (QRgba64 *)corner.scanLine(r);
QRgb fpoint = line[baseCol]; QRgba64 fpoint = line[baseCol];
if (qAlpha(fpoint) == 0) { if (qAlpha(fpoint) == 0) {
//! a line that is not part of the roundness because its first pixel is not trasparent //! a line that is not part of the roundness because its first pixel is not trasparent
break; break;
@ -278,8 +278,8 @@ void PanelBackground::updateRoundnessFromMask(Plasma::Svg *svg)
int c = baseLineLength - 1; int c = baseLineLength - 1;
for (int r = baseRow+1; r<=corner.height(); ++r) { for (int r = baseRow+1; r<=corner.height(); ++r) {
QRgb *line = (QRgb *)corner.scanLine(r); QRgba64 *line = (QRgba64 *)corner.scanLine(r);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) != 255) { if (qAlpha(point) != 255) {
tailLimitR = r; tailLimitR = r;
@ -335,8 +335,8 @@ void PanelBackground::updateRoundnessFromShadows(Plasma::Svg *svg)
if (topLeftCorner) { if (topLeftCorner) {
//! TOPLEFT corner //! TOPLEFT corner
QRgb *line = (QRgb *)corner.scanLine(baseRow); QRgba64 *line = (QRgba64 *)corner.scanLine(baseRow);
QRgb basePoint = line[baseCol]; QRgba64 basePoint = line[baseCol];
int baseShadowMaxOpacity = 0; int baseShadowMaxOpacity = 0;
@ -344,8 +344,8 @@ void PanelBackground::updateRoundnessFromShadows(Plasma::Svg *svg)
//! calculate the shadow maxOpacity in the base line //! calculate the shadow maxOpacity in the base line
//! and number of pixels to reach there //! and number of pixels to reach there
for(int c = baseCol; c>=0; --c) { for(int c = baseCol; c>=0; --c) {
QRgb *l = (QRgb *)corner.scanLine(baseRow); QRgba64 *l = (QRgba64 *)corner.scanLine(baseRow);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) > baseShadowMaxOpacity) { if (qAlpha(point) > baseShadowMaxOpacity) {
baseShadowMaxOpacity = qAlpha(point); baseShadowMaxOpacity = qAlpha(point);
@ -358,8 +358,8 @@ void PanelBackground::updateRoundnessFromShadows(Plasma::Svg *svg)
if (baseLineLength>0) { if (baseLineLength>0) {
for (int r = baseRow-1; r>=0; --r) { for (int r = baseRow-1; r>=0; --r) {
QRgb *line = (QRgb *)corner.scanLine(r); QRgba64 *line = (QRgba64 *)corner.scanLine(r);
QRgb fpoint = line[baseCol]; QRgba64 fpoint = line[baseCol];
if (qAlpha(fpoint) != 0) { if (qAlpha(fpoint) != 0) {
//! a line that is not part of the roundness because its first pixel is not trasparent //! a line that is not part of the roundness because its first pixel is not trasparent
break; break;
@ -369,8 +369,8 @@ void PanelBackground::updateRoundnessFromShadows(Plasma::Svg *svg)
int rowMaxOpacity = 0; int rowMaxOpacity = 0;
for(int c = baseCol; c>=0; --c) { for(int c = baseCol; c>=0; --c) {
QRgb *l = (QRgb *)corner.scanLine(r); QRgba64 *l = (QRgba64 *)corner.scanLine(r);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) > rowMaxOpacity) { if (qAlpha(point) > rowMaxOpacity) {
rowMaxOpacity = qAlpha(point); rowMaxOpacity = qAlpha(point);
@ -379,8 +379,8 @@ void PanelBackground::updateRoundnessFromShadows(Plasma::Svg *svg)
} }
for(int c = baseCol; c>=(baseCol - baseLineLength + 1); --c) { for(int c = baseCol; c>=(baseCol - baseLineLength + 1); --c) {
QRgb *l = (QRgb *)corner.scanLine(r); QRgba64 *l = (QRgba64 *)corner.scanLine(r);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) != rowMaxOpacity) { if (qAlpha(point) != rowMaxOpacity) {
transPixels++; transPixels++;
@ -404,16 +404,16 @@ void PanelBackground::updateRoundnessFromShadows(Plasma::Svg *svg)
} else { } else {
//! BOTTOMRIGHT CORNER //! BOTTOMRIGHT CORNER
//! it should be TOPRIGHT corner in that case //! it should be TOPRIGHT corner in that case
QRgb *line = (QRgb *)corner.scanLine(baseRow); QRgba64 *line = (QRgba64 *)corner.scanLine(baseRow);
QRgb basePoint = line[baseCol]; QRgba64 basePoint = line[baseCol];
int baseShadowMaxOpacity = 0; int baseShadowMaxOpacity = 0;
if (qAlpha(basePoint) == 0) { if (qAlpha(basePoint) == 0) {
//! calculate the base line transparent pixels //! calculate the base line transparent pixels
for(int c = baseCol; c<corner.width(); ++c) { for(int c = baseCol; c<corner.width(); ++c) {
QRgb *l = (QRgb *)corner.scanLine(baseRow); QRgba64 *l = (QRgba64 *)corner.scanLine(baseRow);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) > baseShadowMaxOpacity) { if (qAlpha(point) > baseShadowMaxOpacity) {
baseShadowMaxOpacity = qAlpha(point); baseShadowMaxOpacity = qAlpha(point);
@ -426,8 +426,8 @@ void PanelBackground::updateRoundnessFromShadows(Plasma::Svg *svg)
if (baseLineLength>0) { if (baseLineLength>0) {
for (int r = baseRow+1; r<=corner.height(); ++r) { for (int r = baseRow+1; r<=corner.height(); ++r) {
QRgb *line = (QRgb *)corner.scanLine(r); QRgba64 *line = (QRgba64 *)corner.scanLine(r);
QRgb fpoint = line[baseCol]; QRgba64 fpoint = line[baseCol];
if (qAlpha(fpoint) != 0) { if (qAlpha(fpoint) != 0) {
//! a line that is not part of the roundness because its first pixel is not trasparent //! a line that is not part of the roundness because its first pixel is not trasparent
break; break;
@ -437,8 +437,8 @@ void PanelBackground::updateRoundnessFromShadows(Plasma::Svg *svg)
int rowMaxOpacity = 0; int rowMaxOpacity = 0;
for(int c = baseCol; c<corner.width(); ++c) { for(int c = baseCol; c<corner.width(); ++c) {
QRgb *l = (QRgb *)corner.scanLine(r); QRgba64 *l = (QRgba64 *)corner.scanLine(r);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) > rowMaxOpacity) { if (qAlpha(point) > rowMaxOpacity) {
rowMaxOpacity = qAlpha(point); rowMaxOpacity = qAlpha(point);
@ -447,8 +447,8 @@ void PanelBackground::updateRoundnessFromShadows(Plasma::Svg *svg)
} }
for(int c = baseCol; c<baseLineLength; ++c) { for(int c = baseCol; c<baseLineLength; ++c) {
QRgb *l = (QRgb *)corner.scanLine(r); QRgba64 *l = (QRgba64 *)corner.scanLine(r);
QRgb point = line[c]; QRgba64 point = line[c];
if (qAlpha(point) != rowMaxOpacity) { if (qAlpha(point) != rowMaxOpacity) {
transPixels++; transPixels++;
@ -494,10 +494,10 @@ void PanelBackground::updateRoundnessFallback(Plasma::Svg *svg)
if (m_location == Plasma::Types::BottomEdge || m_location == Plasma::Types::RightEdge || m_location == Plasma::Types::TopEdge) { if (m_location == Plasma::Types::BottomEdge || m_location == Plasma::Types::RightEdge || m_location == Plasma::Types::TopEdge) {
//! TOPLEFT corner //! TOPLEFT corner
//! first LEFT pixel found //! first LEFT pixel found
QRgb *line = (QRgb *)corner.scanLine(discovRow); QRgba64 *line = (QRgba64 *)corner.scanLine(discovRow);
for (int col=0; col<corner.width() - 1; ++col) { for (int col=0; col<corner.width() - 1; ++col) {
QRgb pixelData = line[col]; QRgba64 pixelData = line[col];
if (qAlpha(pixelData) < minOpacity) { if (qAlpha(pixelData) < minOpacity) {
discovCol++; discovCol++;
@ -509,9 +509,9 @@ void PanelBackground::updateRoundnessFallback(Plasma::Svg *svg)
} else if (m_location == Plasma::Types::LeftEdge) { } else if (m_location == Plasma::Types::LeftEdge) {
//! it should be TOPRIGHT corner in that case //! it should be TOPRIGHT corner in that case
//! first RIGHT pixel found //! first RIGHT pixel found
QRgb *line = (QRgb *)corner.scanLine(discovRow); QRgba64 *line = (QRgba64 *)corner.scanLine(discovRow);
for (int col=corner.width()-1; col>0; --col) { for (int col=corner.width()-1; col>0; --col) {
QRgb pixelData = line[col]; QRgba64 pixelData = line[col];
if (qAlpha(pixelData) < minOpacity) { if (qAlpha(pixelData) < minOpacity) {
discovCol--; discovCol--;
@ -573,8 +573,8 @@ void PanelBackground::updateShadow(Plasma::Svg *svg)
if (horizontal) { if (horizontal) {
for(int y = 0; y<border.height(); ++y) { for(int y = 0; y<border.height(); ++y) {
QRgb *line = (QRgb *)border.scanLine(y); QRgba64 *line = (QRgba64 *)border.scanLine(y);
QRgb pixel = line[0]; QRgba64 pixel = line[0];
if (qAlpha(pixel) > 0) { if (qAlpha(pixel) > 0) {
if (firstPixel < 0) { if (firstPixel < 0) {
@ -586,9 +586,9 @@ void PanelBackground::updateShadow(Plasma::Svg *svg)
} }
} }
} else { } else {
QRgb *line = (QRgb *)border.scanLine(0); QRgba64 *line = (QRgba64 *)border.scanLine(0);
for(int x = 0; x<border.width(); ++x) { for(int x = 0; x<border.width(); ++x) {
QRgb pixel = line[x]; QRgba64 pixel = line[x];
if (qAlpha(pixel) > 0) { if (qAlpha(pixel) > 0) {
if (firstPixel < 0) { if (firstPixel < 0) {
@ -609,10 +609,10 @@ void PanelBackground::updateShadow(Plasma::Svg *svg)
int maxopacity{0}; int maxopacity{0};
for (int r=0; r<border.height(); ++r) { for (int r=0; r<border.height(); ++r) {
QRgb *line = (QRgb *)border.scanLine(r); QRgba64 *line = (QRgba64 *)border.scanLine(r);
for(int c = 0; c<border.width(); ++c) { for(int c = 0; c<border.width(); ++c) {
QRgb pixel = line[c]; QRgba64 pixel = line[c];
if (qAlpha(pixel) > maxopacity) { if (qAlpha(pixel) > maxopacity) {
maxopacity = qAlpha(pixel); maxopacity = qAlpha(pixel);

Loading…
Cancel
Save