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

Commit ab3f8c2e authored by sergeyv's avatar sergeyv Committed by Sergei Vasilinetc
Browse files

HWUI: do not call glCopyTexSubImage2D on empty area.

Previous check .isEmpty() is not sufficient, because getWidth() may have
value 0.5, so technically it is not empty, but when this size is passed
to texture calls it is converted to uint_32 and it becomes zero.

bug:28941093
Change-Id: Ia7c2bf0340466d5376f235fb5da54ad2ddfa0a03
parent 760b5571
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -96,15 +96,15 @@ void BakedOpRenderer::endLayer() {
}

OffscreenBuffer* BakedOpRenderer::copyToLayer(const Rect& area) {
    OffscreenBuffer* buffer = mRenderState.layerPool().get(mRenderState,
            area.getWidth(), area.getHeight());
    if (!area.isEmpty()) {
    const uint32_t width = area.getWidth();
    const uint32_t height = area.getHeight();
    OffscreenBuffer* buffer = mRenderState.layerPool().get(mRenderState, width, height);
    if (!area.isEmpty() && width != 0 && height != 0) {
        mCaches.textureState().activateTexture(0);
        mCaches.textureState().bindTexture(buffer->texture.id());

        glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
                area.left, mRenderTarget.viewportHeight - area.bottom,
                area.getWidth(), area.getHeight());
                area.left, mRenderTarget.viewportHeight - area.bottom, width, height);
    }
    return buffer;
}