1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-06 21:18:11 +03:00

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

This reverts commit 6497da4a4d.
This commit is contained in:
Michail Vourlakos 2021-12-14 20:01:53 +02:00
parent 45db72b5db
commit c15a97bacf

View File

@ -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) {
QRgba64 *line = (QRgba64 *)center.scanLine(row); QRgb *line = (QRgb *)center.scanLine(row);
for (int col=0; col<CENTERWIDTH; ++col) { for (int col=0; col<CENTERWIDTH; ++col) {
QRgba64 pixelData = line[col]; QRgb 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
QRgba64 *line = (QRgba64 *)corner.scanLine(baseRow); QRgb *line = (QRgb *)corner.scanLine(baseRow);
QRgba64 basePoint = line[baseCol]; QRgb basePoint = line[baseCol];
QRgba64 *isRoundedLine = (QRgba64 *)corner.scanLine(0); QRgb *isRoundedLine = (QRgb *)corner.scanLine(0);
QRgba64 isRoundedPoint = isRoundedLine[0]; QRgb 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) {
QRgba64 *l = (QRgba64 *)corner.scanLine(baseRow); QRgb *l = (QRgb *)corner.scanLine(baseRow);
QRgba64 point = line[c]; QRgb 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) {
QRgba64 *line = (QRgba64 *)corner.scanLine(r); QRgb *line = (QRgb *)corner.scanLine(r);
QRgba64 fpoint = line[baseCol]; QRgb 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) {
QRgba64 *line = (QRgba64 *)corner.scanLine(r); QRgb *line = (QRgb *)corner.scanLine(r);
QRgba64 point = line[c]; QRgb 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
QRgba64 *line = (QRgba64 *)corner.scanLine(baseRow); QRgb *line = (QRgb *)corner.scanLine(baseRow);
QRgba64 basePoint = line[baseCol]; QRgb basePoint = line[baseCol];
QRgba64 *isRoundedLine = (QRgba64 *)corner.scanLine(corner.height()-1); QRgb *isRoundedLine = (QRgb *)corner.scanLine(corner.height()-1);
QRgba64 isRoundedPoint = isRoundedLine[corner.width()-1]; QRgb 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) {
QRgba64 *l = (QRgba64 *)corner.scanLine(baseRow); QRgb *l = (QRgb *)corner.scanLine(baseRow);
QRgba64 point = line[c]; QRgb 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) {
QRgba64 *line = (QRgba64 *)corner.scanLine(r); QRgb *line = (QRgb *)corner.scanLine(r);
QRgba64 fpoint = line[baseCol]; QRgb 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) {
QRgba64 *line = (QRgba64 *)corner.scanLine(r); QRgb *line = (QRgb *)corner.scanLine(r);
QRgba64 point = line[c]; QRgb 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
QRgba64 *line = (QRgba64 *)corner.scanLine(baseRow); QRgb *line = (QRgb *)corner.scanLine(baseRow);
QRgba64 basePoint = line[baseCol]; QRgb 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) {
QRgba64 *l = (QRgba64 *)corner.scanLine(baseRow); QRgb *l = (QRgb *)corner.scanLine(baseRow);
QRgba64 point = line[c]; QRgb 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) {
QRgba64 *line = (QRgba64 *)corner.scanLine(r); QRgb *line = (QRgb *)corner.scanLine(r);
QRgba64 fpoint = line[baseCol]; QRgb 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) {
QRgba64 *l = (QRgba64 *)corner.scanLine(r); QRgb *l = (QRgb *)corner.scanLine(r);
QRgba64 point = line[c]; QRgb 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) {
QRgba64 *l = (QRgba64 *)corner.scanLine(r); QRgb *l = (QRgb *)corner.scanLine(r);
QRgba64 point = line[c]; QRgb 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
QRgba64 *line = (QRgba64 *)corner.scanLine(baseRow); QRgb *line = (QRgb *)corner.scanLine(baseRow);
QRgba64 basePoint = line[baseCol]; QRgb 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) {
QRgba64 *l = (QRgba64 *)corner.scanLine(baseRow); QRgb *l = (QRgb *)corner.scanLine(baseRow);
QRgba64 point = line[c]; QRgb 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) {
QRgba64 *line = (QRgba64 *)corner.scanLine(r); QRgb *line = (QRgb *)corner.scanLine(r);
QRgba64 fpoint = line[baseCol]; QRgb 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) {
QRgba64 *l = (QRgba64 *)corner.scanLine(r); QRgb *l = (QRgb *)corner.scanLine(r);
QRgba64 point = line[c]; QRgb 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) {
QRgba64 *l = (QRgba64 *)corner.scanLine(r); QRgb *l = (QRgb *)corner.scanLine(r);
QRgba64 point = line[c]; QRgb 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
QRgba64 *line = (QRgba64 *)corner.scanLine(discovRow); QRgb *line = (QRgb *)corner.scanLine(discovRow);
for (int col=0; col<corner.width() - 1; ++col) { for (int col=0; col<corner.width() - 1; ++col) {
QRgba64 pixelData = line[col]; QRgb 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
QRgba64 *line = (QRgba64 *)corner.scanLine(discovRow); QRgb *line = (QRgb *)corner.scanLine(discovRow);
for (int col=corner.width()-1; col>0; --col) { for (int col=corner.width()-1; col>0; --col) {
QRgba64 pixelData = line[col]; QRgb 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) {
QRgba64 *line = (QRgba64 *)border.scanLine(y); QRgb *line = (QRgb *)border.scanLine(y);
QRgba64 pixel = line[0]; QRgb 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 {
QRgba64 *line = (QRgba64 *)border.scanLine(0); QRgb *line = (QRgb *)border.scanLine(0);
for(int x = 0; x<border.width(); ++x) { for(int x = 0; x<border.width(); ++x) {
QRgba64 pixel = line[x]; QRgb 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) {
QRgba64 *line = (QRgba64 *)border.scanLine(r); QRgb *line = (QRgb *)border.scanLine(r);
for(int c = 0; c<border.width(); ++c) { for(int c = 0; c<border.width(); ++c) {
QRgba64 pixel = line[c]; QRgb pixel = line[c];
if (qAlpha(pixel) > maxopacity) { if (qAlpha(pixel) > maxopacity) {
maxopacity = qAlpha(pixel); maxopacity = qAlpha(pixel);