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

Commit f4123fd9 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Gradient drawable bounds

Checking if setScreenSize was called before drawing or building
paints. This will keep us from making mistakes in the future.

Test: manual
Change-Id: I380f109e3bb3f75b9bc545de012fa857d13af3de
parent b2d50b4f
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -157,7 +157,10 @@ public class GradientDrawable extends Drawable {
    }

    private void buildPaints() {
        final Rect bounds = mWindowBounds;
        Rect bounds = mWindowBounds;
        if (bounds.width() == 0) {
            return;
        }

        float w = bounds.width();
        float h = bounds.height();
@@ -177,7 +180,10 @@ public class GradientDrawable extends Drawable {

    @Override
    public void draw(@NonNull Canvas canvas) {
        final Rect bounds = mWindowBounds;
        Rect bounds = mWindowBounds;
        if (bounds.width() == 0) {
            throw new IllegalStateException("You need to call setScreenSize before drawing.");
        }

        // Splat each gradient
        float w = bounds.width();