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

Commit 0e26fc47 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Simplify DeferredDisplayList construction"

parents e090a1e0 b45c6aa6
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -44,6 +44,12 @@ namespace uirenderer {
#define DEBUG_COLOR_MERGEDBATCH      0x5f7f7fff
#define DEBUG_COLOR_MERGEDBATCH_SOLO 0x5f7fff7f

static bool avoidOverdraw() {
    // Don't avoid overdraw when visualizing it, since that makes it harder to
    // debug where it's coming from, and when the problem occurs.
    return !Properties::debugOverdraw;
};

/////////////////////////////////////////////////////////////////////////////////
// Operation Batches
/////////////////////////////////////////////////////////////////////////////////
@@ -495,7 +501,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) {
            && mSaveStack.empty()
            && !state->mRoundRectClipState;

    if (CC_LIKELY(mAvoidOverdraw) && mBatches.size() &&
    if (CC_LIKELY(avoidOverdraw()) && mBatches.size() &&
            state->mClipSideFlags != kClipSide_ConservativeFull &&
            deferInfo.opaqueOverBounds && state->mBounds.contains(mBounds)) {
        // avoid overdraw by resetting drawing state + discarding drawing ops
@@ -647,7 +653,7 @@ void DeferredDisplayList::flush(OpenGLRenderer& renderer, Rect& dirty) {
    // save and restore so that reordering doesn't affect final state
    renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);

    if (CC_LIKELY(mAvoidOverdraw)) {
    if (CC_LIKELY(avoidOverdraw())) {
        for (unsigned int i = 1; i < mBatches.size(); i++) {
            if (mBatches[i] && mBatches[i]->coversBounds(mBounds)) {
                discardDrawingBatches(i - 1);
+2 −3
Original line number Diff line number Diff line
@@ -83,8 +83,8 @@ public:
class DeferredDisplayList {
    friend struct DeferStateStruct; // used to give access to allocator
public:
    DeferredDisplayList(const Rect& bounds, bool avoidOverdraw = true) :
            mBounds(bounds), mAvoidOverdraw(avoidOverdraw) {
    DeferredDisplayList(const Rect& bounds)
            : mBounds(bounds) {
        clear();
    }
    ~DeferredDisplayList() { clear(); }
@@ -152,7 +152,6 @@ private:

    // layer space bounds of rendering
    Rect mBounds;
    const bool mAvoidOverdraw;

    /**
     * At defer time, stores the *defer time* savecount of save/saveLayer ops that were deferred, so
+1 −4
Original line number Diff line number Diff line
@@ -1431,10 +1431,7 @@ void OpenGLRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t
            return;
        }

        // Don't avoid overdraw when visualizing, since that makes it harder to
        // debug where it's coming from, and when the problem occurs.
        bool avoidOverdraw = !Properties::debugOverdraw;
        DeferredDisplayList deferredList(mState.currentClipRect(), avoidOverdraw);
        DeferredDisplayList deferredList(mState.currentClipRect());
        DeferStateStruct deferStruct(deferredList, *this, replayFlags);
        renderNode->defer(deferStruct, 0);