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

Commit bd41a110 authored by Romain Guy's avatar Romain Guy
Browse files

Correctly index transparent quads when generating 9patch meshes.

Bug #3250026

Change-Id: Id7e051e9ed81f6b4e7748756503d8055ac7d531a
parent 5e3af5fc
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@ Patch::Patch(const uint32_t xCount, const uint32_t yCount, const int8_t emptyQua
    mXDivs = new int32_t[mXCount];
    mYDivs = new int32_t[mYCount];

    PATCH_LOGD("    patch: xCount = %d, yCount = %d, emptyQuads = %d, vertices = %d",
            xCount, yCount, emptyQuads, verticesCount);

    glGenBuffers(1, &meshBuffer);
}

@@ -208,7 +211,15 @@ void Patch::generateRow(TextureVertex*& vertex, float y1, float y2, float v1, fl

void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2,
            float u1, float v1, float u2, float v2, uint32_t& quadCount) {
    if (((mColorKey >> quadCount++) & 0x1) == 1) {
    uint32_t oldQuadCount = quadCount;

    // Degenerate quads are an artifact of our implementation and should not
    // be taken into account when checking for transparent quads
    if (x2 - x1 > 0.999f && y2 - y1 > 0.999f) {
        quadCount++;
    }

    if (((mColorKey >> oldQuadCount) & 0x1) == 1) {
        return;
    }