mirror of
https://codeberg.org/tenacityteam/tenacity
synced 2025-09-28 17:26:23 +02:00
Fix #8442: incorrect rendering if the waveform is clipping
(cherry picked from commit 6105681cf65fa7fbe6be60bb86886c15855d9b07)
This commit is contained in:
committed by
Avery King
parent
2d5ca26640
commit
acb3a6b16e
@@ -62,8 +62,8 @@ struct Triplet final
|
|||||||
struct Band final
|
struct Band final
|
||||||
{
|
{
|
||||||
Triplet color;
|
Triplet color;
|
||||||
uint32_t from;
|
int from;
|
||||||
uint32_t to;
|
int to;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ColorFunction final
|
struct ColorFunction final
|
||||||
@@ -71,7 +71,7 @@ struct ColorFunction final
|
|||||||
std::array<Band, ColorFunctionBands> bands;
|
std::array<Band, ColorFunctionBands> bands;
|
||||||
size_t bandsCount { 0 };
|
size_t bandsCount { 0 };
|
||||||
|
|
||||||
Triplet GetColor(uint32_t row, Triplet defaultColor) const noexcept
|
Triplet GetColor(int row, Triplet defaultColor) const noexcept
|
||||||
{
|
{
|
||||||
// Later bands are the topmost
|
// Later bands are the topmost
|
||||||
for (size_t i = bandsCount; i > 0; --i)
|
for (size_t i = bandsCount; i > 0; --i)
|
||||||
@@ -83,7 +83,7 @@ struct ColorFunction final
|
|||||||
return defaultColor;
|
return defaultColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBand(graphics::Color color, uint32_t from, uint32_t to)
|
void AddBand(graphics::Color color, int from, int to)
|
||||||
{
|
{
|
||||||
assert(bandsCount < bands.size());
|
assert(bandsCount < bands.size());
|
||||||
assert(from <= to);
|
assert(from <= to);
|
||||||
@@ -227,8 +227,8 @@ struct WaveBitmapCache::LookupHelper final
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto maxSampleRow = std::clamp(GetRowFromValue(columnData.max), globalMaxRow, globalMinRow);
|
const auto maxSampleRow = GetRowFromValue(columnData.max);
|
||||||
const auto minSampleRow = std::clamp(GetRowFromValue(columnData.min), globalMaxRow, globalMinRow);
|
const auto minSampleRow = GetRowFromValue(columnData.min);
|
||||||
|
|
||||||
function.AddBand(selected ? backgroundColors.Selected : backgroundColors.Normal, globalMaxRow, globalMinRow);
|
function.AddBand(selected ? backgroundColors.Selected : backgroundColors.Normal, globalMaxRow, globalMinRow);
|
||||||
|
|
||||||
@@ -375,11 +375,11 @@ bool WaveBitmapCache::InitializeElement(
|
|||||||
|
|
||||||
const auto defaultColor = Triplet(mPaintParameters.BlankColor);
|
const auto defaultColor = Triplet(mPaintParameters.BlankColor);
|
||||||
|
|
||||||
const auto height = static_cast<uint32_t>(mPaintParameters.Height);
|
const auto height = static_cast<int>(mPaintParameters.Height);
|
||||||
|
|
||||||
auto rowData = element.Allocate(columnsCount, height);
|
auto rowData = element.Allocate(columnsCount, height);
|
||||||
|
|
||||||
for (uint32_t row = 0; row < height; ++row)
|
for (int row = 0; row < height; ++row)
|
||||||
{
|
{
|
||||||
auto colorFunction = mLookupHelper->ColorFunctions.data();
|
auto colorFunction = mLookupHelper->ColorFunctions.data();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user