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

Commit 6afb474a authored by Chia-I Wu's avatar Chia-I Wu Committed by Android (Google) Code Review
Browse files

Merge "surfaceflinger: fix fillRegionWithColor"

parents 4d4aec5a 28e3a251
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -539,25 +539,25 @@ void GLES20RenderEngine::clearWithColor(float red, float green, float blue, floa
    glClear(GL_COLOR_BUFFER_BIT);
}

void GLES20RenderEngine::fillRegionWithColor(const Region& region, uint32_t height, float red,
                                             float green, float blue, float alpha) {
void GLES20RenderEngine::fillRegionWithColor(const Region& region, float red, float green,
                                             float blue, float alpha) {
    size_t c;
    Rect const* r = region.getArray(&c);
    Mesh mesh(Mesh::TRIANGLES, c * 6, 2);
    Mesh::VertexArray<vec2> position(mesh.getPositionArray<vec2>());
    for (size_t i = 0; i < c; i++, r++) {
        position[i * 6 + 0].x = r->left;
        position[i * 6 + 0].y = height - r->top;
        position[i * 6 + 0].y = r->top;
        position[i * 6 + 1].x = r->left;
        position[i * 6 + 1].y = height - r->bottom;
        position[i * 6 + 1].y = r->bottom;
        position[i * 6 + 2].x = r->right;
        position[i * 6 + 2].y = height - r->bottom;
        position[i * 6 + 2].y = r->bottom;
        position[i * 6 + 3].x = r->left;
        position[i * 6 + 3].y = height - r->top;
        position[i * 6 + 3].y = r->top;
        position[i * 6 + 4].x = r->right;
        position[i * 6 + 4].y = height - r->bottom;
        position[i * 6 + 4].y = r->bottom;
        position[i * 6 + 5].x = r->right;
        position[i * 6 + 5].y = height - r->top;
        position[i * 6 + 5].y = r->top;
    }
    setupFillWithColor(red, green, blue, alpha);
    drawMesh(mesh);
+2 −2
Original line number Diff line number Diff line
@@ -62,8 +62,8 @@ public:
    bool finish() override;
    bool waitFence(base::unique_fd fenceFd) override;
    void clearWithColor(float red, float green, float blue, float alpha) override;
    void fillRegionWithColor(const Region& region, uint32_t height, float red, float green,
                             float blue, float alpha) override;
    void fillRegionWithColor(const Region& region, float red, float green, float blue,
                             float alpha) override;
    void setScissor(uint32_t left, uint32_t bottom, uint32_t right, uint32_t top) override;
    void disableScissor() override;
    void genTextures(size_t count, uint32_t* names) override;
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ public:
    virtual bool waitFence(base::unique_fd fenceFd) = 0;

    virtual void clearWithColor(float red, float green, float blue, float alpha) = 0;
    virtual void fillRegionWithColor(const Region& region, uint32_t height, float red, float green,
    virtual void fillRegionWithColor(const Region& region, float red, float green,
                                     float blue, float alpha) = 0;

    virtual void setScissor(uint32_t left, uint32_t bottom, uint32_t right, uint32_t top) = 0;
+4 −7
Original line number Diff line number Diff line
@@ -1688,9 +1688,8 @@ void SurfaceFlinger::doDebugFlashRegions(const sp<DisplayDevice>& display, bool
            doComposeSurfaces(display);

            // and draw the dirty region
            const int32_t height = display->getHeight();
            auto& engine(getRenderEngine());
            engine.fillRegionWithColor(dirtyRegion, height, 1, 0, 1, 1);
            engine.fillRegionWithColor(dirtyRegion, 1, 0, 1, 1);

            display->swapBuffers(getHwComposer());
        }
@@ -3194,7 +3193,7 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& display) {
            // screen is already cleared here
            if (!region.isEmpty()) {
                // can happen with SurfaceView
                drawWormhole(display, region);
                drawWormhole(region);
            }
        }

@@ -3263,11 +3262,9 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& display) {
    return true;
}

void SurfaceFlinger::drawWormhole(const sp<const DisplayDevice>& display,
                                  const Region& region) const {
    const int32_t height = display->getHeight();
void SurfaceFlinger::drawWormhole(const Region& region) const {
    auto& engine(getRenderEngine());
    engine.fillRegionWithColor(region, height, 0, 0, 0, 0);
    engine.fillRegionWithColor(region, 0, 0, 0, 0);
}

status_t SurfaceFlinger::addClientLayer(const sp<Client>& client,
+1 −1
Original line number Diff line number Diff line
@@ -710,7 +710,7 @@ private:

    void postFramebuffer(const sp<DisplayDevice>& display);
    void postFrame();
    void drawWormhole(const sp<const DisplayDevice>& display, const Region& region) const;
    void drawWormhole(const Region& region) const;

    /* ------------------------------------------------------------------------
     * Display management
Loading