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

Commit 054dc184 authored by Romain Guy's avatar Romain Guy
Browse files

Don't draw entirely transparent 9patch meshes.

Change-Id: If3e62e18b8e0dbde8a22f8ede2889b86500a4dc2
parent 9d13fe25
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -724,12 +724,14 @@ void OpenGLRenderer::drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int
    const Patch* mesh = mCaches.patchCache.get(bitmap->width(), bitmap->height(),
            right - left, bottom - top, xDivs, yDivs, colors, width, height, numColors);

    if (mesh) {
        // Specify right and bottom as +1.0f from left/top to prevent scaling since the
        // patch mesh already defines the final size
        drawTextureMesh(left, top, left + 1.0f, top + 1.0f, texture->id, alpha / 255.0f,
                mode, texture->blend, &mesh->vertices[0].position[0],
                &mesh->vertices[0].texture[0], GL_TRIANGLES, mesh->verticesCount);
    }
}

void OpenGLRenderer::drawLines(float* points, int count, const SkPaint* paint) {
    if (mSnapshot->invisible) return;
+5 −0
Original line number Diff line number Diff line
@@ -67,6 +67,11 @@ Patch* PatchCache::get(const float bitmapWidth, const float bitmapHeight,
        }
    }

    // If the 9patch is made of only transparent quads
    if (transparentQuads == (width + 1) * (height + 1)) {
        return NULL;
    }

    const PatchDescription description(bitmapWidth, bitmapHeight,
            pixelWidth, pixelHeight, width, height, transparentQuads, colorKey);

+2 −2

File changed.

Contains only whitespace changes.