diff options
author | Derek Sollenberger <djsollen@google.com> | 2017-05-26 12:11:34 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2017-05-26 12:11:34 -0400 |
commit | f209c06d36021a8d049ba0528bbe62254a233636 (patch) | |
tree | ca8390bcbe6a0d760d795272cfa714942af539a5 /libs/hwui/pipeline/skia/RenderNodeDrawable.cpp | |
parent | 70739fb812e2acb9880c008941015a467fca2001 (diff) |
Don't crash when presented with non-roundRect clipping outline.
We still won't clip to the outline to match existing HWUI behavior.
Test: CTS Graphics and hwui_unit_tests pass
Bug: 38411077
Change-Id: Ia3161df77a4ccaf0e714d2fe1ac12396d1c8f9e9
Diffstat (limited to 'libs/hwui/pipeline/skia/RenderNodeDrawable.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/RenderNodeDrawable.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp index 39f11b8e6bfe..4ee47afe87fd 100644 --- a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp +++ b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp @@ -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)) { |