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

Commit 864f33a9 authored by Xavier Ducrohet's avatar Xavier Ducrohet Committed by Android (Google) Code Review
Browse files

Merge "LayoutLib: Update font object when text info changes in paint delegate"

parents afeffb74 b5ddf041
Loading
Loading
Loading
Loading
+9 −7
Original line number Original line Diff line number Diff line
@@ -340,6 +340,7 @@ public class Paint_Delegate {
        }
        }


        delegate.mTextSize = textSize;
        delegate.mTextSize = textSize;
        delegate.updateFontObject();
    }
    }


    /*package*/ static float getTextScaleX(Paint thisPaint) {
    /*package*/ static float getTextScaleX(Paint thisPaint) {
@@ -362,6 +363,7 @@ public class Paint_Delegate {
        }
        }


        delegate.mTextScaleX = scaleX;
        delegate.mTextScaleX = scaleX;
        delegate.updateFontObject();
    }
    }


    /*package*/ static float getTextSkewX(Paint thisPaint) {
    /*package*/ static float getTextSkewX(Paint thisPaint) {
@@ -384,6 +386,7 @@ public class Paint_Delegate {
        }
        }


        delegate.mTextSkewX = skewX;
        delegate.mTextSkewX = skewX;
        delegate.updateFontObject();
    }
    }


    /*package*/ static float ascent(Paint thisPaint) {
    /*package*/ static float ascent(Paint thisPaint) {
@@ -662,7 +665,9 @@ public class Paint_Delegate {
            return 0;
            return 0;
        }
        }


        return delegate.mTypeface = typeface;
        delegate.mTypeface = typeface;
        delegate.updateFontObject();
        return delegate.mTypeface;
    }
    }


    /*package*/ static int native_setRasterizer(int native_object, int rasterizer) {
    /*package*/ static int native_setRasterizer(int native_object, int rasterizer) {
@@ -670,7 +675,6 @@ public class Paint_Delegate {
        throw new UnsupportedOperationException();
        throw new UnsupportedOperationException();
    }
    }



    /*package*/ static int native_getTextAlign(int native_object) {
    /*package*/ static int native_getTextAlign(int native_object) {
        // get the delegate from the native int.
        // get the delegate from the native int.
        Paint_Delegate delegate = sManager.getDelegate(native_object);
        Paint_Delegate delegate = sManager.getDelegate(native_object);
@@ -810,14 +814,10 @@ public class Paint_Delegate {


    private Paint_Delegate() {
    private Paint_Delegate() {
        reset();
        reset();

        mTypeface = Typeface.sDefaults[0].native_instance;
        updateFontObject();
    }
    }


    private Paint_Delegate(Paint_Delegate paint) {
    private Paint_Delegate(Paint_Delegate paint) {
        set(paint);
        set(paint);
        updateFontObject();
    }
    }


    private void set(Paint_Delegate paint) {
    private void set(Paint_Delegate paint) {
@@ -838,6 +838,7 @@ public class Paint_Delegate {
        mShader = paint.mShader;
        mShader = paint.mShader;
        mPathEffect = paint.mPathEffect;
        mPathEffect = paint.mPathEffect;
        mMaskFilter = paint.mMaskFilter;
        mMaskFilter = paint.mMaskFilter;
        updateFontObject();
    }
    }


    private void reset() {
    private void reset() {
@@ -847,7 +848,7 @@ public class Paint_Delegate {
        mCap = 0;
        mCap = 0;
        mJoin = 0;
        mJoin = 0;
        mTextAlign = 0;
        mTextAlign = 0;
        mTypeface = 0;
        mTypeface = Typeface.sDefaults[0].native_instance;
        mStrokeWidth = 1.f;
        mStrokeWidth = 1.f;
        mStrokeMiter = 2.f;
        mStrokeMiter = 2.f;
        mTextSize = 20.f;
        mTextSize = 20.f;
@@ -858,6 +859,7 @@ public class Paint_Delegate {
        mShader = 0;
        mShader = 0;
        mPathEffect = 0;
        mPathEffect = 0;
        mMaskFilter = 0;
        mMaskFilter = 0;
        updateFontObject();
    }
    }


    /**
    /**