diff options
author | Derek Sollenberger <djsollen@google.com> | 2016-11-02 11:34:27 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2016-11-02 11:37:13 -0400 |
commit | f87da67df90968adcddb2404ff20a41fe49a0315 (patch) | |
tree | 39f58352183926b9e5e407633faeacbb81909ef5 /libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp | |
parent | c2f31df8b3b9a237e9abffc59c61804ad8495073 (diff) |
Adding changes required by the master-skia merge.
Test: compile only
Change-Id: I39637a20da439edbf2831952df9bfa12da78e9b9
Diffstat (limited to 'libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp b/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp index 8d77938ad1b9..ac185878b9ca 100644 --- a/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp +++ b/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp @@ -23,7 +23,7 @@ #include <SkBlurMaskFilter.h> #include <SkGaussianEdgeShader.h> #include <SkPathOps.h> -#include <SkRRectsGaussianEdgeShader.h> +#include <SkRRectsGaussianEdgeMaskFilter.h> namespace android { namespace uirenderer { @@ -341,7 +341,7 @@ static void DrawRRectShadows(const SkRect& casterRect, SkScalar casterCornerRadi paint.setAntiAlias(true); // If the area of the stroked geometry is larger than the fill geometry, just fill it. - if (strokedArea > filledArea || casterAlpha < 1.0f) { + if (strokedArea > filledArea || casterAlpha < 1.0f || insetAmount < 0.0f) { paint.setStyle(SkPaint::kStrokeAndFill_Style); paint.setStrokeWidth(srcSpaceSpotRadius); } else { @@ -433,8 +433,8 @@ static void DrawRRectShadowsWithClip(const SkRect& casterRect, SkScalar casterCo SkPaint paint; paint.setColor(SkColorSetARGB((unsigned char) ambientAlpha, 0, 0, 0)); - paint.setShader(SkRRectsGaussianEdgeShader::Make(devSpaceAmbientRRect, - devSpaceAmbientClipRR, devSpaceAmbientRadius)); + paint.setMaskFilter(SkRRectsGaussianEdgeMaskFilter::Make(devSpaceAmbientRRect, + devSpaceAmbientClipRR, devSpaceAmbientRadius)); canvas->drawRect(cover, paint); } @@ -514,8 +514,8 @@ static void DrawRRectShadowsWithClip(const SkRect& casterRect, SkScalar casterCo devSpaceSpotClipRR = SkRRect::MakeRect(devSpaceScaledClipRect); } - paint.setShader(SkRRectsGaussianEdgeShader::Make(devSpaceSpotRRect, devSpaceSpotClipRR, - devSpaceSpotRadius)); + paint.setMaskFilter(SkRRectsGaussianEdgeMaskFilter::Make(devSpaceSpotRRect, + devSpaceSpotClipRR, devSpaceSpotRadius)); SkRect cover = srcSpaceScaledClipRect; if (!cover.intersect(srcSpaceSpotRRect.rect())) { @@ -556,8 +556,8 @@ static bool DrawShadowsAsRRects(const SkRect& casterRect, SkScalar casterCornerR return false; } - // The casterClipRect will contain the casterRect when bounds clipping is disabled - bool casterIsClippedByRect = !casterClipRect.contains(casterRect); + // The casterClipRect will be empty when bounds clipping is disabled + bool casterIsClippedByRect = !casterClipRect.isEmpty(); bool uniformScale = scaleFactors[0] == scaleFactors[1]; if (revealClip.willClip()) { @@ -639,11 +639,15 @@ void EndReorderBarrierDrawable::drawShadow(SkCanvas* canvas, RenderNodeDrawable* bool clippedToBounds = casterProperties.getClippingFlags() & CLIP_TO_CLIP_BOUNDS; - SkRect casterClipRect = SkRect::MakeLargest(); + SkRect casterClipRect = SkRect::MakeEmpty(); if (clippedToBounds) { Rect clipBounds; casterProperties.getClippingRectForFlags(CLIP_TO_CLIP_BOUNDS, &clipBounds); casterClipRect = clipBounds.toSkRect(); + if (casterClipRect.isEmpty()) { + // An empty clip rect means nothing is drawn + return; + } } SkAutoCanvasRestore acr(canvas, true); |