diff options
author | Romain Guy <romainguy@google.com> | 2012-01-17 11:22:42 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-01-17 11:22:42 -0800 |
commit | 7677d8f006b94c76dcad6f551bf14f983f58dc14 (patch) | |
tree | a7ac1a711fa25a54772c30b11ce03e759e606787 /core | |
parent | 01cc1d1e8c917ef2e63f0bd3ac38232d41820ad0 (diff) | |
download | frameworks_base-7677d8f006b94c76dcad6f551bf14f983f58dc14.zip frameworks_base-7677d8f006b94c76dcad6f551bf14f983f58dc14.tar.gz frameworks_base-7677d8f006b94c76dcad6f551bf14f983f58dc14.tar.bz2 |
Improve GLES20Canvas clip support
Remove UnsupportedOperationException
Add primitive support for clipPath/clipRegion
Add support for quickReject(Path, EdgeType)
Change-Id: Ie7a80df7f380f488710bac31103772a9eab21612
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/view/GLES20Canvas.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index 8a9be85..700d3df 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -61,6 +61,7 @@ class GLES20Canvas extends HardwareCanvas { private final float[] mLine = new float[4]; private final Rect mClipBounds = new Rect(); + private final RectF mPathBounds = new RectF(); private DrawFilter mFilter; @@ -406,12 +407,18 @@ class GLES20Canvas extends HardwareCanvas { @Override public boolean clipPath(Path path) { - throw new UnsupportedOperationException(); + // TODO: Implement + path.computeBounds(mPathBounds, true); + return nClipRect(mRenderer, mPathBounds.left, mPathBounds.top, + mPathBounds.right, mPathBounds.bottom, Region.Op.INTERSECT.nativeInt); } @Override public boolean clipPath(Path path, Region.Op op) { - throw new UnsupportedOperationException(); + // TODO: Implement + path.computeBounds(mPathBounds, true); + return nClipRect(mRenderer, mPathBounds.left, mPathBounds.top, + mPathBounds.right, mPathBounds.bottom, op.nativeInt); } @Override @@ -459,12 +466,18 @@ class GLES20Canvas extends HardwareCanvas { @Override public boolean clipRegion(Region region) { - throw new UnsupportedOperationException(); + // TODO: Implement + region.getBounds(mClipBounds); + return nClipRect(mRenderer, mClipBounds.left, mClipBounds.top, + mClipBounds.right, mClipBounds.bottom, Region.Op.INTERSECT.nativeInt); } @Override public boolean clipRegion(Region region, Region.Op op) { - throw new UnsupportedOperationException(); + // TODO: Implement + region.getBounds(mClipBounds); + return nClipRect(mRenderer, mClipBounds.left, mClipBounds.top, + mClipBounds.right, mClipBounds.bottom, op.nativeInt); } @Override @@ -484,12 +497,14 @@ class GLES20Canvas extends HardwareCanvas { @Override public boolean quickReject(Path path, EdgeType type) { - throw new UnsupportedOperationException(); + path.computeBounds(mPathBounds, true); + return nQuickReject(mRenderer, mPathBounds.left, mPathBounds.top, + mPathBounds.right, mPathBounds.bottom, type.nativeInt); } @Override public boolean quickReject(RectF rect, EdgeType type) { - return quickReject(rect.left, rect.top, rect.right, rect.bottom, type); + return nQuickReject(mRenderer, rect.left, rect.top, rect.right, rect.bottom, type.nativeInt); } /////////////////////////////////////////////////////////////////////////// |