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

Commit 86c40b50 authored by Derek Sollenberger's avatar Derek Sollenberger Committed by android-build-merger
Browse files

Merge "Don't crash when presented with non-roundRect clipping outline." into oc-dev

am: 2b81530b

Change-Id: I9da0d02131eefdb38b6025d4cdc6fb27ab3c82f2
parents d9a707e5 2b81530b
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -61,8 +61,17 @@ void RenderNodeDrawable::drawBackwardsProjectedNodes(SkCanvas* canvas, const Ski
static void clipOutline(const Outline& outline, SkCanvas* canvas, const SkRect* pendingClip) {
    Rect possibleRect;
    float radius;
    LOG_ALWAYS_FATAL_IF(!outline.getAsRoundRect(&possibleRect, &radius),
            "clipping outlines should be at most roundedRects");

    /* To match the existing HWUI behavior we only supports rectangles or
     * rounded rectangles; passing in a more complicated outline fails silently.
     */
    if (!outline.getAsRoundRect(&possibleRect, &radius)) {
        if (pendingClip) {
            canvas->clipRect(*pendingClip);
        }
        return;
    }

    SkRect rect = possibleRect.toSkRect();
    if (radius != 0.0f) {
        if (pendingClip && !pendingClip->contains(rect)) {