summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2017-01-04 14:57:43 -0500
committerDerek Sollenberger <djsollen@google.com>2017-01-04 14:57:43 -0500
commitb29b16e5423fe7deab8ebf3da512c6d2192f19b5 (patch)
tree6e0c9b68f6cf30fddb28f358e373c2cefa3d37a8
parente5fb79bb2def5a17d158193c2e668224dc5ad5c1 (diff)
Remove clipRegion from the public API.
This API is difficult to support for printing and has other negative effects as it does not respect the current matrix/clip. Test: compile Bug: 14650725 Change-Id: I71f9bd687d446c7ce8910d755421aad8e09458db
-rw-r--r--api/current.txt2
-rw-r--r--api/removed.txt5
-rw-r--r--api/system-current.txt2
-rw-r--r--api/system-removed.txt5
-rw-r--r--api/test-current.txt2
-rw-r--r--api/test-removed.txt5
-rw-r--r--core/jni/android_graphics_Canvas.cpp8
-rw-r--r--graphics/java/android/graphics/Canvas.java10
-rw-r--r--libs/hwui/CanvasState.cpp5
-rw-r--r--libs/hwui/CanvasState.h1
-rw-r--r--libs/hwui/ClipArea.h2
-rw-r--r--libs/hwui/FontRenderer.cpp1
-rw-r--r--libs/hwui/RecordingCanvas.cpp3
-rw-r--r--libs/hwui/RecordingCanvas.h1
-rw-r--r--libs/hwui/SkiaCanvas.cpp17
-rw-r--r--libs/hwui/SkiaCanvas.h1
-rw-r--r--libs/hwui/SkiaCanvasProxy.cpp4
-rw-r--r--libs/hwui/SkiaCanvasProxy.h1
-rw-r--r--libs/hwui/Snapshot.cpp5
-rw-r--r--libs/hwui/Snapshot.h6
-rw-r--r--libs/hwui/hwui/Canvas.h1
21 files changed, 21 insertions, 66 deletions
diff --git a/api/current.txt b/api/current.txt
index ec16f5a5f56b..a4bbcd279554 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -11946,8 +11946,6 @@ package android.graphics {
method public boolean clipRect(float, float, float, float, android.graphics.Region.Op);
method public boolean clipRect(float, float, float, float);
method public boolean clipRect(int, int, int, int);
- method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
- method public deprecated boolean clipRegion(android.graphics.Region);
method public void concat(android.graphics.Matrix);
method public void drawARGB(int, int, int, int);
method public void drawArc(android.graphics.RectF, float, float, boolean, android.graphics.Paint);
diff --git a/api/removed.txt b/api/removed.txt
index 35b485980276..d7a8bce2d00b 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -78,6 +78,11 @@ package android.graphics {
enum_constant public static final android.graphics.AvoidXfermode.Mode TARGET;
}
+ public class Canvas {
+ method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
+ method public deprecated boolean clipRegion(android.graphics.Region);
+ }
+
public deprecated class LayerRasterizer extends android.graphics.Rasterizer {
ctor public LayerRasterizer();
method public void addLayer(android.graphics.Paint, float, float);
diff --git a/api/system-current.txt b/api/system-current.txt
index 5f173cf42258..734512d7ed42 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -12443,8 +12443,6 @@ package android.graphics {
method public boolean clipRect(float, float, float, float, android.graphics.Region.Op);
method public boolean clipRect(float, float, float, float);
method public boolean clipRect(int, int, int, int);
- method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
- method public deprecated boolean clipRegion(android.graphics.Region);
method public void concat(android.graphics.Matrix);
method public void drawARGB(int, int, int, int);
method public void drawArc(android.graphics.RectF, float, float, boolean, android.graphics.Paint);
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 8016f58ccedb..7ba88bdb9d33 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -76,6 +76,11 @@ package android.graphics {
enum_constant public static final android.graphics.AvoidXfermode.Mode TARGET;
}
+ public class Canvas {
+ method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
+ method public deprecated boolean clipRegion(android.graphics.Region);
+ }
+
public deprecated class LayerRasterizer extends android.graphics.Rasterizer {
ctor public LayerRasterizer();
method public void addLayer(android.graphics.Paint, float, float);
diff --git a/api/test-current.txt b/api/test-current.txt
index d4fb027bcb4d..582b591c8de2 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -11977,8 +11977,6 @@ package android.graphics {
method public boolean clipRect(float, float, float, float, android.graphics.Region.Op);
method public boolean clipRect(float, float, float, float);
method public boolean clipRect(int, int, int, int);
- method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
- method public deprecated boolean clipRegion(android.graphics.Region);
method public void concat(android.graphics.Matrix);
method public void drawARGB(int, int, int, int);
method public void drawArc(android.graphics.RectF, float, float, boolean, android.graphics.Paint);
diff --git a/api/test-removed.txt b/api/test-removed.txt
index 35b485980276..d7a8bce2d00b 100644
--- a/api/test-removed.txt
+++ b/api/test-removed.txt
@@ -78,6 +78,11 @@ package android.graphics {
enum_constant public static final android.graphics.AvoidXfermode.Mode TARGET;
}
+ public class Canvas {
+ method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
+ method public deprecated boolean clipRegion(android.graphics.Region);
+ }
+
public deprecated class LayerRasterizer extends android.graphics.Rasterizer {
ctor public LayerRasterizer();
method public void addLayer(android.graphics.Paint, float, float);
diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp
index be9449b6eb5c..9ce5670f904c 100644
--- a/core/jni/android_graphics_Canvas.cpp
+++ b/core/jni/android_graphics_Canvas.cpp
@@ -219,13 +219,6 @@ static jboolean clipPath(JNIEnv* env, jobject, jlong canvasHandle, jlong pathHan
return nonEmptyClip ? JNI_TRUE : JNI_FALSE;
}
-static jboolean clipRegion(JNIEnv* env, jobject, jlong canvasHandle, jlong deviceRgnHandle,
- jint opHandle) {
- SkRegion* deviceRgn = reinterpret_cast<SkRegion*>(deviceRgnHandle);
- bool nonEmptyClip = get_canvas(canvasHandle)->clipRegion(deviceRgn, opHandleToClipOp(opHandle));
- return nonEmptyClip ? JNI_TRUE : JNI_FALSE;
-}
-
static void drawColor(JNIEnv* env, jobject, jlong canvasHandle, jint color, jint modeHandle) {
SkBlendMode mode = static_cast<SkBlendMode>(modeHandle);
get_canvas(canvasHandle)->drawColor(color, mode);
@@ -616,7 +609,6 @@ static const JNINativeMethod gMethods[] = {
{"nQuickReject","(JFFFF)Z", (void*)CanvasJNI::quickRejectRect},
{"nClipRect","(JFFFFI)Z", (void*) CanvasJNI::clipRect},
{"nClipPath","(JJI)Z", (void*) CanvasJNI::clipPath},
- {"nClipRegion","(JJI)Z", (void*) CanvasJNI::clipRegion},
{"nSetDrawFilter", "(JJ)V", (void*) CanvasJNI::setDrawFilter},
};
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index b0934586b27c..cc5cc7bd8cf8 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -801,12 +801,13 @@ public class Canvas extends BaseCanvas {
* @param op How the clip is modified
* @return true if the resulting is non-empty
*
+ * @removed
* @deprecated Unlike all other clip calls this API does not respect the
* current matrix. Use {@link #clipRect(Rect)} as an alternative.
*/
@Deprecated
public boolean clipRegion(@NonNull Region region, @NonNull Region.Op op) {
- return nClipRegion(mNativeCanvasWrapper, region.ni(), op.nativeInt);
+ return false;
}
/**
@@ -819,12 +820,13 @@ public class Canvas extends BaseCanvas {
* @param region The region to operate on the current clip, based on op
* @return true if the resulting is non-empty
*
+ * @removed
* @deprecated Unlike all other clip calls this API does not respect the
* current matrix. Use {@link #clipRect(Rect)} as an alternative.
*/
@Deprecated
public boolean clipRegion(@NonNull Region region) {
- return clipRegion(region, Region.Op.INTERSECT);
+ return false;
}
public @Nullable DrawFilter getDrawFilter() {
@@ -1115,10 +1117,6 @@ public class Canvas extends BaseCanvas {
long nativePath,
int regionOp);
@FastNative
- private static native boolean nClipRegion(long nativeCanvas,
- long nativeRegion,
- int regionOp);
- @FastNative
private static native void nSetDrawFilter(long nativeCanvas,
long nativeFilter);
@FastNative
diff --git a/libs/hwui/CanvasState.cpp b/libs/hwui/CanvasState.cpp
index dbbf00d8bdec..9c068b080d45 100644
--- a/libs/hwui/CanvasState.cpp
+++ b/libs/hwui/CanvasState.cpp
@@ -212,11 +212,6 @@ bool CanvasState::clipPath(const SkPath* path, SkClipOp op) {
return !mSnapshot->clipIsEmpty();
}
-bool CanvasState::clipRegion(const SkRegion* region, SkClipOp op) {
- mSnapshot->clipRegionTransformed(*region, op);
- return !mSnapshot->clipIsEmpty();
-}
-
void CanvasState::setClippingOutline(LinearAllocator& allocator, const Outline* outline) {
Rect bounds;
float radius;
diff --git a/libs/hwui/CanvasState.h b/libs/hwui/CanvasState.h
index a805597ac9b9..b1fe09eb1aec 100644
--- a/libs/hwui/CanvasState.h
+++ b/libs/hwui/CanvasState.h
@@ -124,7 +124,6 @@ public:
bool clipRect(float left, float top, float right, float bottom, SkClipOp op);
bool clipPath(const SkPath* path, SkClipOp op);
- bool clipRegion(const SkRegion* region, SkClipOp op);
/**
* Sets a "clipping outline", which is independent from the regular clip.
diff --git a/libs/hwui/ClipArea.h b/libs/hwui/ClipArea.h
index 2e561601d452..cf5751606d12 100644
--- a/libs/hwui/ClipArea.h
+++ b/libs/hwui/ClipArea.h
@@ -146,7 +146,6 @@ public:
void setClip(float left, float top, float right, float bottom);
void clipRectWithTransform(const Rect& r, const mat4* transform,
SkRegion::Op op);
- void clipRegion(const SkRegion& region, SkRegion::Op op);
void clipPathWithTransform(const SkPath& path, const mat4* transform,
SkRegion::Op op);
@@ -195,6 +194,7 @@ private:
void regionModeClipRectWithTransform(const Rect& r, const mat4* transform,
SkRegion::Op op);
+ void clipRegion(const SkRegion& region, SkRegion::Op op);
void ensureClipRegion();
void onClipRegionUpdated();
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index effc65ea967f..4f9a3de64fc2 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -22,6 +22,7 @@
#include "Caches.h"
#include "Debug.h"
#include "Extensions.h"
+#include "font/Font.h"
#include "Glop.h"
#include "GlopBuilder.h"
#include "PixelBuffer.h"
diff --git a/libs/hwui/RecordingCanvas.cpp b/libs/hwui/RecordingCanvas.cpp
index 96c6d29af221..ee6279dccb92 100644
--- a/libs/hwui/RecordingCanvas.cpp
+++ b/libs/hwui/RecordingCanvas.cpp
@@ -240,9 +240,6 @@ bool RecordingCanvas::clipRect(float left, float top, float right, float bottom,
bool RecordingCanvas::clipPath(const SkPath* path, SkClipOp op) {
return mState.clipPath(path, op);
}
-bool RecordingCanvas::clipRegion(const SkRegion* region, SkClipOp op) {
- return mState.clipRegion(region, op);
-}
// ----------------------------------------------------------------------------
// android/graphics/Canvas draw operations
diff --git a/libs/hwui/RecordingCanvas.h b/libs/hwui/RecordingCanvas.h
index 5d4938581d20..44181bd22397 100644
--- a/libs/hwui/RecordingCanvas.h
+++ b/libs/hwui/RecordingCanvas.h
@@ -134,7 +134,6 @@ public:
virtual bool clipRect(float left, float top, float right, float bottom,
SkClipOp op) override;
virtual bool clipPath(const SkPath* path, SkClipOp op) override;
- virtual bool clipRegion(const SkRegion* region, SkClipOp op) override;
// Misc
virtual SkDrawFilter* getDrawFilter() override { return mDrawFilter.get(); }
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index 8cae771f39b2..344df0a70da5 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -416,23 +416,6 @@ bool SkiaCanvas::clipPath(const SkPath* path, SkClipOp op) {
return !mCanvas->isClipEmpty();
}
-bool SkiaCanvas::clipRegion(const SkRegion* region, SkClipOp op) {
- SkPath rgnPath;
- if (region->getBoundaryPath(&rgnPath)) {
- // The region is specified in device space.
- SkMatrix savedMatrix = mCanvas->getTotalMatrix();
- mCanvas->resetMatrix();
- this->recordClip(rgnPath, op);
- mCanvas->clipPath(rgnPath, op);
- mCanvas->setMatrix(savedMatrix);
- } else {
- const auto emptyClip = SkRect::MakeEmpty();
- this->recordClip(emptyClip, op);
- mCanvas->clipRect(emptyClip, op);
- }
- return !mCanvas->isClipEmpty();
-}
-
// ----------------------------------------------------------------------------
// Canvas state operations: Filters
// ----------------------------------------------------------------------------
diff --git a/libs/hwui/SkiaCanvas.h b/libs/hwui/SkiaCanvas.h
index 9639ebd19bbb..34c3717557ff 100644
--- a/libs/hwui/SkiaCanvas.h
+++ b/libs/hwui/SkiaCanvas.h
@@ -94,7 +94,6 @@ public:
virtual bool clipRect(float left, float top, float right, float bottom,
SkClipOp op) override;
virtual bool clipPath(const SkPath* path, SkClipOp op) override;
- virtual bool clipRegion(const SkRegion* region, SkClipOp op) override;
virtual SkDrawFilter* getDrawFilter() override;
virtual void setDrawFilter(SkDrawFilter* drawFilter) override;
diff --git a/libs/hwui/SkiaCanvasProxy.cpp b/libs/hwui/SkiaCanvasProxy.cpp
index 75396f7b4cf2..847c1cfafd16 100644
--- a/libs/hwui/SkiaCanvasProxy.cpp
+++ b/libs/hwui/SkiaCanvasProxy.cpp
@@ -444,9 +444,5 @@ void SkiaCanvasProxy::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle)
mCanvas->clipPath(&path, op);
}
-void SkiaCanvasProxy::onClipRegion(const SkRegion& region, SkClipOp op) {
- mCanvas->clipRegion(&region, op);
-}
-
}; // namespace uirenderer
}; // namespace android
diff --git a/libs/hwui/SkiaCanvasProxy.h b/libs/hwui/SkiaCanvasProxy.h
index badcc1dfe8cc..54dbdda5750f 100644
--- a/libs/hwui/SkiaCanvasProxy.h
+++ b/libs/hwui/SkiaCanvasProxy.h
@@ -93,7 +93,6 @@ protected:
virtual void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override;
virtual void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override;
virtual void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override;
- virtual void onClipRegion(const SkRegion&, SkClipOp) override;
private:
Canvas* mCanvas;
diff --git a/libs/hwui/Snapshot.cpp b/libs/hwui/Snapshot.cpp
index 3f08009b6be9..9d719bd1e997 100644
--- a/libs/hwui/Snapshot.cpp
+++ b/libs/hwui/Snapshot.cpp
@@ -72,11 +72,6 @@ Snapshot::Snapshot(Snapshot* s, int saveFlags)
// Clipping
///////////////////////////////////////////////////////////////////////////////
-void Snapshot::clipRegionTransformed(const SkRegion& region, SkClipOp op) {
- flags |= Snapshot::kFlagClipSet;
- mClipArea->clipRegion(region, static_cast<SkRegion::Op>(op));
-}
-
void Snapshot::clip(const Rect& localClip, SkClipOp op) {
flags |= Snapshot::kFlagClipSet;
mClipArea->clipRectWithTransform(localClip, transform, static_cast<SkRegion::Op>(op));
diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h
index 4f92657d01ba..8cd90a68a9bb 100644
--- a/libs/hwui/Snapshot.h
+++ b/libs/hwui/Snapshot.h
@@ -118,12 +118,6 @@ public:
void clipTransformed(const Rect& r, SkClipOp op = SkClipOp::kIntersect);
/**
- * Modifies the current clip with the specified region and operation.
- * The specified region is considered already transformed.
- */
- void clipRegionTransformed(const SkRegion& region, SkClipOp op);
-
- /**
* Modifies the current clip with the specified path and operation.
*/
void clipPath(const SkPath& path, SkClipOp op);
diff --git a/libs/hwui/hwui/Canvas.h b/libs/hwui/hwui/Canvas.h
index e7b6b2d329f1..969d87716ce6 100644
--- a/libs/hwui/hwui/Canvas.h
+++ b/libs/hwui/hwui/Canvas.h
@@ -184,7 +184,6 @@ public:
virtual bool clipRect(float left, float top, float right, float bottom,
SkClipOp op) = 0;
virtual bool clipPath(const SkPath* path, SkClipOp op) = 0;
- virtual bool clipRegion(const SkRegion* region, SkClipOp op) = 0;
// filters
virtual SkDrawFilter* getDrawFilter() = 0;