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
This commit is contained in:
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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},
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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(); }
|
||||
|
@ -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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
@ -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(®ion, op);
|
||||
}
|
||||
|
||||
}; // namespace uirenderer
|
||||
}; // namespace android
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -117,12 +117,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.
|
||||
*/
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user