Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8433c36a authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

LayoutLib: add native delegate for set/getHinting in Paint.

Change-Id: I1758f8ce861240d72113aa23dcbef5a52abade56
parent 110be0f1
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ public class Paint_Delegate {
    private float mTextSize;
    private float mTextScaleX;
    private float mTextSkewX;
    private int mHintingMode = Paint.HINTING_ON;

    private Xfermode_Delegate mXfermode;
    private ColorFilter_Delegate mColorFilter;
@@ -269,6 +270,28 @@ public class Paint_Delegate {
        setFlag(thisPaint, Paint.FILTER_BITMAP_FLAG, filter);
    }

    @LayoutlibDelegate
    /*package*/ static int getHinting(Paint thisPaint) {
        // get the delegate from the native int.
        Paint_Delegate delegate = sManager.getDelegate(thisPaint.mNativePaint);
        if (delegate == null) {
            return Paint.HINTING_ON;
        }

        return delegate.mHintingMode;
    }

    @LayoutlibDelegate
    /*package*/ static void setHinting(Paint thisPaint, int mode) {
        // get the delegate from the native int.
        Paint_Delegate delegate = sManager.getDelegate(thisPaint.mNativePaint);
        if (delegate == null) {
            return;
        }

        delegate.mHintingMode = mode;
    }

    @LayoutlibDelegate
    /*package*/ static void setAntiAlias(Paint thisPaint, boolean aa) {
        setFlag(thisPaint, Paint.ANTI_ALIAS_FLAG, aa);
@@ -1098,6 +1121,7 @@ public class Paint_Delegate {
        mPathEffect = paint.mPathEffect;
        mMaskFilter = paint.mMaskFilter;
        mRasterizer = paint.mRasterizer;
        mHintingMode = paint.mHintingMode;
        updateFontObject();
    }

@@ -1121,6 +1145,7 @@ public class Paint_Delegate {
        mMaskFilter = null;
        mRasterizer = null;
        updateFontObject();
        mHintingMode = Paint.HINTING_ON;
    }

    /**