From 8ecf41c61a5185207a21d64681e8ebc2502b7b2a Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Mon, 16 Nov 2015 10:27:59 -0800 Subject: Add temporary layer alpha fallback to OpReorderer Also adds logic to clip temporary layers to viewport both for efficiency and to allow large ones (such as the fallback case) to fit in max texture size. Change-Id: Iee51495220f5ca1dc7e6f5fd3615db2e896efd74 --- libs/hwui/RenderNode.cpp | 70 ------------------------------------------------ 1 file changed, 70 deletions(-) (limited to 'libs/hwui/RenderNode.cpp') diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 2713f46ab33b..716d5360c25c 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -524,76 +524,6 @@ void RenderNode::decParentRefCount() { } } -bool RenderNode::applyViewProperties(CanvasState& canvasState, LinearAllocator& allocator) const { - const Outline& outline = properties().getOutline(); - if (properties().getAlpha() <= 0 - || (outline.getShouldClip() && outline.isEmpty()) - || properties().getScaleX() == 0 - || properties().getScaleY() == 0) { - return false; // rejected - } - - if (properties().getLeft() != 0 || properties().getTop() != 0) { - canvasState.translate(properties().getLeft(), properties().getTop()); - } - if (properties().getStaticMatrix()) { - canvasState.concatMatrix(*properties().getStaticMatrix()); - } else if (properties().getAnimationMatrix()) { - canvasState.concatMatrix(*properties().getAnimationMatrix()); - } - if (properties().hasTransformMatrix()) { - if (properties().isTransformTranslateOnly()) { - canvasState.translate(properties().getTranslationX(), properties().getTranslationY()); - } else { - canvasState.concatMatrix(*properties().getTransformMatrix()); - } - } - - const bool isLayer = properties().effectiveLayerType() != LayerType::None; - int clipFlags = properties().getClippingFlags(); - if (properties().getAlpha() < 1) { - if (isLayer) { - clipFlags &= ~CLIP_TO_BOUNDS; // bounds clipping done by layer - } - if (CC_LIKELY(isLayer || !properties().getHasOverlappingRendering())) { - // simply scale rendering content's alpha - canvasState.scaleAlpha(properties().getAlpha()); - } else { - // savelayer needed to create an offscreen buffer - Rect layerBounds(0, 0, getWidth(), getHeight()); - if (clipFlags) { - properties().getClippingRectForFlags(clipFlags, &layerBounds); - clipFlags = 0; // all clipping done by savelayer - } - LOG_ALWAYS_FATAL("TODO: savelayer"); - } - - if (CC_UNLIKELY(ATRACE_ENABLED() && properties().promotedToLayer())) { - // pretend alpha always causes savelayer to warn about - // performance problem affecting old versions - ATRACE_FORMAT("%s alpha caused saveLayer %dx%d", getName(), getWidth(), getHeight()); - } - } - if (clipFlags) { - Rect clipRect; - properties().getClippingRectForFlags(clipFlags, &clipRect); - canvasState.clipRect(clipRect.left, clipRect.top, clipRect.right, clipRect.bottom, - SkRegion::kIntersect_Op); - } - - // TODO: support nesting round rect clips - if (mProperties.getRevealClip().willClip()) { - Rect bounds; - mProperties.getRevealClip().getBounds(&bounds); - canvasState.setClippingRoundRect(allocator, - bounds, mProperties.getRevealClip().getRadius()); - } else if (mProperties.getOutline().willClip()) { - canvasState.setClippingOutline(allocator, &(mProperties.getOutline())); - } - return !canvasState.quickRejectConservative( - 0, 0, properties().getWidth(), properties().getHeight()); -} - /* * For property operations, we pass a savecount of 0, since the operations aren't part of the * displaylist, and thus don't have to compensate for the record-time/playback-time discrepancy in -- cgit v1.2.3-59-g8ed1b