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

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

Fix rendering bug with saveLayerAlpha/drawColor.

drawColor() was not calling quickReject because it fills the clip region
and thus always passes the test. However, quickReject also checks whether
the current layer is invisible. drawColor() now performs the same check
and avoid drawing inside an invisible layer.

Change-Id: I63d0e9a8a9c0fba774f0f5c3870d58e6ed96fbd1
parent 5ec9924d
Loading
Loading
Loading
Loading
+19 −17
Original line number Diff line number Diff line
@@ -260,6 +260,7 @@ int OpenGLRenderer::saveLayer(float left, float top, float right, float bottom,
    const GLuint previousFbo = mSnapshot->fbo;
    const int count = saveSnapshot(flags);

    if (!mSnapshot->invisible) {
        int alpha = 255;
        SkXfermode::Mode mode;

@@ -278,7 +279,6 @@ int OpenGLRenderer::saveLayer(float left, float top, float right, float bottom,
            mode = SkXfermode::kSrcOver_Mode;
        }

    if (!mSnapshot->previous->invisible) {
        createLayer(mSnapshot, left, top, right, bottom, alpha, mode, flags, previousFbo);
    }

@@ -379,8 +379,7 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
            bounds.getHeight() > mCaches.maxTextureSize) {
        snapshot->invisible = true;
    } else {
        snapshot->invisible = snapshot->previous->invisible ||
                (alpha <= ALPHA_THRESHOLD && fboLayer);
        snapshot->invisible = snapshot->invisible || (alpha <= ALPHA_THRESHOLD && fboLayer);
    }

    // Bail out if we won't draw in this snapshot
@@ -1011,6 +1010,9 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
}

void OpenGLRenderer::drawColor(int color, SkXfermode::Mode mode) {
    // No need to check against the clip, we fill the clip region
    if (mSnapshot->invisible) return;

    Rect& clip(*mSnapshot->clipRect);
    clip.snapToPixelBoundaries();
    drawColorRect(clip.left, clip.top, clip.right, clip.bottom, color, mode, true);