Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95aeff8f authored by Romain Guy's avatar Romain Guy
Browse files

Properly computer gradient textures width

Only on devices that do not have the npot extension

Change-Id: I472a13dc707d2abaf5fcc06f99c9da343b333558
parent e203384f
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -148,8 +148,11 @@ void GradientCache::getGradientInfo(const uint32_t* colors, const int count,
        GradientInfo& info) {
    uint32_t width = 256 * (count - 1);

    if (!mHasNpot) {
        width = 1 << (31 - __builtin_clz(width));
    // If the npot extension is not supported we cannot use non-clamp
    // wrap modes. We therefore find the nearest largest power of 2
    // unless width is already a power of 2
    if (!mHasNpot && (width & (width - 1)) != 0) {
        width = 1 << (32 - __builtin_clz(width));
    }

    bool hasAlpha = false;