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

Commit 772687d2 authored by Chris Craik's avatar Chris Craik
Browse files

Avoid flushing DisplayListCanvas state for noop calls

bug:22006795

Change-Id: I2eceee69772b08f5319ea882be429a5b36860b7d
parent bcca4ac4
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -135,6 +135,8 @@ int DisplayListCanvas::saveLayer(float left, float top, float right, float botto
}
}


void DisplayListCanvas::translate(float dx, float dy) {
void DisplayListCanvas::translate(float dx, float dy) {
    if (dx == 0.0f && dy == 0.0f) return;

    mHasDeferredTranslate = true;
    mHasDeferredTranslate = true;
    mTranslateX += dx;
    mTranslateX += dx;
    mTranslateY += dy;
    mTranslateY += dy;
@@ -143,11 +145,15 @@ void DisplayListCanvas::translate(float dx, float dy) {
}
}


void DisplayListCanvas::rotate(float degrees) {
void DisplayListCanvas::rotate(float degrees) {
    if (degrees == 0.0f) return;

    addStateOp(new (alloc()) RotateOp(degrees));
    addStateOp(new (alloc()) RotateOp(degrees));
    mState.rotate(degrees);
    mState.rotate(degrees);
}
}


void DisplayListCanvas::scale(float sx, float sy) {
void DisplayListCanvas::scale(float sx, float sy) {
    if (sx == 1.0f && sy == 1.0f) return;

    addStateOp(new (alloc()) ScaleOp(sx, sy));
    addStateOp(new (alloc()) ScaleOp(sx, sy));
    mState.scale(sx, sy);
    mState.scale(sx, sy);
}
}