am c686757a: Merge "Unify clipping return value behavior - true if not empty" into mnc-dev
* commit 'c686757a183028deef5f27ed6c0412417f59cf35': Unify clipping return value behavior - true if not empty
This commit is contained in:
@@ -175,24 +175,24 @@ static jboolean quickRejectPath(JNIEnv* env, jobject, jlong canvasHandle, jlong
|
||||
static jboolean clipRect(JNIEnv*, jobject, jlong canvasHandle, jfloat l, jfloat t,
|
||||
jfloat r, jfloat b, jint opHandle) {
|
||||
SkRegion::Op op = static_cast<SkRegion::Op>(opHandle);
|
||||
bool emptyClip = get_canvas(canvasHandle)->clipRect(l, t, r, b, op);
|
||||
return emptyClip ? JNI_FALSE : JNI_TRUE;
|
||||
bool nonEmptyClip = get_canvas(canvasHandle)->clipRect(l, t, r, b, op);
|
||||
return nonEmptyClip ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
static jboolean clipPath(JNIEnv* env, jobject, jlong canvasHandle, jlong pathHandle,
|
||||
jint opHandle) {
|
||||
SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
|
||||
SkRegion::Op op = static_cast<SkRegion::Op>(opHandle);
|
||||
bool emptyClip = get_canvas(canvasHandle)->clipPath(path, op);
|
||||
return emptyClip ? JNI_FALSE : JNI_TRUE;
|
||||
bool nonEmptyClip = get_canvas(canvasHandle)->clipPath(path, op);
|
||||
return nonEmptyClip ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
static jboolean clipRegion(JNIEnv* env, jobject, jlong canvasHandle, jlong deviceRgnHandle,
|
||||
jint opHandle) {
|
||||
SkRegion* deviceRgn = reinterpret_cast<SkRegion*>(deviceRgnHandle);
|
||||
SkRegion::Op op = static_cast<SkRegion::Op>(opHandle);
|
||||
bool emptyClip = get_canvas(canvasHandle)->clipRegion(deviceRgn, op);
|
||||
return emptyClip ? JNI_FALSE : JNI_TRUE;
|
||||
bool nonEmptyClip = get_canvas(canvasHandle)->clipRegion(deviceRgn, op);
|
||||
return nonEmptyClip ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
static void drawColor(JNIEnv* env, jobject, jlong canvasHandle, jint color, jint modeHandle) {
|
||||
|
||||
@@ -419,12 +419,12 @@ bool SkiaCanvas::quickRejectPath(const SkPath& path) const {
|
||||
bool SkiaCanvas::clipRect(float left, float top, float right, float bottom, SkRegion::Op op) {
|
||||
SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
|
||||
mCanvas->clipRect(rect, op);
|
||||
return mCanvas->isClipEmpty();
|
||||
return !mCanvas->isClipEmpty();
|
||||
}
|
||||
|
||||
bool SkiaCanvas::clipPath(const SkPath* path, SkRegion::Op op) {
|
||||
mCanvas->clipPath(*path, op);
|
||||
return mCanvas->isClipEmpty();
|
||||
return !mCanvas->isClipEmpty();
|
||||
}
|
||||
|
||||
bool SkiaCanvas::clipRegion(const SkRegion* region, SkRegion::Op op) {
|
||||
@@ -438,7 +438,7 @@ bool SkiaCanvas::clipRegion(const SkRegion* region, SkRegion::Op op) {
|
||||
} else {
|
||||
mCanvas->clipRect(SkRect::MakeEmpty(), op);
|
||||
}
|
||||
return mCanvas->isClipEmpty();
|
||||
return !mCanvas->isClipEmpty();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user