diff options
| author | 2014-07-24 12:39:17 -0700 | |
|---|---|---|
| committer | 2014-07-25 20:56:50 +0000 | |
| commit | a753f4c6cb8558795e673df1896532cd148781e2 (patch) | |
| tree | ec290b59a9cc91bb71402b8643fbc976f95c82d2 /libs/hwui/RenderNode.cpp | |
| parent | 543650bb10b1104dd4ebb81e4a9bbebf9fb4c535 (diff) | |
Move ClipBounds to native
bug:15698973
Also simplifies RenderNode LTRB properties
Change-Id: I09263a697b71d325a46b57cd5250a2b165f251c8
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
| -rw-r--r-- | libs/hwui/RenderNode.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index b77b36f7ae21..01c7761b299d 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -347,31 +347,35 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) { } } const bool isLayer = properties().layerProperties().type() != kLayerTypeNone; - bool clipToBoundsNeeded = isLayer ? false : properties().getClipToBounds(); + int clipFlags = properties().getClippingFlags(); if (properties().getAlpha() < 1) { if (isLayer) { + clipFlags &= ~CLIP_TO_BOUNDS; // bounds clipping done by layer + renderer.setOverrideLayerAlpha(properties().getAlpha()); } else if (!properties().getHasOverlappingRendering()) { renderer.scaleAlpha(properties().getAlpha()); } else { - // TODO: should be able to store the size of a DL at record time and not - // have to pass it into this call. In fact, this information might be in the - // location/size info that we store with the new native transform data. + Rect layerBounds(0, 0, getWidth(), getHeight()); int saveFlags = SkCanvas::kHasAlphaLayer_SaveFlag; - if (clipToBoundsNeeded) { + if (clipFlags) { saveFlags |= SkCanvas::kClipToLayer_SaveFlag; - clipToBoundsNeeded = false; // clipping done by saveLayer + properties().getClippingRectForFlags(clipFlags, &layerBounds); + clipFlags = 0; // all clipping done by saveLayer } SaveLayerOp* op = new (handler.allocator()) SaveLayerOp( - 0, 0, properties().getWidth(), properties().getHeight(), + layerBounds.left, layerBounds.top, layerBounds.right, layerBounds.bottom, properties().getAlpha() * 255, saveFlags); handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); } } - if (clipToBoundsNeeded) { + if (clipFlags) { + Rect clipRect; + properties().getClippingRectForFlags(clipFlags, &clipRect); ClipRectOp* op = new (handler.allocator()) ClipRectOp( - 0, 0, properties().getWidth(), properties().getHeight(), SkRegion::kIntersect_Op); + clipRect.left, clipRect.top, clipRect.right, clipRect.bottom, + SkRegion::kIntersect_Op); handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); } |