diff options
| -rw-r--r-- | libs/hwui/CanvasState.cpp | 2 | ||||
| -rw-r--r-- | libs/hwui/ClipArea.cpp | 24 | ||||
| -rw-r--r-- | libs/hwui/ClipArea.h | 8 | ||||
| -rw-r--r-- | libs/hwui/Snapshot.cpp | 4 | ||||
| -rw-r--r-- | libs/hwui/Snapshot.h | 2 | ||||
| -rw-r--r-- | libs/hwui/tests/common/TestUtils.h | 2 |
6 files changed, 5 insertions, 37 deletions
diff --git a/libs/hwui/CanvasState.cpp b/libs/hwui/CanvasState.cpp index 6a6cc42043df..cf76e6be46c4 100644 --- a/libs/hwui/CanvasState.cpp +++ b/libs/hwui/CanvasState.cpp @@ -192,7 +192,7 @@ void CanvasState::concatMatrix(const Matrix4& matrix) { /////////////////////////////////////////////////////////////////////////////// bool CanvasState::clipRect(float left, float top, float right, float bottom, SkRegion::Op op) { - mSnapshot->clip(left, top, right, bottom, op); + mSnapshot->clip(Rect(left, top, right, bottom), op); mDirtyClip = true; return !mSnapshot->clipIsEmpty(); } diff --git a/libs/hwui/ClipArea.cpp b/libs/hwui/ClipArea.cpp index fd6f0b5739d2..5f166cafd01c 100644 --- a/libs/hwui/ClipArea.cpp +++ b/libs/hwui/ClipArea.cpp @@ -201,12 +201,6 @@ void ClipArea::setClip(float left, float top, float right, float bottom) { mClipRegion.setEmpty(); } -void ClipArea::clipRectWithTransform(float left, float top, float right, - float bottom, const mat4* transform, SkRegion::Op op) { - Rect r(left, top, right, bottom); - clipRectWithTransform(r, transform, op); -} - void ClipArea::clipRectWithTransform(const Rect& r, const mat4* transform, SkRegion::Op op) { switch (mMode) { @@ -274,13 +268,6 @@ void ClipArea::rectangleModeClipRectWithTransform(const Rect& r, rectangleListModeClipRectWithTransform(r, transform, op); } -void ClipArea::rectangleModeClipRectWithTransform(float left, float top, - float right, float bottom, const mat4* transform, SkRegion::Op op) { - Rect r(left, top, right, bottom); - rectangleModeClipRectWithTransform(r, transform, op); - mClipRect = mRectangleList.calculateBounds(); -} - /* * RectangleList mode implementation */ @@ -303,12 +290,6 @@ void ClipArea::rectangleListModeClipRectWithTransform(const Rect& r, } } -void ClipArea::rectangleListModeClipRectWithTransform(float left, float top, - float right, float bottom, const mat4* transform, SkRegion::Op op) { - Rect r(left, top, right, bottom); - rectangleListModeClipRectWithTransform(r, transform, op); -} - /* * Region mode implementation */ @@ -336,11 +317,6 @@ void ClipArea::regionModeClipRectWithTransform(const Rect& r, onClipRegionUpdated(); } -void ClipArea::regionModeClipRectWithTransform(float left, float top, - float right, float bottom, const mat4* transform, SkRegion::Op op) { - regionModeClipRectWithTransform(Rect(left, top, right, bottom), transform, op); -} - void ClipArea::onClipRegionUpdated() { if (!mClipRegion.isEmpty()) { mClipRect.set(mClipRegion.getBounds()); diff --git a/libs/hwui/ClipArea.h b/libs/hwui/ClipArea.h index f88fd92e234d..268301c62fc9 100644 --- a/libs/hwui/ClipArea.h +++ b/libs/hwui/ClipArea.h @@ -98,8 +98,6 @@ public: void setEmpty(); void setClip(float left, float top, float right, float bottom); - void clipRectWithTransform(float left, float top, float right, float bottom, - const mat4* transform, SkRegion::Op op); void clipRectWithTransform(const Rect& r, const mat4* transform, SkRegion::Op op); void clipRegion(const SkRegion& region, SkRegion::Op op); @@ -133,12 +131,8 @@ public: private: void enterRectangleMode(); void rectangleModeClipRectWithTransform(const Rect& r, const mat4* transform, SkRegion::Op op); - void rectangleModeClipRectWithTransform(float left, float top, float right, - float bottom, const mat4* transform, SkRegion::Op op); void enterRectangleListMode(); - void rectangleListModeClipRectWithTransform(float left, float top, - float right, float bottom, const mat4* transform, SkRegion::Op op); void rectangleListModeClipRectWithTransform(const Rect& r, const mat4* transform, SkRegion::Op op); @@ -147,8 +141,6 @@ private: void enterRegionMode(); void regionModeClipRectWithTransform(const Rect& r, const mat4* transform, SkRegion::Op op); - void regionModeClipRectWithTransform(float left, float top, float right, - float bottom, const mat4* transform, SkRegion::Op op); void ensureClipRegion(); void onClipRegionUpdated(); diff --git a/libs/hwui/Snapshot.cpp b/libs/hwui/Snapshot.cpp index 2f535bb1cb08..c6d89775390b 100644 --- a/libs/hwui/Snapshot.cpp +++ b/libs/hwui/Snapshot.cpp @@ -88,9 +88,9 @@ void Snapshot::clipRegionTransformed(const SkRegion& region, SkRegion::Op op) { mClipArea->clipRegion(region, op); } -void Snapshot::clip(float left, float top, float right, float bottom, SkRegion::Op op) { +void Snapshot::clip(const Rect& localClip, SkRegion::Op op) { flags |= Snapshot::kFlagClipSet; - mClipArea->clipRectWithTransform(left, top, right, bottom, transform, op); + mClipArea->clipRectWithTransform(localClip, transform, op); } void Snapshot::clipPath(const SkPath& path, SkRegion::Op op) { diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h index 4789b338d173..194aa5735a7e 100644 --- a/libs/hwui/Snapshot.h +++ b/libs/hwui/Snapshot.h @@ -124,7 +124,7 @@ public: * the specified operation. The specified rectangle is transformed * by this snapshot's trasnformation. */ - void clip(float left, float top, float right, float bottom, SkRegion::Op op); + void clip(const Rect& localClip, SkRegion::Op op); /** * Modifies the current clip with the new clip rectangle and diff --git a/libs/hwui/tests/common/TestUtils.h b/libs/hwui/tests/common/TestUtils.h index d37fad4676eb..ac14fc84b8a3 100644 --- a/libs/hwui/tests/common/TestUtils.h +++ b/libs/hwui/tests/common/TestUtils.h @@ -98,7 +98,7 @@ public: static std::unique_ptr<Snapshot> makeSnapshot(const Matrix4& transform, const Rect& clip) { std::unique_ptr<Snapshot> snapshot(new Snapshot()); - snapshot->clip(clip.left, clip.top, clip.right, clip.bottom, SkRegion::kReplace_Op); + snapshot->clip(clip, SkRegion::kReplace_Op); // store clip first, so it isn't transformed *(snapshot->transform) = transform; return snapshot; } |