diff options
-rw-r--r-- | libs/hwui/DeferredDisplayList.cpp | 4 | ||||
-rw-r--r-- | libs/hwui/DeferredDisplayList.h | 1 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 19 | ||||
-rwxr-xr-x | libs/hwui/OpenGLRenderer.h | 26 | ||||
-rw-r--r-- | libs/hwui/RenderNode.cpp | 8 | ||||
-rw-r--r-- | libs/hwui/RenderProperties.cpp | 8 |
6 files changed, 10 insertions, 56 deletions
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp index c78971a..dd6af03 100644 --- a/libs/hwui/DeferredDisplayList.cpp +++ b/libs/hwui/DeferredDisplayList.cpp @@ -638,8 +638,7 @@ void DeferredDisplayList::flush(OpenGLRenderer& renderer, Rect& dirty) { DEFER_LOGD("--flushing"); renderer.eventMark("Flush"); - // save and restore (with draw modifiers) so that reordering doesn't affect final state - DrawModifiers restoreDrawModifiers = renderer.getDrawModifiers(); + // save and restore so that reordering doesn't affect final state renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); if (CC_LIKELY(mAvoidOverdraw)) { @@ -654,7 +653,6 @@ void DeferredDisplayList::flush(OpenGLRenderer& renderer, Rect& dirty) { replayBatchList(mBatches, renderer, dirty); renderer.restoreToCount(1); - renderer.setDrawModifiers(restoreDrawModifiers); DEFER_LOGD("--flush complete, returning %x", status); clear(); diff --git a/libs/hwui/DeferredDisplayList.h b/libs/hwui/DeferredDisplayList.h index f535afb..3d0ca6d 100644 --- a/libs/hwui/DeferredDisplayList.h +++ b/libs/hwui/DeferredDisplayList.h @@ -61,7 +61,6 @@ public: int mClipSideFlags; // specifies which sides of the bounds are clipped, unclipped if cleared bool mClipped; mat4 mMatrix; - DrawModifiers mDrawModifiers; float mAlpha; const RoundRectClipState* mRoundRectClipState; }; diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 30935d5..f735fb5 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -76,9 +76,6 @@ OpenGLRenderer::OpenGLRenderer(RenderState& renderState) , mLightRadius(FLT_MIN) , mAmbientShadowAlpha(0) , mSpotShadowAlpha(0) { - // *set* draw modifiers to be 0 - memset(&mDrawModifiers, 0, sizeof(mDrawModifiers)); - mDrawModifiers.mOverrideLayerAlpha = 1.0f; } OpenGLRenderer::~OpenGLRenderer() { @@ -1188,10 +1185,9 @@ bool OpenGLRenderer::storeDisplayState(DeferredDisplayState& state, int stateDef state.mClip.set(currentClip); } - // Transform, drawModifiers, and alpha always deferred, since they are used by state operations + // Transform and alpha always deferred, since they are used by state operations // (Note: saveLayer/restore use colorFilter and alpha, so we just save restore everything) state.mMatrix.load(*currentMatrix); - state.mDrawModifiers = mDrawModifiers; state.mAlpha = currentSnapshot()->alpha; // always store/restore, since it's just a pointer @@ -1202,7 +1198,6 @@ bool OpenGLRenderer::storeDisplayState(DeferredDisplayState& state, int stateDef void OpenGLRenderer::restoreDisplayState(const DeferredDisplayState& state, bool skipClipRestore) { setMatrix(state.mMatrix); writableSnapshot()->alpha = state.mAlpha; - mDrawModifiers = state.mDrawModifiers; writableSnapshot()->roundRectClipState = state.mRoundRectClipState; if (state.mClipValid && !skipClipRestore) { @@ -2541,21 +2536,11 @@ void OpenGLRenderer::drawColorRect(float left, float top, float right, float bot void OpenGLRenderer::getAlphaAndMode(const SkPaint* paint, int* alpha, SkXfermode::Mode* mode) const { getAlphaAndModeDirect(paint, alpha, mode); - if (mDrawModifiers.mOverrideLayerAlpha < 1.0f) { - // if drawing a layer, ignore the paint's alpha - *alpha = mDrawModifiers.mOverrideLayerAlpha * 255; - } *alpha *= currentSnapshot()->alpha; } float OpenGLRenderer::getLayerAlpha(const Layer* layer) const { - float alpha; - if (mDrawModifiers.mOverrideLayerAlpha < 1.0f) { - alpha = mDrawModifiers.mOverrideLayerAlpha; - } else { - alpha = layer->getAlpha() / 255.0f; - } - return alpha * currentSnapshot()->alpha; + return (layer->getAlpha() / 255.0f) * currentSnapshot()->alpha; } }; // namespace uirenderer diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 5f8960a..c34eb2c 100755 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -68,17 +68,6 @@ class RenderNode; class TextDrawFunctor; class VertexBuffer; -struct DrawModifiers { - DrawModifiers() - : mOverrideLayerAlpha(0.0f) {} - - void reset() { - mOverrideLayerAlpha = 0.0f; - } - - float mOverrideLayerAlpha; -}; - enum StateDeferFlags { kStateDeferFlag_Draw = 0x1, kStateDeferFlag_Clip = 0x2 @@ -236,9 +225,6 @@ public: void setDrawFilter(SkDrawFilter* filter); - // If this value is set to < 1.0, it overrides alpha set on layer (see drawBitmap, drawLayer) - void setOverrideLayerAlpha(float alpha) { mDrawModifiers.mOverrideLayerAlpha = alpha; } - /** * Store the current display state (most importantly, the current clip and transform), and * additionally map the state's bounds from local to window coordinates. @@ -249,9 +235,6 @@ public: void restoreDisplayState(const DeferredDisplayState& state, bool skipClipRestore = false); void setupMergedMultiDraw(const Rect* clipRect); - const DrawModifiers& getDrawModifiers() { return mDrawModifiers; } - void setDrawModifiers(const DrawModifiers& drawModifiers) { mDrawModifiers = drawModifiers; } - bool isCurrentTransformSimple() { return currentTransform()->isSimple(); } @@ -523,8 +506,7 @@ protected: /** * Gets the alpha and xfermode out of a paint object. If the paint is null - * alpha will be 255 and the xfermode will be SRC_OVER. Accounts for both - * snapshot alpha, and overrideLayerAlpha + * alpha will be 255 and the xfermode will be SRC_OVER. Accounts for snapshot alpha. * * @param paint The paint to extract values from * @param alpha Where to store the resulting alpha @@ -533,7 +515,7 @@ protected: inline void getAlphaAndMode(const SkPaint* paint, int* alpha, SkXfermode::Mode* mode) const; /** - * Gets the alpha from a layer, accounting for snapshot alpha and overrideLayerAlpha + * Gets the alpha from a layer, accounting for snapshot alpha * * @param layer The layer from which the alpha is extracted */ @@ -868,10 +850,6 @@ private: // Default UV mapper const UvMapper mUvMapper; - // shader, filters, and shadow - DrawModifiers mDrawModifiers; - SkPaint mFilteredPaint; - // List of rectangles to clear after saveLayer() is invoked std::vector<Rect> mLayers; // List of layers to update at the beginning of a frame diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index ac4c0d0..8f95e0d 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -389,12 +389,9 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) { if (properties().getAlpha() < 1) { if (isLayer) { clipFlags &= ~CLIP_TO_BOUNDS; // bounds clipping done by layer - - renderer.setOverrideLayerAlpha(properties().getAlpha()); - } else { - LOG_ALWAYS_FATAL_IF(properties().getHasOverlappingRendering()); - renderer.scaleAlpha(properties().getAlpha()); } + LOG_ALWAYS_FATAL_IF(!isLayer && properties().getHasOverlappingRendering()); + renderer.scaleAlpha(properties().getAlpha()); } if (clipFlags) { Rect clipRect; @@ -902,7 +899,6 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) { DISPLAY_LIST_LOGD("%*sRestoreToCount %d", (level + 1) * 2, "", restoreTo); handler(new (alloc) RestoreToCountOp(restoreTo), PROPERTY_SAVECOUNT, properties().getClipToBounds()); - renderer.setOverrideLayerAlpha(1.0f); DISPLAY_LIST_LOGD("%*sDone (%p, %s)", level * 2, "", this, getName()); handler.endMark(); diff --git a/libs/hwui/RenderProperties.cpp b/libs/hwui/RenderProperties.cpp index 0ed3c47..7b75690 100644 --- a/libs/hwui/RenderProperties.cpp +++ b/libs/hwui/RenderProperties.cpp @@ -149,12 +149,10 @@ void RenderProperties::debugOutputProperties(const int level) const { if (mPrimitiveFields.mAlpha < 1) { if (isLayer) { clipFlags &= ~CLIP_TO_BOUNDS; // bounds clipping done by layer - - ALOGD("%*sSetOverrideLayerAlpha %.2f", level * 2, "", mPrimitiveFields.mAlpha); - } else { - LOG_ALWAYS_FATAL_IF(mPrimitiveFields.mHasOverlappingRendering); - ALOGD("%*sScaleAlpha %.2f", level * 2, "", mPrimitiveFields.mAlpha); } + + LOG_ALWAYS_FATAL_IF(!isLayer && mPrimitiveFields.mHasOverlappingRendering); + ALOGD("%*sScaleAlpha %.2f", level * 2, "", mPrimitiveFields.mAlpha); } if (clipFlags) { Rect clipRect; |