Loading core/api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -15700,6 +15700,7 @@ package android.graphics { method public boolean clipOutRect(@NonNull android.graphics.Rect); method public boolean clipOutRect(float, float, float, float); method public boolean clipOutRect(int, int, int, int); method @FlaggedApi("com.android.graphics.hwui.flags.clip_shader") public void clipOutShader(@NonNull android.graphics.Shader); method @Deprecated public boolean clipPath(@NonNull android.graphics.Path, @NonNull android.graphics.Region.Op); method public boolean clipPath(@NonNull android.graphics.Path); method @Deprecated public boolean clipRect(@NonNull android.graphics.RectF, @NonNull android.graphics.Region.Op); Loading @@ -15709,6 +15710,7 @@ package android.graphics { method @Deprecated public boolean clipRect(float, float, float, float, @NonNull android.graphics.Region.Op); method public boolean clipRect(float, float, float, float); method public boolean clipRect(int, int, int, int); method @FlaggedApi("com.android.graphics.hwui.flags.clip_shader") public void clipShader(@NonNull android.graphics.Shader); method public void concat(@Nullable android.graphics.Matrix); method @FlaggedApi("com.android.graphics.hwui.flags.matrix_44") public void concat44(@Nullable android.graphics.Matrix44); method public void disableZ(); graphics/java/android/graphics/Canvas.java +26 −0 Original line number Diff line number Diff line Loading @@ -1128,6 +1128,30 @@ public class Canvas extends BaseCanvas { return false; } /** * Intersect the current clip with the specified shader. * The shader will be treated as an alpha mask, taking the intersection of the two. * * @param shader The shader to intersect with the current clip */ @FlaggedApi(Flags.FLAG_CLIP_SHADER) public void clipShader(@NonNull Shader shader) { nClipShader(mNativeCanvasWrapper, shader.getNativeInstance(), Region.Op.INTERSECT.nativeInt); } /** * Set the clip to the difference of the current clip and the shader. * The shader will be treated as an alpha mask, taking the difference of the two. * * @param shader The shader to intersect with the current clip */ @FlaggedApi(Flags.FLAG_CLIP_SHADER) public void clipOutShader(@NonNull Shader shader) { nClipShader(mNativeCanvasWrapper, shader.getNativeInstance(), Region.Op.DIFFERENCE.nativeInt); } public @Nullable DrawFilter getDrawFilter() { return mDrawFilter; } Loading Loading @@ -1472,6 +1496,8 @@ public class Canvas extends BaseCanvas { @CriticalNative private static native boolean nClipPath(long nativeCanvas, long nativePath, int regionOp); @CriticalNative private static native void nClipShader(long nativeCanvas, long nativeShader, int regionOp); @CriticalNative private static native void nSetDrawFilter(long nativeCanvas, long nativeFilter); @CriticalNative private static native void nGetMatrix(long nativeCanvas, long nativeMatrix); Loading libs/hwui/SkiaCanvas.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ public: : mType(Type::RRect), mOp(op), mMatrix(m), mRRect(rrect) {} Clip(const SkPath& path, SkClipOp op, const SkMatrix& m) : mType(Type::Path), mOp(op), mMatrix(m), mPath(std::in_place, path) {} Clip(const sk_sp<SkShader> shader, SkClipOp op, const SkMatrix& m) : mType(Type::Shader), mOp(op), mMatrix(m), mShader(shader) {} void apply(SkCanvas* canvas) const { canvas->setMatrix(mMatrix); Loading @@ -86,6 +88,8 @@ public: // Ensure path clips are anti-aliased canvas->clipPath(mPath.value(), mOp, true); break; case Type::Shader: canvas->clipShader(mShader, mOp); } } Loading @@ -94,6 +98,7 @@ private: Rect, RRect, Path, Shader, }; Type mType; Loading @@ -103,6 +108,7 @@ private: // These are logically a union (tracked separately due to non-POD path). std::optional<SkPath> mPath; SkRRect mRRect; sk_sp<SkShader> mShader; }; Canvas* Canvas::create_canvas(const SkBitmap& bitmap) { Loading Loading @@ -413,6 +419,11 @@ bool SkiaCanvas::clipPath(const SkPath* path, SkClipOp op) { return !mCanvas->isClipEmpty(); } void SkiaCanvas::clipShader(sk_sp<SkShader> shader, SkClipOp op) { this->recordClip(shader, op); mCanvas->clipShader(shader, op); } bool SkiaCanvas::replaceClipRect_deprecated(float left, float top, float right, float bottom) { SkRect rect = SkRect::MakeLTRB(left, top, right, bottom); Loading libs/hwui/SkiaCanvas.h +1 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ public: virtual bool quickRejectPath(const SkPath& path) const override; virtual bool clipRect(float left, float top, float right, float bottom, SkClipOp op) override; virtual bool clipPath(const SkPath* path, SkClipOp op) override; virtual void clipShader(sk_sp<SkShader> shader, SkClipOp op) override; virtual bool replaceClipRect_deprecated(float left, float top, float right, float bottom) override; virtual bool replaceClipPath_deprecated(const SkPath* path) override; Loading libs/hwui/hwui/Canvas.h +1 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,7 @@ 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 void clipShader(sk_sp<SkShader> shader, SkClipOp op) = 0; // Resets clip to wide open, used to emulate the now-removed SkClipOp::kReplace on // apps with compatibility < P. Canvases for version P and later are restricted to // intersect and difference at the Java level, matching SkClipOp's definition. Loading Loading
core/api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -15700,6 +15700,7 @@ package android.graphics { method public boolean clipOutRect(@NonNull android.graphics.Rect); method public boolean clipOutRect(float, float, float, float); method public boolean clipOutRect(int, int, int, int); method @FlaggedApi("com.android.graphics.hwui.flags.clip_shader") public void clipOutShader(@NonNull android.graphics.Shader); method @Deprecated public boolean clipPath(@NonNull android.graphics.Path, @NonNull android.graphics.Region.Op); method public boolean clipPath(@NonNull android.graphics.Path); method @Deprecated public boolean clipRect(@NonNull android.graphics.RectF, @NonNull android.graphics.Region.Op); Loading @@ -15709,6 +15710,7 @@ package android.graphics { method @Deprecated public boolean clipRect(float, float, float, float, @NonNull android.graphics.Region.Op); method public boolean clipRect(float, float, float, float); method public boolean clipRect(int, int, int, int); method @FlaggedApi("com.android.graphics.hwui.flags.clip_shader") public void clipShader(@NonNull android.graphics.Shader); method public void concat(@Nullable android.graphics.Matrix); method @FlaggedApi("com.android.graphics.hwui.flags.matrix_44") public void concat44(@Nullable android.graphics.Matrix44); method public void disableZ();
graphics/java/android/graphics/Canvas.java +26 −0 Original line number Diff line number Diff line Loading @@ -1128,6 +1128,30 @@ public class Canvas extends BaseCanvas { return false; } /** * Intersect the current clip with the specified shader. * The shader will be treated as an alpha mask, taking the intersection of the two. * * @param shader The shader to intersect with the current clip */ @FlaggedApi(Flags.FLAG_CLIP_SHADER) public void clipShader(@NonNull Shader shader) { nClipShader(mNativeCanvasWrapper, shader.getNativeInstance(), Region.Op.INTERSECT.nativeInt); } /** * Set the clip to the difference of the current clip and the shader. * The shader will be treated as an alpha mask, taking the difference of the two. * * @param shader The shader to intersect with the current clip */ @FlaggedApi(Flags.FLAG_CLIP_SHADER) public void clipOutShader(@NonNull Shader shader) { nClipShader(mNativeCanvasWrapper, shader.getNativeInstance(), Region.Op.DIFFERENCE.nativeInt); } public @Nullable DrawFilter getDrawFilter() { return mDrawFilter; } Loading Loading @@ -1472,6 +1496,8 @@ public class Canvas extends BaseCanvas { @CriticalNative private static native boolean nClipPath(long nativeCanvas, long nativePath, int regionOp); @CriticalNative private static native void nClipShader(long nativeCanvas, long nativeShader, int regionOp); @CriticalNative private static native void nSetDrawFilter(long nativeCanvas, long nativeFilter); @CriticalNative private static native void nGetMatrix(long nativeCanvas, long nativeMatrix); Loading
libs/hwui/SkiaCanvas.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ public: : mType(Type::RRect), mOp(op), mMatrix(m), mRRect(rrect) {} Clip(const SkPath& path, SkClipOp op, const SkMatrix& m) : mType(Type::Path), mOp(op), mMatrix(m), mPath(std::in_place, path) {} Clip(const sk_sp<SkShader> shader, SkClipOp op, const SkMatrix& m) : mType(Type::Shader), mOp(op), mMatrix(m), mShader(shader) {} void apply(SkCanvas* canvas) const { canvas->setMatrix(mMatrix); Loading @@ -86,6 +88,8 @@ public: // Ensure path clips are anti-aliased canvas->clipPath(mPath.value(), mOp, true); break; case Type::Shader: canvas->clipShader(mShader, mOp); } } Loading @@ -94,6 +98,7 @@ private: Rect, RRect, Path, Shader, }; Type mType; Loading @@ -103,6 +108,7 @@ private: // These are logically a union (tracked separately due to non-POD path). std::optional<SkPath> mPath; SkRRect mRRect; sk_sp<SkShader> mShader; }; Canvas* Canvas::create_canvas(const SkBitmap& bitmap) { Loading Loading @@ -413,6 +419,11 @@ bool SkiaCanvas::clipPath(const SkPath* path, SkClipOp op) { return !mCanvas->isClipEmpty(); } void SkiaCanvas::clipShader(sk_sp<SkShader> shader, SkClipOp op) { this->recordClip(shader, op); mCanvas->clipShader(shader, op); } bool SkiaCanvas::replaceClipRect_deprecated(float left, float top, float right, float bottom) { SkRect rect = SkRect::MakeLTRB(left, top, right, bottom); Loading
libs/hwui/SkiaCanvas.h +1 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ public: virtual bool quickRejectPath(const SkPath& path) const override; virtual bool clipRect(float left, float top, float right, float bottom, SkClipOp op) override; virtual bool clipPath(const SkPath* path, SkClipOp op) override; virtual void clipShader(sk_sp<SkShader> shader, SkClipOp op) override; virtual bool replaceClipRect_deprecated(float left, float top, float right, float bottom) override; virtual bool replaceClipPath_deprecated(const SkPath* path) override; Loading
libs/hwui/hwui/Canvas.h +1 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,7 @@ 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 void clipShader(sk_sp<SkShader> shader, SkClipOp op) = 0; // Resets clip to wide open, used to emulate the now-removed SkClipOp::kReplace on // apps with compatibility < P. Canvases for version P and later are restricted to // intersect and difference at the Java level, matching SkClipOp's definition. Loading