Loading core/jni/android_view_RenderNode.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -119,7 +119,6 @@ static void android_view_RenderNode_setOutlineRoundRect(JNIEnv* env, jint right, jint bottom, jfloat radius) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); renderNode->mutateStagingProperties().mutableOutline().setRoundRect(left, top, right, bottom, radius); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setOutlineConvexPath(JNIEnv* env, Loading @@ -127,21 +126,18 @@ static void android_view_RenderNode_setOutlineConvexPath(JNIEnv* env, RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); SkPath* outlinePath = reinterpret_cast<SkPath*>(outlinePathPtr); renderNode->mutateStagingProperties().mutableOutline().setConvexPath(outlinePath); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setOutlineEmpty(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); renderNode->mutateStagingProperties().mutableOutline().setEmpty(); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setClipToOutline(JNIEnv* env, jobject clazz, jlong renderNodePtr, jboolean clipToOutline) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); renderNode->mutateStagingProperties().mutableOutline().setShouldClip(clipToOutline); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setRevealClip(JNIEnv* env, Loading @@ -150,7 +146,6 @@ static void android_view_RenderNode_setRevealClip(JNIEnv* env, RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); renderNode->mutateStagingProperties().mutableRevealClip().set( shouldClip, inverseClip, x, y, radius); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setAlpha(JNIEnv* env, Loading libs/hwui/RenderNode.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -238,9 +238,8 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) { } if (CC_UNLIKELY(properties().hasClippingPath())) { // TODO: optimize for round rect/circle clipping const SkPath* path = properties().getClippingPath(); ClipPathOp* op = new (handler.allocator()) ClipPathOp(path, SkRegion::kIntersect_Op); ClipPathOp* op = new (handler.allocator()) ClipPathOp( properties().getClippingPath(), properties().getClippingPathOp()); handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); } } Loading libs/hwui/RenderProperties.cpp +1 −41 Original line number Diff line number Diff line Loading @@ -50,14 +50,11 @@ RenderProperties::PrimitiveFields::PrimitiveFields() } RenderProperties::ComputedFields::ComputedFields() : mTransformMatrix(NULL) , mClipPath(NULL) , mClipPathOp(SkRegion::kIntersect_Op) { : mTransformMatrix(NULL) { } RenderProperties::ComputedFields::~ComputedFields() { delete mTransformMatrix; delete mClipPath; } RenderProperties::RenderProperties() Loading @@ -77,9 +74,6 @@ RenderProperties& RenderProperties::operator=(const RenderProperties& other) { setAnimationMatrix(other.getAnimationMatrix()); setCameraDistance(other.getCameraDistance()); // Update the computed clip path updateClipPath(); // Force recalculation of the matrix, since other's dirty bit may be clear mPrimitiveFields.mMatrixOrPivotDirty = true; updateMatrix(); Loading Loading @@ -166,39 +160,5 @@ void RenderProperties::updateMatrix() { } } void RenderProperties::updateClipPath() { const SkPath* outlineClipPath = mPrimitiveFields.mOutline.willClip() ? mPrimitiveFields.mOutline.getPath() : NULL; const SkPath* revealClipPath = mPrimitiveFields.mRevealClip.getPath(); if (!outlineClipPath && !revealClipPath) { // mComputedFields.mClipPath doesn't need to be updated, since it won't be used return; } if (mComputedFields.mClipPath == NULL) { mComputedFields.mClipPath = new SkPath(); } SkPath* clipPath = mComputedFields.mClipPath; mComputedFields.mClipPathOp = SkRegion::kIntersect_Op; if (outlineClipPath && revealClipPath) { SkPathOp op = kIntersect_PathOp; if (mPrimitiveFields.mRevealClip.isInverseClip()) { op = kDifference_PathOp; // apply difference step in the Op below, instead of draw time } Op(*outlineClipPath, *revealClipPath, op, clipPath); } else if (outlineClipPath) { *clipPath = *outlineClipPath; } else { *clipPath = *revealClipPath; if (mPrimitiveFields.mRevealClip.isInverseClip()) { // apply difference step at draw time mComputedFields.mClipPathOp = SkRegion::kDifference_Op; } } } } /* namespace uirenderer */ } /* namespace android */ libs/hwui/RenderProperties.h +4 −8 Original line number Diff line number Diff line Loading @@ -437,19 +437,17 @@ public: ANDROID_API void updateMatrix(); ANDROID_API void updateClipPath(); // signals that mComputedFields.mClipPath is up to date, and should be used for clipping bool hasClippingPath() const { return mPrimitiveFields.mOutline.willClip() || mPrimitiveFields.mRevealClip.willClip(); return mPrimitiveFields.mRevealClip.willClip(); } const SkPath* getClippingPath() const { return hasClippingPath() ? mComputedFields.mClipPath : NULL; return mPrimitiveFields.mRevealClip.getPath(); } SkRegion::Op getClippingPathOp() const { return mComputedFields.mClipPathOp; return mPrimitiveFields.mRevealClip.isInverseClip() ? SkRegion::kDifference_Op : SkRegion::kIntersect_Op; } Outline& mutableOutline() { Loading Loading @@ -505,8 +503,6 @@ private: SkMatrix* mTransformMatrix; Sk3DView mTransformCamera; SkPath* mClipPath; // TODO: remove this, create new ops for efficient/special case clipping SkRegion::Op mClipPathOp; } mComputedFields; }; Loading Loading
core/jni/android_view_RenderNode.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -119,7 +119,6 @@ static void android_view_RenderNode_setOutlineRoundRect(JNIEnv* env, jint right, jint bottom, jfloat radius) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); renderNode->mutateStagingProperties().mutableOutline().setRoundRect(left, top, right, bottom, radius); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setOutlineConvexPath(JNIEnv* env, Loading @@ -127,21 +126,18 @@ static void android_view_RenderNode_setOutlineConvexPath(JNIEnv* env, RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); SkPath* outlinePath = reinterpret_cast<SkPath*>(outlinePathPtr); renderNode->mutateStagingProperties().mutableOutline().setConvexPath(outlinePath); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setOutlineEmpty(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); renderNode->mutateStagingProperties().mutableOutline().setEmpty(); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setClipToOutline(JNIEnv* env, jobject clazz, jlong renderNodePtr, jboolean clipToOutline) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); renderNode->mutateStagingProperties().mutableOutline().setShouldClip(clipToOutline); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setRevealClip(JNIEnv* env, Loading @@ -150,7 +146,6 @@ static void android_view_RenderNode_setRevealClip(JNIEnv* env, RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); renderNode->mutateStagingProperties().mutableRevealClip().set( shouldClip, inverseClip, x, y, radius); renderNode->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setAlpha(JNIEnv* env, Loading
libs/hwui/RenderNode.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -238,9 +238,8 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) { } if (CC_UNLIKELY(properties().hasClippingPath())) { // TODO: optimize for round rect/circle clipping const SkPath* path = properties().getClippingPath(); ClipPathOp* op = new (handler.allocator()) ClipPathOp(path, SkRegion::kIntersect_Op); ClipPathOp* op = new (handler.allocator()) ClipPathOp( properties().getClippingPath(), properties().getClippingPathOp()); handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); } } Loading
libs/hwui/RenderProperties.cpp +1 −41 Original line number Diff line number Diff line Loading @@ -50,14 +50,11 @@ RenderProperties::PrimitiveFields::PrimitiveFields() } RenderProperties::ComputedFields::ComputedFields() : mTransformMatrix(NULL) , mClipPath(NULL) , mClipPathOp(SkRegion::kIntersect_Op) { : mTransformMatrix(NULL) { } RenderProperties::ComputedFields::~ComputedFields() { delete mTransformMatrix; delete mClipPath; } RenderProperties::RenderProperties() Loading @@ -77,9 +74,6 @@ RenderProperties& RenderProperties::operator=(const RenderProperties& other) { setAnimationMatrix(other.getAnimationMatrix()); setCameraDistance(other.getCameraDistance()); // Update the computed clip path updateClipPath(); // Force recalculation of the matrix, since other's dirty bit may be clear mPrimitiveFields.mMatrixOrPivotDirty = true; updateMatrix(); Loading Loading @@ -166,39 +160,5 @@ void RenderProperties::updateMatrix() { } } void RenderProperties::updateClipPath() { const SkPath* outlineClipPath = mPrimitiveFields.mOutline.willClip() ? mPrimitiveFields.mOutline.getPath() : NULL; const SkPath* revealClipPath = mPrimitiveFields.mRevealClip.getPath(); if (!outlineClipPath && !revealClipPath) { // mComputedFields.mClipPath doesn't need to be updated, since it won't be used return; } if (mComputedFields.mClipPath == NULL) { mComputedFields.mClipPath = new SkPath(); } SkPath* clipPath = mComputedFields.mClipPath; mComputedFields.mClipPathOp = SkRegion::kIntersect_Op; if (outlineClipPath && revealClipPath) { SkPathOp op = kIntersect_PathOp; if (mPrimitiveFields.mRevealClip.isInverseClip()) { op = kDifference_PathOp; // apply difference step in the Op below, instead of draw time } Op(*outlineClipPath, *revealClipPath, op, clipPath); } else if (outlineClipPath) { *clipPath = *outlineClipPath; } else { *clipPath = *revealClipPath; if (mPrimitiveFields.mRevealClip.isInverseClip()) { // apply difference step at draw time mComputedFields.mClipPathOp = SkRegion::kDifference_Op; } } } } /* namespace uirenderer */ } /* namespace android */
libs/hwui/RenderProperties.h +4 −8 Original line number Diff line number Diff line Loading @@ -437,19 +437,17 @@ public: ANDROID_API void updateMatrix(); ANDROID_API void updateClipPath(); // signals that mComputedFields.mClipPath is up to date, and should be used for clipping bool hasClippingPath() const { return mPrimitiveFields.mOutline.willClip() || mPrimitiveFields.mRevealClip.willClip(); return mPrimitiveFields.mRevealClip.willClip(); } const SkPath* getClippingPath() const { return hasClippingPath() ? mComputedFields.mClipPath : NULL; return mPrimitiveFields.mRevealClip.getPath(); } SkRegion::Op getClippingPathOp() const { return mComputedFields.mClipPathOp; return mPrimitiveFields.mRevealClip.isInverseClip() ? SkRegion::kDifference_Op : SkRegion::kIntersect_Op; } Outline& mutableOutline() { Loading Loading @@ -505,8 +503,6 @@ private: SkMatrix* mTransformMatrix; Sk3DView mTransformCamera; SkPath* mClipPath; // TODO: remove this, create new ops for efficient/special case clipping SkRegion::Op mClipPathOp; } mComputedFields; }; Loading